gst-plugins-good: qtmux: create streamable output if downstream is not seekable

Tim Müller tpm at kemper.freedesktop.org
Sat Feb 25 07:59:38 PST 2012


Module: gst-plugins-good
Branch: master
Commit: 676b371bdb2d80e9beee9c527b92c46214af4550
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=676b371bdb2d80e9beee9c527b92c46214af4550

Author: Tim-Philipp Müller <tim.muller at collabora.co.uk>
Date:   Sat Feb 25 15:55:15 2012 +0000

qtmux: create streamable output if downstream is not seekable

Ignore the "streamable" property setting and create streamable
output if downstream is known not to be seekable (as queried
via a SEEKABLE query).

Fixes pipelines like qtmux ! appsink possibly creating seemingly
corrupted output if streamable has not been set to true.

---

 gst/isomp4/gstqtmux.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/gst/isomp4/gstqtmux.c b/gst/isomp4/gstqtmux.c
index 2ce9840..80fa5af 100644
--- a/gst/isomp4/gstqtmux.c
+++ b/gst/isomp4/gstqtmux.c
@@ -1613,6 +1613,30 @@ gst_qt_mux_start_file (GstQTMux * qtmux)
   gst_pad_set_caps (qtmux->srcpad, caps);
   gst_caps_unref (caps);
 
+  /* if not streaming, check if downstream is seekable */
+  if (!qtmux->streamable) {
+    gboolean seekable;
+    GstQuery *query;
+
+    query = gst_query_new_seeking (GST_FORMAT_BYTES);
+    if (gst_pad_peer_query (qtmux->srcpad, query)) {
+      gst_query_parse_seeking (query, NULL, &seekable, NULL, NULL);
+      GST_INFO_OBJECT (qtmux, "downstream is %sseekable",
+          seekable ? "" : "not ");
+      if (!seekable) {
+        qtmux->streamable = TRUE;
+        g_object_notify (G_OBJECT (qtmux), "streamable");
+        GST_WARNING_OBJECT (qtmux, "downstream is not seekable, but "
+            "streamable=false. Will ignore that and create streamable output "
+            "instead");
+      }
+    } else {
+      /* have to assume seeking is supported if query not handled downstream */
+      /* FIXME 0.11: change to query not handled => seeking not supported */
+      GST_WARNING_OBJECT (qtmux, "downstream did not handle seeking query");
+    }
+  }
+
   /* let downstream know we think in BYTES and expect to do seeking later on */
   gst_pad_push_event (qtmux->srcpad,
       gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_BYTES, 0, -1, 0));



More information about the gstreamer-commits mailing list