])
fi
+ dnl check with pkg-config first
+ AG_GST_PKG_CHECK_MODULES(MAD, mad >= 0.15)
+ MAD_LIBS="$MAD_LIBS $ID3TAG_LIBS"
+ if test "x$HAVE_MAD" = "xno"; then
+ dnl fall back to oldskool detection
+ AC_CHECK_HEADER(mad.h, [
+ AC_CHECK_LIB(mad, mad_decoder_finish,
+ HAVE_MAD="yes" MAD_LIBS="-lmad $ID3TAG_LIBS")
+ ])
+ fi
+
if test "x$HAVE_ID3TAG" = "xyes"; then
- dnl check with pkg-config first
- AG_GST_PKG_CHECK_MODULES(MAD, mad >= 0.15)
- MAD_LIBS="$MAD_LIBS $ID3TAG_LIBS"
- if test "x$HAVE_MAD" = "xno"; then
- dnl fall back to oldskool detection
- AC_CHECK_HEADER(mad.h, [
- AC_CHECK_LIB(mad, mad_decoder_finish,
- HAVE_MAD="yes" MAD_LIBS="-lmad $ID3TAG_LIBS")
- ])
- fi
+ AC_DEFINE(HAVE_ID3TAG, 1, [defined if libid3tag is available])
else
- HAVE_MAD="no"
- AC_MSG_WARN([libid3tag not available, cannot build MAD MP3 decoder plugin])
+ AC_MSG_WARN([libid3tag not available, MAD MP3 decoder will be built without
+ ID3 tag reading support (which is not a problem, since ID3
+ tags are usually handled by id3demux)])
fi
])
AC_SUBST(MAD_LIBS)
#include "gstmad.h"
#include <gst/audio/audio.h>
+#ifdef HAVE_ID3TAG
+#include <id3tag.h>
+#endif
+
enum
{
ARG_0,
static void gst_mad_set_index (GstElement * element, GstIndex * index);
static GstIndex *gst_mad_get_index (GstElement * element);
+#ifdef HAVE_ID3TAG
static GstTagList *gst_mad_id3_to_tag_list (const struct id3_tag *tag);
+#endif
GST_BOILERPLATE (GstMad, gst_mad, GstElement, GST_TYPE_ELEMENT);
goto end;
} else if (mad->stream.error == MAD_ERROR_LOSTSYNC) {
/* lost sync, force a resync */
- signed long tagsize;
-
GST_INFO ("recoverable lost sync error");
- tagsize = id3_tag_query (mad->stream.this_frame,
- mad->stream.bufend - mad->stream.this_frame);
-
- if (tagsize > mad->tempsize) {
- GST_INFO ("mad: got partial id3 tag in buffer, skipping");
- } else if (tagsize > 0) {
- struct id3_tag *tag;
- id3_byte_t const *data;
-
- GST_INFO ("mad: got ID3 tag size %ld", tagsize);
-
- data = mad->stream.this_frame;
-
- /* mad has moved the pointer to the next frame over the start of the
- * id3 tags, so we need to flush one byte less than the tagsize */
- mad_stream_skip (&mad->stream, tagsize - 1);
-
- tag = id3_tag_parse (data, tagsize);
- if (tag) {
- GstTagList *list;
-
- list = gst_mad_id3_to_tag_list (tag);
- id3_tag_delete (tag);
- GST_DEBUG ("found tag");
- gst_element_post_message (GST_ELEMENT (mad),
- gst_message_new_tag (GST_OBJECT (mad),
- gst_tag_list_copy (list)));
- if (mad->tags) {
- gst_tag_list_insert (mad->tags, list, GST_TAG_MERGE_PREPEND);
- } else {
- mad->tags = gst_tag_list_copy (list);
+#ifdef HAVE_ID3TAG
+ {
+ signed long tagsize;
+
+ tagsize = id3_tag_query (mad->stream.this_frame,
+ mad->stream.bufend - mad->stream.this_frame);
+
+ if (tagsize > mad->tempsize) {
+ GST_INFO ("mad: got partial id3 tag in buffer, skipping");
+ } else if (tagsize > 0) {
+ struct id3_tag *tag;
+ id3_byte_t const *data;
+
+ GST_INFO ("mad: got ID3 tag size %ld", tagsize);
+
+ data = mad->stream.this_frame;
+
+ /* mad has moved the pointer to the next frame over the start of the
+ * id3 tags, so we need to flush one byte less than the tagsize */
+ mad_stream_skip (&mad->stream, tagsize - 1);
+
+ tag = id3_tag_parse (data, tagsize);
+ if (tag) {
+ GstTagList *list;
+
+ list = gst_mad_id3_to_tag_list (tag);
+ id3_tag_delete (tag);
+ GST_DEBUG ("found tag");
+ gst_element_post_message (GST_ELEMENT (mad),
+ gst_message_new_tag (GST_OBJECT (mad),
+ gst_tag_list_copy (list)));
+ if (mad->tags) {
+ gst_tag_list_insert (mad->tags, list, GST_TAG_MERGE_PREPEND);
+ } else {
+ mad->tags = gst_tag_list_copy (list);
+ }
+ if (mad->need_newsegment)
+ mad->pending_events =
+ g_list_append (mad->pending_events,
+ gst_event_new_tag (list));
+ else
+ gst_pad_push_event (mad->srcpad, gst_event_new_tag (list));
}
- if (mad->need_newsegment)
- mad->pending_events =
- g_list_append (mad->pending_events,
- gst_event_new_tag (list));
- else
- gst_pad_push_event (mad->srcpad, gst_event_new_tag (list));
}
}
+#endif /* HAVE_ID3TAG */
}
mad_frame_mute (&mad->frame);
return ret;
}
+#ifdef HAVE_ID3TAG
/* id3 tag helper (FIXME: why does mad parse id3 tags at all? It shouldn't) */
static GstTagList *
gst_mad_id3_to_tag_list (const struct id3_tag *tag)
return tag_list;
}
+#endif /* HAVE_ID3TAG */
/* plugin initialisation */