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

@@ -108,8 +108,6 @@ _init_cdrdao (_img_private_t *env)
env->psz_mcn = NULL;
env->disc_mode = CDIO_DISC_MODE_NO_INFO;
cdtext_init (&(env->gen.cdtext));
/* Read in TOC sheet. */
if ( !parse_tocfile(env, env->psz_cue_name) ) return false;
@@ -292,7 +290,6 @@ parse_tocfile (_img_private_t *cd, const char *psz_cue_name)
}
if (cd) {
cd->gen.b_cdtext_init = true;
cd->gen.b_cdtext_error = false;
}
@@ -375,7 +372,6 @@ parse_tocfile (_img_private_t *cd, const char *psz_cue_name)
/* TRACK <track-mode> [<sub-channel-mode>] */
} else if (0 == strcmp ("TRACK", psz_keyword)) {
i++;
if (NULL != cd) cdtext_init (&(cd->gen.cdtext_track[i]));
if (NULL != (psz_field = strtok (NULL, " \t\n\r"))) {
if (0 == strcmp ("AUDIO", psz_field)) {
if (NULL != cd) {
@@ -911,19 +907,16 @@ parse_tocfile (_img_private_t *cd, const char *psz_cue_name)
if (i_cdtext_nest > 0) i_cdtext_nest--;
} else if ( CDTEXT_INVALID !=
(cdtext_key = cdtext_is_keyword (psz_keyword)) ) {
if (-1 == i) {
if (NULL != cd) {
cdtext_set (cdtext_key,
strtok (NULL, "\"\t\n\r"),
&(cd->gen.cdtext));
}
} else {
if (NULL != cd) {
cdtext_set (cdtext_key,
strtok (NULL, "\"\t\n\r"),
&(cd->gen.cdtext_track[i]));
}
}
if (NULL != cd) {
if (NULL == cd->gen.cdtext) {
cd->gen.cdtext = malloc(sizeof(cdtext_t));
cdtext_init (cd->gen.cdtext);
}
cdtext_set (cdtext_key,
(-1 == i ? 0 : cd->gen.i_first_track + i + 1),
strtok (NULL, "\"\t\n\r"),
cd->gen.cdtext);
}
/* unrecognized line */
} else {
@@ -1261,7 +1254,8 @@ cdio_open_cdrdao (const char *psz_cue_name)
_funcs.eject_media = _eject_media_image;
_funcs.free = _free_image;
_funcs.get_arg = _get_arg_image;
_funcs.get_cdtext = get_cdtext_generic;
_funcs.get_cdtext = _get_cdtext_image;
_funcs.get_cdtext_raw = NULL;
_funcs.get_devices = cdio_get_devices_cdrdao;
_funcs.get_default_device = cdio_get_default_device_cdrdao;
_funcs.get_disc_last_lsn = get_disc_last_lsn_cdrdao;