From 5fba6963ffde5bcce929fba791ccec84b12d8a26 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 9 Jun 2009 18:45:19 +0200 Subject: [PATCH] [MOVED FROM BAD 12/29] shapewipe: Proxy queries on the video pads to the correct peers --- gst/shapewipe/gstshapewipe.c | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) 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) -- 2.7.4