From c0da5597153988b62099b78503f0529e554e76e7 Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Mon, 9 Jun 2008 20:02:05 +0000 Subject: [PATCH] ext/cdio/: Also extract album title and album genre from CD-TEXT if available (#537021). Original commit message from CVS: Patch by: Benjamin Kampmann * 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). --- ext/cdio/gstcdio.c | 18 ++++++++++++++++++ ext/cdio/gstcdio.h | 4 ++++ ext/cdio/gstcdiocddasrc.c | 3 +++ 3 files changed, 25 insertions(+) diff --git a/ext/cdio/gstcdio.c b/ext/cdio/gstcdio.c index 1534bda322..a18d350f00 100644 --- a/ext/cdio/gstcdio.c +++ b/ext/cdio/gstcdio.c @@ -74,6 +74,24 @@ gst_cdio_get_cdtext (GstObject * src, CdIo * cdio, track_t track) 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 gst_cdio_log_handler (cdio_log_level_t level, const char *msg) { diff --git a/ext/cdio/gstcdio.h b/ext/cdio/gstcdio.h index cbef7d9324..ef31ed0f80 100644 --- a/ext/cdio/gstcdio.h +++ b/ext/cdio/gstcdio.h @@ -38,5 +38,9 @@ GstTagList * gst_cdio_get_cdtext (GstObject * src, CdIo * cdio, track_t track); +void gst_cdio_add_cdtext_album_tags (GstObject * src, + CdIo * cdio, + GstTagList * tags); + #endif /* __GST_CDIO_H__ */ diff --git a/ext/cdio/gstcdiocddasrc.c b/ext/cdio/gstcdiocddasrc.c index d85e792da1..d4a6a54d05 100644 --- a/ext/cdio/gstcdiocddasrc.c +++ b/ext/cdio/gstcdiocddasrc.c @@ -248,6 +248,9 @@ gst_cdio_cdda_src_open (GstCddaBaseSrc * cddabasesrc, const gchar * device) if (src->read_speed != -1) 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); for (i = 0; i < num_tracks; ++i) {