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.
This commit is contained in:
R. Bernstein
2011-11-24 20:54:40 -05:00
parent e0b2ee826d
commit dbf6d24765
43 changed files with 639 additions and 417 deletions

View File

@@ -37,6 +37,9 @@ extern "C" {
#define MAX_CDTEXT_FIELDS 13
#define MIN_CDTEXT_FIELD 0
#define MAX_CDTEXT_DATA_LENGTH 5000
#define MAX_CDTEXT_GENRE_CODE 28
/*! \brief structure for holding CD-Text information
@@ -45,6 +48,15 @@ extern "C" {
struct cdtext {
char *field[MAX_CDTEXT_FIELDS];
};
typedef struct cdtext cdtext_track_t;
struct cdtext_s {
cdtext_track_t track[100]; /* cdtext for track 1..99. 0 represents cd-text of disc */
uint16_t genre_code; /* genre code */
uint8_t block;
char encoding[16]; /* encoding of character strings */
char language[3]; /* ISO 639-1 (2 letter) language code */
};
/*! \brief A list of all of the CD-Text fields. Because
the interval has no gaps, we can use ++ to iterate over fields.
@@ -68,12 +80,51 @@ extern "C" {
/*! Return string representation of the enum values above */
const char *cdtext_field2str (cdtext_field_t i);
/*! CD-Text genre codes */
typedef enum {
CDIO_CDTEXT_GENRE_UNUSED = 0, /**< not used */
CDIO_CDTEXT_GENRE_UNDEFINED = 1, /**< not defined */
CDIO_CDTEXT_GENRE_ADULT_CONTEMP = 2, /**< Adult Contemporary */
CDIO_CDTEXT_GENRE_ALT_ROCK = 3, /**< Alternative Rock */
CDIO_CDTEXT_GENRE_CHILDRENS = 4, /**< Childrens Music */
CDIO_CDTEXT_GENRE_CLASSIC = 5, /**< Classical */
CDIO_CDTEXT_GENRE_CHRIST_CONTEMP = 6, /**< Contemporary Christian */
CDIO_CDTEXT_GENRE_COUNTRY = 7, /**< Country */
CDIO_CDTEXT_GENRE_DANCE = 8, /**< Dance */
CDIO_CDTEXT_GENRE_EASY_LISTENING = 9, /**< Easy Listening */
CDIO_CDTEXT_GENRE_EROTIC = 10, /**< Erotic */
CDIO_CDTEXT_GENRE_FOLK = 11, /**< Folk */
CDIO_CDTEXT_GENRE_GOSPEL = 12, /**< Gospel */
CDIO_CDTEXT_GENRE_HIPHOP = 13, /**< Hip Hop */
CDIO_CDTEXT_GENRE_JAZZ = 14, /**< Jazz */
CDIO_CDTEXT_GENRE_LATIN = 15, /**< Latin */
CDIO_CDTEXT_GENRE_MUSICAL = 16, /**< Musical */
CDIO_CDTEXT_GENRE_NEWAGE = 17, /**< New Age */
CDIO_CDTEXT_GENRE_OPERA = 18, /**< Opera */
CDIO_CDTEXT_GENRE_OPERETTA = 19, /**< Operetta */
CDIO_CDTEXT_GENRE_POP = 20, /**< Pop Music */
CDIO_CDTEXT_GENRE_RAP = 21, /**< RAP */
CDIO_CDTEXT_GENRE_REGGAE = 22, /**< Reggae */
CDIO_CDTEXT_GENRE_ROCK = 23, /**< Rock Music */
CDIO_CDTEXT_GENRE_RYTHMANDBLUES = 24, /**< Rhythm & Blues */
CDIO_CDTEXT_GENRE_SOUNDEFFECTS = 25, /**< Sound Effects */
CDIO_CDTEXT_GENRE_SOUNDTRACK = 26, /**< Soundtrack */
CDIO_CDTEXT_GENRE_SPOKEN_WORD = 27, /**< Spoken Word */
CDIO_CDTEXT_GENRE_WORLD_MUSIC = 28 /**< World Music */
} cdtext_genre_t;
/*! Return string representation of the given genre code */
const char *cdtext_genre2str (cdtext_genre_t i);
/*! Initialize a new cdtext structure.
When the structure is no longer needed, release the
resources using cdtext_delete.
*/
void cdtext_init (cdtext_t *cdtext);
/*! Parse raw CD-Text data into cdtext structure */
bool cdtext_data_init(cdtext_t *cdtext, uint8_t *wdata);
/*! Free memory assocated with cdtext*/
void cdtext_destroy (cdtext_t *cdtext);
@@ -86,7 +137,8 @@ extern "C" {
@see cdio_get_const to retrieve a constant string that doesn't
have to be freed.
*/
char *cdtext_get (cdtext_field_t key, const cdtext_t *cdtext);
char *cdtext_get (cdtext_field_t key, track_t track, const cdtext_t *cdtext);
/*! returns a const string associated with the given field. NULL is
returned if key is CDTEXT_INVALID or the field is not set.
@@ -97,7 +149,7 @@ extern "C" {
@see cdio_get to retrieve an allocated string that persists past
the cdtext object.
*/
const char *cdtext_get_const (cdtext_field_t key, const cdtext_t *cdtext);
const char *cdtext_get_const (cdtext_field_t key, track_t track, const cdtext_t *cdtext);
/*!
returns enum of keyword if key is a CD-Text keyword,
@@ -108,7 +160,7 @@ extern "C" {
/*!
sets cdtext's keyword entry to field
*/
void cdtext_set (cdtext_field_t key, const char *value, cdtext_t *cdtext);
void cdtext_set (cdtext_field_t key, track_t track, const char *value, cdtext_t *cdtext);
#ifdef __cplusplus
}