[farsight2/master] funnel: Change the pad caps on source change

Olivier Crête olivier.crete at collabora.co.uk
Tue May 5 09:37:03 PDT 2009


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

diff --git a/gst/funnel/fs-funnel.c b/gst/funnel/fs-funnel.c
index fdeca3b..fd54460 100644
--- a/gst/funnel/fs-funnel.c
+++ b/gst/funnel/fs-funnel.c
@@ -211,6 +211,7 @@ fs_funnel_chain (GstPad * pad, GstBuffer * buffer)
   FsFunnelPadPrivate *priv = gst_pad_get_element_private (pad);
   GstEvent *event = NULL;
   GstClockTime newts;
+  GstCaps *padcaps;
 
   GST_DEBUG_OBJECT (funnel, "received buffer %p", buffer);
 
@@ -249,6 +250,18 @@ fs_funnel_chain (GstPad * pad, GstBuffer * buffer)
     }
   }
 
+
+  GST_OBJECT_LOCK (pad);
+  padcaps = GST_PAD_CAPS (funnel->srcpad);
+  GST_OBJECT_UNLOCK (pad);
+
+  if (GST_BUFFER_CAPS (buffer) && GST_BUFFER_CAPS (buffer) != padcaps) {
+    if (!gst_pad_set_caps (funnel->srcpad, GST_BUFFER_CAPS (buffer))) {
+      res = GST_FLOW_NOT_NEGOTIATED;
+      goto out;
+    }
+  }
+
   res = gst_pad_push (funnel->srcpad, buffer);
 
   GST_LOG_OBJECT (funnel, "handled buffer %s", gst_flow_get_name (res));
-- 
1.5.6.5



More information about the farsight-commits mailing list