diff options
Diffstat (limited to 'gst/modplug/gstmodplug.cc')
-rw-r--r-- | gst/modplug/gstmodplug.cc | 56 |
1 files changed, 32 insertions, 24 deletions
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[] = { |