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.
This commit is contained in:
Tim-Philipp Müller 2006-11-02 14:43:11 +00:00
parent a7377ff9a3
commit 2a3809fcc5
4 changed files with 36 additions and 37 deletions

2
common

@ -1 +1 @@
Subproject commit efcacf2625da231fbee99b68e0f5db6816cf6fad
Subproject commit ee0bb43e2b66781d04078e2210404da48f6c68f0

View file

@ -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

View file

@ -22,7 +22,7 @@
#define __GST_CDIO_H__
#include <gst/gst.h>
#include <cdio/version.h>
#include <cdio/cdio.h>
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__ */

View file

@ -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);
}