[gst-cvs] gst-plugins-good: [MOVED FROM BAD 12/29] shapewipe: Proxy queries on the video pads to the correct peers

Sebastian Dröge slomo at kemper.freedesktop.org
Fri Feb 12 02:35:34 PST 2010


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

Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date:   Tue Jun  9 18:45:19 2009 +0200

[MOVED FROM BAD 12/29] shapewipe: Proxy queries on the video pads to the correct peers

---

 gst/shapewipe/gstshapewipe.c |   51 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/gst/shapewipe/gstshapewipe.c b/gst/shapewipe/gstshapewipe.c
index e8d8207..85f02ba 100644
--- a/gst/shapewipe/gstshapewipe.c
+++ b/gst/shapewipe/gstshapewipe.c
@@ -69,6 +69,8 @@ static gboolean gst_shape_wipe_video_sink_setcaps (GstPad * pad,
 static GstCaps *gst_shape_wipe_video_sink_getcaps (GstPad * pad);
 static GstFlowReturn gst_shape_wipe_video_sink_bufferalloc (GstPad * pad,
     guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
+static gboolean gst_shape_wipe_video_sink_query (GstPad * pad,
+    GstQuery * query);
 static GstFlowReturn gst_shape_wipe_mask_sink_chain (GstPad * pad,
     GstBuffer * buffer);
 static gboolean gst_shape_wipe_mask_sink_event (GstPad * pad, GstEvent * event);
@@ -76,6 +78,7 @@ static gboolean gst_shape_wipe_mask_sink_setcaps (GstPad * pad, GstCaps * caps);
 static GstCaps *gst_shape_wipe_mask_sink_getcaps (GstPad * pad);
 static gboolean gst_shape_wipe_src_event (GstPad * pad, GstEvent * event);
 static GstCaps *gst_shape_wipe_src_getcaps (GstPad * pad);
+static gboolean gst_shape_wipe_src_query (GstPad * pad, GstQuery * query);
 
 enum
 {
@@ -169,6 +172,8 @@ gst_shape_wipe_init (GstShapeWipe * self, GstShapeWipeClass * g_class)
       GST_DEBUG_FUNCPTR (gst_shape_wipe_video_sink_getcaps));
   gst_pad_set_bufferalloc_function (self->video_sinkpad,
       GST_DEBUG_FUNCPTR (gst_shape_wipe_video_sink_bufferalloc));
+  gst_pad_set_query_function (self->video_sinkpad,
+      GST_DEBUG_FUNCPTR (gst_shape_wipe_video_sink_query));
   gst_element_add_pad (GST_ELEMENT (self), self->video_sinkpad);
 
   self->mask_sinkpad =
@@ -188,6 +193,8 @@ gst_shape_wipe_init (GstShapeWipe * self, GstShapeWipeClass * g_class)
       GST_DEBUG_FUNCPTR (gst_shape_wipe_src_event));
   gst_pad_set_getcaps_function (self->srcpad,
       GST_DEBUG_FUNCPTR (gst_shape_wipe_src_getcaps));
+  gst_pad_set_query_function (self->srcpad,
+      GST_DEBUG_FUNCPTR (gst_shape_wipe_src_query));
   gst_element_add_pad (GST_ELEMENT (self), self->srcpad);
 
   self->mask_mutex = g_mutex_new ();
@@ -590,6 +597,50 @@ gst_shape_wipe_src_getcaps (GstPad * pad)
   return ret;
 }
 
+static gboolean
+gst_shape_wipe_video_sink_query (GstPad * pad, GstQuery * query)
+{
+  GstShapeWipe *self = GST_SHAPE_WIPE (gst_pad_get_parent (pad));
+  gboolean ret;
+  GstPad *peer = gst_pad_get_peer (self->srcpad);
+
+  GST_DEBUG_OBJECT (pad, "Handling query of type '%s'",
+      gst_query_type_get_name (GST_QUERY_TYPE (query)));
+
+  if (!peer) {
+    GST_INFO_OBJECT (pad, "No peer yet");
+    ret = FALSE;
+  } else {
+    ret = gst_pad_query (peer, query);
+    gst_object_unref (peer);
+  }
+
+  gst_object_unref (self);
+  return ret;
+}
+
+static gboolean
+gst_shape_wipe_src_query (GstPad * pad, GstQuery * query)
+{
+  GstShapeWipe *self = GST_SHAPE_WIPE (gst_pad_get_parent (pad));
+  gboolean ret;
+  GstPad *peer = gst_pad_get_peer (self->video_sinkpad);
+
+  GST_DEBUG_OBJECT (pad, "Handling query of type '%s'",
+      gst_query_type_get_name (GST_QUERY_TYPE (query)));
+
+  if (!peer) {
+    GST_INFO_OBJECT (pad, "No peer yet");
+    ret = FALSE;
+  } else {
+    ret = gst_pad_query (peer, query);
+    gst_object_unref (peer);
+  }
+
+  gst_object_unref (self);
+  return ret;
+}
+
 static GstFlowReturn
 gst_shape_wipe_blend_16 (GstShapeWipe * self, GstBuffer * inbuf,
     GstBuffer * maskbuf, GstBuffer * outbuf)





More information about the Gstreamer-commits mailing list