[gst-cvs] gst-plugins-base: oggdemux: report -1 for duration in push mode

Wim Taymans wtay at kemper.freedesktop.org
Tue Mar 17 11:53:55 PDT 2009


Module: gst-plugins-base
Branch: master
Commit: 4e11b596cbf479e683bc8fd394769c7a5497fb5b
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=4e11b596cbf479e683bc8fd394769c7a5497fb5b

Author: Wim Taymans <wim.taymans at collabora.co.uk>
Date:   Tue Mar 17 19:53:44 2009 +0100

oggdemux: report -1 for duration in push mode

In push mode we must return TRUE from the duration query with a value of -1
meaning that we know that we don't know the duration.

---

 ext/ogg/gstoggdemux.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c
index 6d640b3..77b6fa1 100644
--- a/ext/ogg/gstoggdemux.c
+++ b/ext/ogg/gstoggdemux.c
@@ -275,15 +275,22 @@ gst_ogg_pad_src_query (GstPad * pad, GstQuery * query)
     case GST_QUERY_DURATION:
     {
       GstFormat format;
+      gint64 total_time;
 
       gst_query_parse_duration (query, &format, NULL);
       /* can only get position in time */
       if (format != GST_FORMAT_TIME)
         goto wrong_format;
 
-      /* can only return the total time position */
-      /* FIXME, return time for this specific stream */
-      gst_query_set_duration (query, GST_FORMAT_TIME, ogg->total_time);
+      if (ogg->seekable) {
+        /* we must return the total seekable length */
+        total_time = ogg->total_time;
+      } else {
+        /* in non-seek mode we can answer the query and we must return -1 */
+        total_time = -1;
+      }
+
+      gst_query_set_duration (query, GST_FORMAT_TIME, total_time);
       break;
     }
     case GST_QUERY_SEEKING:





More information about the Gstreamer-commits mailing list