[farsight2/master] Implement getcaps in the funnel

Håvard Graff havard.graff at tandberg.com
Tue Dec 23 15:26:51 PST 2008


---
 gst/funnel/fs-funnel.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/gst/funnel/fs-funnel.c b/gst/funnel/fs-funnel.c
index 2083080..648420a 100644
--- a/gst/funnel/fs-funnel.c
+++ b/gst/funnel/fs-funnel.c
@@ -79,6 +79,7 @@ static void fs_funnel_release_pad (GstElement * element, GstPad * pad);
 
 static GstFlowReturn fs_funnel_chain (GstPad * pad, GstBuffer * buffer);
 static gboolean fs_funnel_event (GstPad * pad, GstEvent * event);
+static GstCaps* fs_funnel_getcaps (GstPad * pad);
 
 
 typedef struct {
@@ -145,6 +146,7 @@ fs_funnel_request_new_pad (GstElement * element, GstPadTemplate * templ,
 
   gst_pad_set_chain_function (sinkpad, GST_DEBUG_FUNCPTR (fs_funnel_chain));
   gst_pad_set_event_function (sinkpad, GST_DEBUG_FUNCPTR (fs_funnel_event));
+  gst_pad_set_getcaps_function (sinkpad, GST_DEBUG_FUNCPTR (fs_funnel_getcaps));
 
   gst_segment_init (&priv->segment, GST_FORMAT_UNDEFINED);
   gst_pad_set_element_private (sinkpad, priv);
@@ -172,6 +174,21 @@ fs_funnel_release_pad (GstElement * element, GstPad * pad)
   gst_element_remove_pad (GST_ELEMENT_CAST (funnel), pad);
 }
 
+static GstCaps*
+fs_funnel_getcaps (GstPad * pad)
+{
+  FsFunnel *funnel = FS_FUNNEL (gst_pad_get_parent (pad));
+  GstCaps *caps;
+
+  caps = gst_pad_peer_get_caps (funnel->srcpad);
+  if (caps == NULL)
+    caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
+
+  gst_object_unref (funnel);
+
+  return caps;
+}
+
 static GstFlowReturn
 fs_funnel_chain (GstPad * pad, GstBuffer * buffer)
 {
-- 
1.5.6.5




More information about the farsight-commits mailing list