diff --git a/gst/elements/gstidentity.c b/gst/elements/gstidentity.c index e456e131ae..66a43e1057 100644 --- a/gst/elements/gstidentity.c +++ b/gst/elements/gstidentity.c @@ -137,6 +137,22 @@ gst_identity_get_bufferpool (GstPad *pad) return gst_pad_get_bufferpool (identity->srcpad); } +static GstPadConnectReturn +gst_identity_connect_sink (GstPad *pad, GstCaps *caps) +{ + GstIdentity *identity; + + identity = GST_IDENTITY (gst_pad_get_parent (pad)); + + if (GST_CAPS_IS_FIXED (caps)) + if (gst_pad_try_set_caps (identity->srcpad, caps)) + return GST_PAD_CONNECT_OK; + else + return GST_PAD_CONNECT_REFUSED; + else + return GST_PAD_CONNECT_DELAYED; +} + static void gst_identity_init (GstIdentity *identity) { @@ -144,6 +160,7 @@ gst_identity_init (GstIdentity *identity) gst_element_add_pad (GST_ELEMENT (identity), identity->sinkpad); gst_pad_set_chain_function (identity->sinkpad, GST_DEBUG_FUNCPTR (gst_identity_chain)); gst_pad_set_bufferpool_function (identity->sinkpad, gst_identity_get_bufferpool); + gst_pad_set_connect_function (identity->sinkpad, gst_identity_connect_sink); identity->srcpad = gst_pad_new ("src", GST_PAD_SRC); gst_element_add_pad (GST_ELEMENT (identity), identity->srcpad); diff --git a/plugins/elements/gstidentity.c b/plugins/elements/gstidentity.c index e456e131ae..66a43e1057 100644 --- a/plugins/elements/gstidentity.c +++ b/plugins/elements/gstidentity.c @@ -137,6 +137,22 @@ gst_identity_get_bufferpool (GstPad *pad) return gst_pad_get_bufferpool (identity->srcpad); } +static GstPadConnectReturn +gst_identity_connect_sink (GstPad *pad, GstCaps *caps) +{ + GstIdentity *identity; + + identity = GST_IDENTITY (gst_pad_get_parent (pad)); + + if (GST_CAPS_IS_FIXED (caps)) + if (gst_pad_try_set_caps (identity->srcpad, caps)) + return GST_PAD_CONNECT_OK; + else + return GST_PAD_CONNECT_REFUSED; + else + return GST_PAD_CONNECT_DELAYED; +} + static void gst_identity_init (GstIdentity *identity) { @@ -144,6 +160,7 @@ gst_identity_init (GstIdentity *identity) gst_element_add_pad (GST_ELEMENT (identity), identity->sinkpad); gst_pad_set_chain_function (identity->sinkpad, GST_DEBUG_FUNCPTR (gst_identity_chain)); gst_pad_set_bufferpool_function (identity->sinkpad, gst_identity_get_bufferpool); + gst_pad_set_connect_function (identity->sinkpad, gst_identity_connect_sink); identity->srcpad = gst_pad_new ("src", GST_PAD_SRC); gst_element_add_pad (GST_ELEMENT (identity), identity->srcpad);