diff options
author | R. Bernstein <rocky@gnu.org> | 2011-11-24 20:54:40 -0500 |
---|---|---|
committer | R. Bernstein <rocky@gnu.org> | 2011-11-24 20:54:40 -0500 |
commit | dbf6d247650e3cae4030f53e5f79fc5d5f094d3f (patch) | |
tree | 411e7586e0cc7c28672724480ea80d9336b47961 /example | |
parent | e0b2ee826da69cfabf809bcb94f3bc019276ae62 (diff) |
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.
Diffstat (limited to 'example')
-rw-r--r-- | example/cdtext.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/example/cdtext.c b/example/cdtext.c index 1d50f89d..7e99ad0b 100644 --- a/example/cdtext.c +++ b/example/cdtext.c @@ -31,34 +31,39 @@ static void -print_cdtext_track_info(CdIo_t *p_cdio, track_t i_track, const char *psz_msg) { - const cdtext_t *cdtext = cdio_get_cdtext(p_cdio, i_track); - if (NULL != cdtext) { - cdtext_field_t i; - - printf("%s\n", psz_msg); - - for (i=0; i < MAX_CDTEXT_FIELDS; i++) { - if (cdtext->field[i]) { - printf("\t%s: %s\n", cdtext_field2str(i), cdtext->field[i]); - } +print_cdtext_track_info(cdtext_t *cdtext, track_t i_track, const char *psz_msg) { + cdtext_field_t i; + + printf("%s\n", psz_msg); + + for (i=0; i < MAX_CDTEXT_FIELDS; i++) { + if (cdtext_get_const(i, i_track, cdtext)) { + printf("\t%s: %s\n", cdtext_field2str(i), cdtext_get_const(i, i_track, cdtext)); } } - + } static void print_disc_info(CdIo_t *p_cdio, track_t i_tracks, track_t i_first_track) { track_t i_last_track = i_first_track+i_tracks; discmode_t cd_discmode = cdio_get_discmode(p_cdio); + cdtext_t *cdtext = cdio_get_cdtext(p_cdio); printf("%s\n", discmode2str[cd_discmode]); - - print_cdtext_track_info(p_cdio, 0, "\nCD-Text for Disc:"); + + if (NULL == cdtext) + { + printf("\nNo CD-Text found on Disc."); + return; + } + + printf("Encoding: %s; Language: %s\n", cdtext->encoding, cdtext->language); + print_cdtext_track_info(cdtext, 0, "\nCD-Text for Disc:"); for ( ; i_first_track < i_last_track; i_first_track++ ) { char psz_msg[50]; snprintf(psz_msg, sizeof(psz_msg), "CD-Text for Track %d:", i_first_track); - print_cdtext_track_info(p_cdio, i_first_track, psz_msg); + print_cdtext_track_info(cdtext, i_first_track, psz_msg); } } |