From d9e4457faa360b470a5ae418e3444fccd6c0a5de Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Wed, 1 Oct 2003 13:14:50 +0000 Subject: New typefind system: bytestream is now part of the core all plugins have been modified to use this new typefind syste... Original commit message from CVS: New typefind system: * bytestream is now part of the core * all plugins have been modified to use this new typefind system * asf typefinding added * mpeg video stream typefiding removed because it's broken * duplicate typefind entries removed * extra id3 typefinding added, because we've seen 4 types of files (riff/wav, flac, vorbis, mp3) with id3 headers and each of these needs to work. Instead, I've added an id3 element and let it redo typefiding after the id3 header. this needs a hack because spider only typefinds once. We can remove this hack once spider supports multiple typefinds. * with all this, mp3 typefinding is semi-rewritten * id3 typefinding in flac/vorbis is removed, it's no longer needed * fixed spider and gst-typefind to use this, too. * Other general cleanups --- gst/modplug/gstmodplug.cc | 56 +++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 24 deletions(-) (limited to 'gst/modplug/gstmodplug.cc') diff --git a/gst/modplug/gstmodplug.cc b/gst/modplug/gstmodplug.cc index 2fa602f7..07a09a1c 100644 --- a/gst/modplug/gstmodplug.cc +++ b/gst/modplug/gstmodplug.cc @@ -130,31 +130,39 @@ static GstElementStateReturn static GstElementClass *parent_class = NULL; static GstCaps* -modplug_type_find (GstBuffer *buf, gpointer priv) -{ - if (GST_BUFFER_SIZE (buf) < 75) - return NULL; - - if (MOD_CheckType (buf) || - Mod_669_CheckType (buf) || - Amf_CheckType (buf) || - Dsm_CheckType (buf) || - Fam_CheckType (buf) || - Gdm_CheckType (buf) || - Imf_CheckType (buf) || - It_CheckType (buf) || - M15_CheckType (buf) || - /*Med_CheckType (buf) || <- FIXME */ - Mtm_CheckType (buf) || - Okt_CheckType (buf) || - S3m_CheckType (buf) || - Xm_CheckType (buf)) { - return gst_caps_new ("modplug_type_find", - "audio/x-mod", - NULL); +modplug_type_find (GstByteStream *bs, gpointer priv) +{ + GstBuffer *buf = NULL; + GstCaps *newc = NULL; + + if (gst_bytestream_peek (bs, &buf, 75) == 75) { + if (MOD_CheckType (buf) || + Mod_669_CheckType (buf) || + Amf_CheckType (buf) || + Dsm_CheckType (buf) || + Fam_CheckType (buf) || + Gdm_CheckType (buf) || + Imf_CheckType (buf) || + It_CheckType (buf) || + M15_CheckType (buf) || +#if 0 + Med_CheckType (buf) || /* FIXME */ +#endif + Mtm_CheckType (buf) || + Okt_CheckType (buf) || + S3m_CheckType (buf) || + Xm_CheckType (buf)) { + newc = GST_CAPS_NEW ("modplug_type_find", + "audio/x-mod", + NULL); + } } - - return NULL; + + if (buf != NULL) { + gst_buffer_unref (buf); + } + + return newc; } static GstTypeDefinition modplug_definitions[] = { -- cgit v1.2.1