summaryrefslogtreecommitdiffstats
path: root/gst/modplug/gstmodplug.cc
diff options
context:
space:
mode:
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>2003-10-01 13:14:50 +0000
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>2003-10-01 13:14:50 +0000
commitd9e4457faa360b470a5ae418e3444fccd6c0a5de (patch)
tree2a981bbe80d369449ad5d79e65ae7e766f1635ba /gst/modplug/gstmodplug.cc
parentb569848e286b7435997a67e17fa0b21db892131d (diff)
downloadgst-plugins-bad-d9e4457faa360b470a5ae418e3444fccd6c0a5de.tar.gz
gst-plugins-bad-d9e4457faa360b470a5ae418e3444fccd6c0a5de.tar.bz2
gst-plugins-bad-d9e4457faa360b470a5ae418e3444fccd6c0a5de.zip
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
Diffstat (limited to 'gst/modplug/gstmodplug.cc')
-rw-r--r--gst/modplug/gstmodplug.cc56
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[] = {