File: disc.hpp

package info (click to toggle)
libcdio 2.2.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 16,140 kB
  • sloc: ansic: 39,407; cpp: 2,556; sh: 1,263; makefile: 826; yacc: 324; ruby: 116; perl: 34
file content (187 lines) | stat: -rw-r--r-- 4,248 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/*
    Copyright (C) 2005, 2008, 2012 Rocky Bernstein <rocky@gnu.org>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

/** \file disc.hpp
 *  \brief methods relating to getting Compact Disc information. This file
 *  should not be #included directly.
 */

/*! 
  Get disc mode - the kind of CD (CD-DA, CD-ROM mode 1, CD-MIXED, etc.
  that we've got. The notion of "CD" is extended a little to include
  DVD's.
*/
discmode_t getDiscmode () 
{
  return cdio_get_discmode(p_cdio);
}

/*!  
  Get the lsn of the end of the CD
  
  @return the lsn. On error 0 or CDIO_INVALD_LSN.
*/
lsn_t getDiscLastLsn() 
{
  return cdio_get_disc_last_lsn(p_cdio);
}

/*!
  Get the number of the first track. 
  
  @return a track object or NULL;
  on error.
*/
CdioTrack *getFirstTrack() 
{
  track_t i_track = cdio_get_first_track_num(p_cdio);
  return (CDIO_INVALID_TRACK != i_track) 
    ? new CdioTrack(p_cdio, i_track)
    : (CdioTrack *) NULL;
}

/*!
  Get the number of the first track. 
  
  @return the track number or CDIO_INVALID_TRACK 
  on error.
*/
track_t getFirstTrackNum() 
{
  return cdio_get_first_track_num(p_cdio);
}


/*!
  Get the number of the first track. 
  
  @return a track object or NULL;
  on error.
*/
CdioTrack *getLastTrack() 
{
  track_t i_track = cdio_get_last_track_num(p_cdio);
  return (CDIO_INVALID_TRACK != i_track) 
    ? new CdioTrack(p_cdio, i_track)
    : (CdioTrack *) NULL;
}

/*!
  Get the number of the first track. 
  
  @return the track number or CDIO_INVALID_TRACK 
  on error.
*/
track_t getLastTrackNum() 
{
  return cdio_get_last_track_num(p_cdio);
}

/*!  
  Return the Joliet level recognized for p_cdio.
*/
uint8_t getJolietLevel() 
{
  return cdio_get_joliet_level(p_cdio);
}

/*!
  Get the media catalog number (MCN) from the CD.
  
  @return the media catalog number r NULL if there is none or we
  don't have the ability to get it.
  
  Note: The caller must free the returned string with cdio_free()
  when done with it.
  
*/
char * getMcn () 
{
  return cdio_get_mcn (p_cdio);
}

/*!
  Get the number of tracks on the CD.
  
  @return the number of tracks, or CDIO_INVALID_TRACK if there is
  an error.
*/
track_t getNumTracks () 
{
  return cdio_get_num_tracks(p_cdio);
}

/*! Find the track which contans lsn.
  CDIO_INVALID_TRACK is returned if the lsn outside of the CD or
  if there was some error. 
  
  If the lsn is before the pregap of the first track 0 is returned.
  Otherwise we return the track that spans the lsn.
*/
CdioTrack *getTrackFromNum(track_t i_track) 
{
  return new CdioTrack(p_cdio, i_track);
}

/*! Find the track which contans lsn.
  CDIO_INVALID_TRACK is returned if the lsn outside of the CD or
  if there was some error. 
  
  If the lsn is before the pregap of the first track 0 is returned.
  Otherwise we return the track that spans the lsn.
*/
CdioTrack *getTrackFromLsn(lsn_t lsn) 
{
  track_t i_track = cdio_get_track(p_cdio, lsn);
  return (CDIO_INVALID_TRACK != i_track) 
    ? new CdioTrack(p_cdio, i_track)
    : (CdioTrack *) NULL;
}


/*! 
  Return true if discmode is some sort of CD.
*/
bool isDiscmodeCdrom (discmode_t discmode) {
  return cdio_is_discmode_cdrom(discmode);
}


/*! 
  Return true if discmode is some sort of DVD.
*/
bool isDiscmodeDvd (discmode_t discmode) 
{
  return cdio_is_discmode_dvd (discmode) ;
}

/*! 
  Get CD-Text information for a CdIo_t object.

  @return the CD-Text object or NULL if obj is NULL
  or CD-Text information does not exist.
 */
CdioCDText *getCdtext ()
{
  cdtext_t *cdtext = cdio_get_cdtext (p_cdio);

  if (NULL == cdtext)
    return (CdioCDText *) NULL;
  else
    return new CdioCDText(cdtext);
}