[gst-cvs] gst-ffmpeg: demuxers: Blacklist push-mode for avformat demuxers which aren' t reliable in push-mode.

Edward Hervey bilboed at kemper.freedesktop.org
Mon Mar 9 05:47:56 PDT 2009


Module: gst-ffmpeg
Branch: master
Commit: f8e3a0007f0dd14135820e802c8e68d835a8a747
URL:    http://cgit.freedesktop.org/gstreamer/gst-ffmpeg/commit/?id=f8e3a0007f0dd14135820e802c8e68d835a8a747

Author: Edward Hervey <bilboed at bilboed.com>
Date:   Mon Mar  9 13:46:06 2009 +0100

demuxers: Blacklist push-mode for avformat demuxers which aren't reliable in push-mode.

Currently, only one is blacklisted : ffdemux_ape. This has been confirmed by
ffmpeg developers.

---

 ext/ffmpeg/gstffmpegdemux.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/ext/ffmpeg/gstffmpegdemux.c b/ext/ffmpeg/gstffmpegdemux.c
index 62943e1..cc99f0b 100644
--- a/ext/ffmpeg/gstffmpegdemux.c
+++ b/ext/ffmpeg/gstffmpegdemux.c
@@ -74,8 +74,12 @@ struct _GstFFMpegDemux
   GstClockTime start_time;
   GstClockTime duration;
 
+  /* TRUE if working in pull-mode */
   gboolean seekable;
 
+  /* TRUE if the avformat demuxer can reliably handle streaming mode */
+  gboolean can_push;
+
   gboolean flushing;
 
   /* segment stuff */
@@ -280,6 +284,12 @@ gst_ffmpegdemux_init (GstFFMpegDemux * demux)
   demux->ffpipe.tlock = g_mutex_new ();
   demux->ffpipe.cond = g_cond_new ();
   demux->ffpipe.adapter = gst_adapter_new ();
+
+  /* blacklist unreliable push-based demuxers */
+  if (strcmp (oclass->in_plugin->name, "ape"))
+    demux->can_push = TRUE;
+  else
+    demux->can_push = FALSE;
 }
 
 static void
@@ -1647,11 +1657,15 @@ static gboolean
 gst_ffmpegdemux_sink_activate_push (GstPad * sinkpad, gboolean active)
 {
   GstFFMpegDemux *demux;
-  gboolean res;
+  gboolean res = FALSE;
 
   demux = (GstFFMpegDemux *) (gst_pad_get_parent (sinkpad));
 
   if (active) {
+    if (demux->can_push == FALSE) {
+      GST_WARNING_OBJECT (demux, "Demuxer can't reliably operate in push-mode");
+      goto beach;
+    }
     demux->ffpipe.eos = FALSE;
     demux->ffpipe.srcresult = GST_FLOW_OK;
     demux->ffpipe.needed = 0;
@@ -1678,6 +1692,7 @@ gst_ffmpegdemux_sink_activate_push (GstPad * sinkpad, gboolean active)
     demux->seekable = FALSE;
   }
 
+beach:
   gst_object_unref (demux);
 
   return res;





More information about the Gstreamer-commits mailing list