ext/cdio/: Also extract album title and album genre from CD-TEXT if available (#537021).

Original commit message from CVS:
Patch by: Benjamin Kampmann  <benjamin at fluendo dot com>
* ext/cdio/gstcdio.c: (gst_cdio_get_cdtext),
(gst_cdio_add_cdtext_album_tags):
* ext/cdio/gstcdio.h:
* ext/cdio/gstcdiocddasrc.c: (gst_cdio_cdda_src_open):
Also extract album title and album genre from CD-TEXT if
available (#537021).
This commit is contained in:
Benjamin Kampmann 2008-06-09 20:02:05 +00:00 committed by Tim-Philipp Müller
parent 9838809d93
commit c0da559715
3 changed files with 25 additions and 0 deletions

View file

@ -74,6 +74,24 @@ gst_cdio_get_cdtext (GstObject * src, CdIo * cdio, track_t track)
return tags; return tags;
} }
void
gst_cdio_add_cdtext_album_tags (GstObject * src, CdIo * cdio, GstTagList * tags)
{
cdtext_t *t;
t = cdio_get_cdtext (cdio, 0);
if (t == NULL) {
GST_DEBUG_OBJECT (src, "no CD-TEXT for album %u");
return;
}
/* FIXME: map CDTEXT_PERFORMER to GST_TAG_ALBUM_ARTIST once we have that */
gst_cdio_add_cdtext_field (src, t, CDTEXT_TITLE, GST_TAG_ALBUM, &tags);
gst_cdio_add_cdtext_field (src, t, CDTEXT_GENRE, GST_TAG_GENRE, &tags);
GST_DEBUG ("CD-TEXT album tags: %" GST_PTR_FORMAT, tags);
}
static void static void
gst_cdio_log_handler (cdio_log_level_t level, const char *msg) gst_cdio_log_handler (cdio_log_level_t level, const char *msg)
{ {

View file

@ -38,5 +38,9 @@ GstTagList * gst_cdio_get_cdtext (GstObject * src,
CdIo * cdio, CdIo * cdio,
track_t track); track_t track);
void gst_cdio_add_cdtext_album_tags (GstObject * src,
CdIo * cdio,
GstTagList * tags);
#endif /* __GST_CDIO_H__ */ #endif /* __GST_CDIO_H__ */

View file

@ -248,6 +248,9 @@ gst_cdio_cdda_src_open (GstCddaBaseSrc * cddabasesrc, const gchar * device)
if (src->read_speed != -1) if (src->read_speed != -1)
cdio_set_speed (src->cdio, src->read_speed); cdio_set_speed (src->cdio, src->read_speed);
gst_cdio_add_cdtext_album_tags (GST_OBJECT_CAST (src), src->cdio,
cddabasesrc->tags);
GST_LOG_OBJECT (src, "%u tracks, first track: %d", num_tracks, first_track); GST_LOG_OBJECT (src, "%u tracks, first track: %d", num_tracks, first_track);
for (i = 0; i < num_tracks; ++i) { for (i = 0; i < num_tracks; ++i) {