New typefind system: bytestream is now part of the core all plugins have been modifie...
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>
Wed, 1 Oct 2003 13:14:43 +0000 (13:14 +0000)
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>
Wed, 1 Oct 2003 13:14:43 +0000 (13:14 +0000)
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

common
ext/ffmpeg/gstffmpeg.c
ext/ffmpeg/gstffmpegdemux.c
ext/ffmpeg/gstffmpegprotocol.c

diff --git a/common b/common
index b4a839c..b7abb51 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit b4a839c99c0bf2d4903824426ef3cc0d4b0ad992
+Subproject commit b7abb510aa14e8692df39ea8c2c758e37d8a8d8a
index 3828fa1..1a25bf4 100644 (file)
@@ -46,9 +46,6 @@ plugin_init (GModule *module, GstPlugin *plugin)
   avcodec_register_all ();
   av_register_all ();
 
-  if (!gst_library_load ("gstbytestream"))
-    return FALSE;
-
   gst_ffmpegenc_register (plugin);
   gst_ffmpegdec_register (plugin);
   /*gst_ffmpegdemux_register (plugin);*/
index 142ce54..6815695 100644 (file)
@@ -161,24 +161,27 @@ gst_ffmpegdemux_dispose (GObject *object)
 }
 
 static GstCaps*
-gst_ffmpegdemux_typefind (GstBuffer *buffer,
-                         gpointer   priv)
+gst_ffmpegdemux_typefind (GstByteStream *bs,
+                         gpointer       priv)
 {
   GstFFMpegDemuxClassParams *params;
   AVInputFormat *in_plugin;
   gint res = 0;
   gint required = AVPROBE_SCORE_MAX * 0.8; /* 80% certainty enough? */
+  gint size_required = 4096;
+  GstBuffer *buf = NULL;
   
   params = g_hash_table_lookup (typefind, priv);
 
   in_plugin = params->in_plugin;
 
-  if (in_plugin->read_probe) {
+  if (in_plugin->read_probe &&
+      gst_bytestream_peek (bs, &buf, size_required) == size_required) {
     AVProbeData probe_data;
 
     probe_data.filename = "";
-    probe_data.buf = GST_BUFFER_DATA (buffer);
-    probe_data.buf_size = GST_BUFFER_SIZE (buffer);
+    probe_data.buf = GST_BUFFER_DATA (buf);
+    probe_data.buf_size = GST_BUFFER_SIZE (buf);
 
     res = in_plugin->read_probe (&probe_data);
     if (res >= required) {
@@ -186,10 +189,15 @@ gst_ffmpegdemux_typefind (GstBuffer *buffer,
       caps = GST_PAD_TEMPLATE_CAPS (params->sinktempl);
       /* make sure we still hold a refcount to this caps */
       gst_caps_ref (caps);
+      gst_buffer_unref (buf);
       return caps;
     }
   }
-       
+
+  if (buf != NULL) {
+    gst_buffer_unref (buf);
+  }
+
   return NULL;
 }
 
index c823373..5373eb9 100644 (file)
@@ -27,7 +27,7 @@
 #endif
 
 #include <gst/gst.h>
-#include <gst/bytestream/bytestream.h>
+#include <gst/gstbytestream.h>
 
 
 typedef struct _GstProtocolInfo GstProtocolInfo;