mad: build the mad plugin even if libid3tag is not available

ID3 tags are usually handled by id3demux, and should be handled
by id3demux. Tag handling in mad based on libid3tag is very basic
and mostly unnecessary really, so just build this plugin without
ID3 tag support if libid3tag is not available.
This commit is contained in:
Tim-Philipp Müller 2011-03-11 17:45:37 +00:00
parent 253afc02c9
commit 65565c8a1e
3 changed files with 60 additions and 46 deletions

View file

@ -326,7 +326,6 @@ AG_GST_CHECK_FEATURE(MAD, [mad mp3 decoder], mad, [
])
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"
@ -337,9 +336,13 @@ AG_GST_CHECK_FEATURE(MAD, [mad mp3 decoder], mad, [
HAVE_MAD="yes" MAD_LIBS="-lmad $ID3TAG_LIBS")
])
fi
if test "x$HAVE_ID3TAG" = "xyes"; then
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)

View file

@ -40,6 +40,10 @@
#include "gstmad.h"
#include <gst/audio/audio.h>
#ifdef HAVE_ID3TAG
#include <id3tag.h>
#endif
enum
{
ARG_0,
@ -103,7 +107,9 @@ static GstStateChangeReturn gst_mad_change_state (GstElement * element,
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);
@ -1514,10 +1520,12 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer)
goto end;
} else if (mad->stream.error == MAD_ERROR_LOSTSYNC) {
/* lost sync, force a resync */
signed long tagsize;
GST_INFO ("recoverable lost sync error");
#ifdef HAVE_ID3TAG
{
signed long tagsize;
tagsize = id3_tag_query (mad->stream.this_frame,
mad->stream.bufend - mad->stream.this_frame);
@ -1559,6 +1567,8 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer)
}
}
}
#endif /* HAVE_ID3TAG */
}
mad_frame_mute (&mad->frame);
mad_synth_mute (&mad->synth);
@ -1902,6 +1912,7 @@ gst_mad_change_state (GstElement * element, GstStateChange transition)
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)
@ -2075,6 +2086,7 @@ gst_mad_id3_to_tag_list (const struct id3_tag *tag)
return tag_list;
}
#endif /* HAVE_ID3TAG */
/* plugin initialisation */

View file

@ -24,7 +24,6 @@
#include <gst/gst.h>
#include <gst/tag/tag.h>
#include <mad.h>
#include <id3tag.h>
G_BEGIN_DECLS