This repository has been archived on 2025-05-24. You can view files and clone it, but cannot push or open issues or pull requests.
Files
libcdio-osx/include/cdio++/disc.hpp
R. Bernstein dbf6d24765 1) cdtext objects are no longer associated with a track but with the disc.
2) - cdio_get_cdtext no longer takes track as an argument
- cdtext_get, cdtext_get_const, cdtext_set require track argument
3) Language, Genre, Genre Code and Encoding Fields are now properly parsed and stored in the cdtext object
4) Added public function cdio_get_cdtext_raw to extract the binary CD-Text
5) Added CDTEXTFILE keyword logic in cue sheet parser. Parses binary/raw CD-Text files
6) Added cdtext_genre2str to convert genre code
7) altered the example programs, test drivers, cdda-player and cd-info to work with these changes
8) Added test case
9) A few smaller changes
A disc either holds CD-Text for all the tracks or does not hold any. Therefore a CD-Text object for the whole disc seems more natural to me. It also enables us to store global fields, like genre, encoding, language.

Patch was tested on GNU/Linux 32 bit running Gentoo.
2011-11-24 20:54:40 -05:00

185 lines
4.1 KiB
C++

/*
$Id: disc.hpp,v 1.2 2008/03/25 15:59:10 karl Exp $
Copyright (C) 2005, 2008 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: string is malloc'd so caller has to free() the returned
string 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.
* */
cdtext_t *getCdtext ()
{
return cdio_get_cdtext (p_cdio);
}