identity: Proxy the accept-caps query
authorSebastian Dröge <sebastian@centricular.com>
Tue, 1 Jul 2014 17:17:11 +0000 (19:17 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Tue, 1 Jul 2014 17:19:43 +0000 (19:19 +0200)
We always work in passthrough mode so there's no point in doing
something more clever in basetransform. Also the basetransform
code leads to problems with incomplete caps and downstream
elements that use GST_PAD_FLAG_ACCEPT_INTERSECT.

https://bugzilla.gnome.org/show_bug.cgi?id=732559

plugins/elements/gstidentity.c

index 4151dad..dbc9494 100644 (file)
@@ -110,6 +110,8 @@ static gboolean gst_identity_start (GstBaseTransform * trans);
 static gboolean gst_identity_stop (GstBaseTransform * trans);
 static GstStateChangeReturn gst_identity_change_state (GstElement * element,
     GstStateChange transition);
+static gboolean gst_identity_accept_caps (GstBaseTransform * base,
+    GstPadDirection direction, GstCaps * caps);
 
 static guint gst_identity_signals[LAST_SIGNAL] = { 0 };
 
@@ -235,6 +237,8 @@ gst_identity_class_init (GstIdentityClass * klass)
       GST_DEBUG_FUNCPTR (gst_identity_transform_ip);
   gstbasetrans_class->start = GST_DEBUG_FUNCPTR (gst_identity_start);
   gstbasetrans_class->stop = GST_DEBUG_FUNCPTR (gst_identity_stop);
+  gstbasetrans_class->accept_caps =
+      GST_DEBUG_FUNCPTR (gst_identity_accept_caps);
 }
 
 static void
@@ -745,6 +749,25 @@ gst_identity_stop (GstBaseTransform * trans)
   return TRUE;
 }
 
+static gboolean
+gst_identity_accept_caps (GstBaseTransform * base,
+    GstPadDirection direction, GstCaps * caps)
+{
+  gboolean ret;
+  GstPad *pad;
+
+  /* Proxy accept-caps */
+
+  if (direction == GST_PAD_SRC)
+    pad = GST_BASE_TRANSFORM_SINK_PAD (base);
+  else
+    pad = GST_BASE_TRANSFORM_SRC_PAD (base);
+
+  ret = gst_pad_peer_query_accept_caps (pad, caps);
+
+  return ret;
+}
+
 static GstStateChangeReturn
 gst_identity_change_state (GstElement * element, GstStateChange transition)
 {