appsink: implement SEEKING query
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Sat, 25 Feb 2012 15:21:30 +0000 (15:21 +0000)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Sat, 25 Feb 2012 15:21:30 +0000 (15:21 +0000)
We don't support seeking (in the sense that upstream can
make us jump back and forth to certain offsets in the
output).

gst-libs/gst/app/gstappsink.c

index 9a891b6..871d6f0 100644 (file)
@@ -158,6 +158,7 @@ static gboolean gst_app_sink_unlock_stop (GstBaseSink * bsink);
 static gboolean gst_app_sink_start (GstBaseSink * psink);
 static gboolean gst_app_sink_stop (GstBaseSink * psink);
 static gboolean gst_app_sink_event (GstBaseSink * sink, GstEvent * event);
+static gboolean gst_app_sink_query (GstBaseSink * bsink, GstQuery * query);
 static GstFlowReturn gst_app_sink_preroll (GstBaseSink * psink,
     GstBuffer * buffer);
 static GstFlowReturn gst_app_sink_render_common (GstBaseSink * psink,
@@ -436,6 +437,7 @@ gst_app_sink_class_init (GstAppSinkClass * klass)
   basesink_class->render = gst_app_sink_render;
   basesink_class->render_list = gst_app_sink_render_list;
   basesink_class->get_caps = gst_app_sink_getcaps;
+  basesink_class->query = gst_app_sink_query;
 
   klass->pull_preroll = gst_app_sink_pull_preroll;
   klass->pull_buffer = gst_app_sink_pull_buffer;
@@ -875,6 +877,30 @@ gst_app_sink_getcaps (GstBaseSink * psink)
   return caps;
 }
 
+static gboolean
+gst_app_sink_query (GstBaseSink * bsink, GstQuery * query)
+{
+  gboolean ret;
+
+  switch (GST_QUERY_TYPE (query)) {
+    case GST_QUERY_SEEKING:{
+      GstFormat fmt;
+
+      /* we don't supporting seeking */
+      gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL);
+      gst_query_set_seeking (query, fmt, FALSE, 0, -1);
+      ret = TRUE;
+      break;
+    }
+
+    default:
+      ret = GST_BASE_SINK_CLASS (parent_class)->query (bsink, query);
+      break;
+  }
+
+  return ret;
+}
+
 static GstMiniObject *
 gst_app_sink_pull_object (GstAppSink * appsink)
 {