libcdio-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libcdio-devel] cdtext reading


From: Ross Burton
Subject: [Libcdio-devel] cdtext reading
Date: Mon, 03 Oct 2005 19:06:52 +0100

Hi,

I'm adding CD-TEXT support to Sound Juicer and am seeing odd behaviour.
I'm probably not understanding the situation properly...

If I do this (album and text are my types):

cdio = cdio_open (NULL, DRIVER_UNKNOWN);
/* Get album data */
cdtext = cdio_get_cdtext(cdio, 0);
album->title = g_strdup (cdtext_get (CDTEXT_TITLE, cdtext));
album->artist = g_strdup (cdtext_get (CDTEXT_PERFORMER, cdtext));
/* Now iterate over the tracks */
cdtrack = cdio_get_first_track_num(cdio);
last_cdtrack = cdtrack + cdio_get_num_tracks(cdio);
for ( ; cdtrack < last_cdtrack; cdtrack++ ) {
  track->album = album;
  track->number = cdtrack;
  cdtext = cdio_get_cdtext(cdio, cdtrack);
  track->title = g_strdup (cdtext_get (CDTEXT_TITLE, cdtext));
  track->artist = g_strdup (cdtext_get (CDTEXT_PERFORMER, cdtext));
  album->tracks = g_list_append (album->tracks, track);
}

Then I end up missing the last track details: track 1 doesn't have
artist and title set, and the real data for track 1 is returned for
track 2.

However, if I do:

cdio = cdio_open (NULL, DRIVER_UNKNOWN);
/* Iterate over the tracks */
cdtrack = cdio_get_first_track_num(cdio);
last_cdtrack = cdtrack + cdio_get_num_tracks(cdio);
for ( ; cdtrack < last_cdtrack; cdtrack++ ) {
  track->album = album;
  track->number = cdtrack;
  cdtext = cdio_get_cdtext(cdio, cdtrack);
  track->title = g_strdup (cdtext_get (CDTEXT_TITLE, cdtext));
  track->artist = g_strdup (cdtext_get (CDTEXT_PERFORMER, cdtext));
  album->tracks = g_list_append (album->tracks, track);
}
/* Now fill in the album data */
cdtext = cdio_get_cdtext(cdio, 0);
album->title = g_strdup (cdtext_get (CDTEXT_TITLE, cdtext));
album->artist = g_strdup (cdtext_get (CDTEXT_PERFORMER, cdtext));

Then the data is correct.  Am I doing something wrong here?  The flow of
the first code sample is more logical and fits into the error handling
far easier, so I'd prefer to use it.

Despite this problem I'm very pleased with how easy it is to get CD-TEXT
data with libcdio, many thanks!

Cheers,
Ross
-- 
Ross Burton                                 mail: address@hidden
                                          jabber: address@hidden
                                     www: http://www.burtonini.com./
 PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF







reply via email to

[Prev in Thread] Current Thread [Next in Thread]