From 2a3809fcc5fa1b3d1371611276bf24195cf32017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 2 Nov 2006 14:43:11 +0000 Subject: [PATCH] ext/cdio/: Move CD-TEXT utility function into common file so it can also be used by a future cdioparanoiasrc. Original commit message from CVS: * ext/cdio/gstcdio.c: (gst_cdio_get_cdtext): * ext/cdio/gstcdio.h: * ext/cdio/gstcdiocddasrc.c: (gst_cdio_cdda_src_open): Move CD-TEXT utility function into common file so it can also be used by a future cdioparanoiasrc. --- common | 2 +- ext/cdio/gstcdio.c | 28 ++++++++++++++++++++++++++++ ext/cdio/gstcdio.h | 6 +++++- ext/cdio/gstcdiocddasrc.c | 37 ++----------------------------------- 4 files changed, 36 insertions(+), 37 deletions(-) diff --git a/common b/common index efcacf2625..ee0bb43e2b 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit efcacf2625da231fbee99b68e0f5db6816cf6fad +Subproject commit ee0bb43e2b66781d04078e2210404da48f6c68f0 diff --git a/ext/cdio/gstcdio.c b/ext/cdio/gstcdio.c index f77792d7be..5c23a77bb2 100644 --- a/ext/cdio/gstcdio.c +++ b/ext/cdio/gstcdio.c @@ -58,6 +58,34 @@ gst_cdio_add_cdtext_field (GstObject * src, cdtext_t * cdtext, GST_DEBUG_OBJECT (src, "CD-TEXT: %s = %s", gst_tag, txt); } +GstTagList * +gst_cdio_get_cdtext (GstObject * src, CdIo * cdio, track_t track) +{ + GstTagList *tags = NULL; + cdtext_t *t; + + t = cdio_get_cdtext (cdio, track); + if (t == NULL) { + GST_DEBUG_OBJECT (src, "no CD-TEXT for track %u", track); + return NULL; + } + + gst_cdio_add_cdtext_field (src, t, CDTEXT_PERFORMER, GST_TAG_ARTIST, &tags); + gst_cdio_add_cdtext_field (src, t, CDTEXT_TITLE, GST_TAG_TITLE, &tags); + + return tags; +} + +#else + +GstTagList * +gst_cdio_get_cdtext (GstObject * src, CdIo * cdio, track_t track) +{ + GST_DEBUG_OBJECT (src, "This libcdio version (%u) does not support " + "CDTEXT (want >= 76)", LIBCDIO_VERSION_NUM); + return NULL; +} + #endif static void diff --git a/ext/cdio/gstcdio.h b/ext/cdio/gstcdio.h index ffe3a195ec..605ad10fd2 100644 --- a/ext/cdio/gstcdio.h +++ b/ext/cdio/gstcdio.h @@ -22,7 +22,7 @@ #define __GST_CDIO_H__ #include -#include +#include GST_DEBUG_CATEGORY_EXTERN (gst_cdio_debug); #define GST_CAT_DEFAULT gst_cdio_debug @@ -39,5 +39,9 @@ void gst_cdio_add_cdtext_field (GstObject * src, #endif +GstTagList * gst_cdio_get_cdtext (GstObject * src, + CdIo * cdio, + track_t track); + #endif /* __GST_CDIO_H__ */ diff --git a/ext/cdio/gstcdiocddasrc.c b/ext/cdio/gstcdiocddasrc.c index c2269983c3..2bfa170070 100644 --- a/ext/cdio/gstcdiocddasrc.c +++ b/ext/cdio/gstcdiocddasrc.c @@ -209,40 +209,6 @@ notcdio_track_is_audio_track (const CdIo * p_cdio, track_t i_track) return (cdio_get_track_format (p_cdio, i_track) == TRACK_FORMAT_AUDIO); } -#if (LIBCDIO_VERSION_NUM >= 76) - -static GstTagList * -gst_cdio_cdda_src_get_cdtext (GstCdioCddaSrc * src, track_t i_track) -{ - GstTagList *tags = NULL; - GstObject *obj; - cdtext_t *t; - - t = cdio_get_cdtext (src->cdio, i_track); - if (t == NULL) { - GST_DEBUG_OBJECT (src, "no CD-TEXT for track %u", i_track); - return NULL; - } - - obj = GST_OBJECT (src); - gst_cdio_add_cdtext_field (obj, t, CDTEXT_PERFORMER, GST_TAG_ARTIST, &tags); - gst_cdio_add_cdtext_field (obj, t, CDTEXT_TITLE, GST_TAG_TITLE, &tags); - - return tags; -} - -#else - -static GstTagList * -gst_cdio_cdda_src_get_cdtext (GstCdioCddaSrc * src, track_t i_track) -{ - GST_DEBUG_OBJECT (src, "This libcdio version (%u) does not support " - "CDTEXT (want >= 76)", LIBCDIO_VERSION_NUM); - return NULL; -} - -#endif - static gboolean gst_cdio_cdda_src_open (GstCddaBaseSrc * cddabasesrc, const gchar * device) { @@ -305,7 +271,8 @@ gst_cdio_cdda_src_open (GstCddaBaseSrc * cddabasesrc, const gchar * device) * the right thing here (for cddb id calculations etc. as well) */ track.start = cdio_get_track_lsn (src->cdio, i + first_track); track.end = track.start + len_sectors - 1; /* -1? */ - track.tags = gst_cdio_cdda_src_get_cdtext (src, i + first_track); + track.tags = gst_cdio_get_cdtext (GST_OBJECT (src), src->cdio, + i + first_track); gst_cdda_base_src_add_track (GST_CDDA_BASE_SRC (src), &track); }