From b733064d2f697dedee5489c719aa3e32ddf67cd3 Mon Sep 17 00:00:00 2001 From: Julien Moutte Date: Mon, 19 Jan 2004 23:23:54 +0000 Subject: gst/switch/gstswitch.c: Fixed switch element : proxying link and setting caps from src to sink on request. Original commit message from CVS: 2004-01-20 Julien MOUTTE * gst/switch/gstswitch.c: (gst_switch_request_new_pad), (gst_switch_init): Fixed switch element : proxying link and setting caps from src to sink on request. --- gst/switch/gstswitch.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'gst') diff --git a/gst/switch/gstswitch.c b/gst/switch/gstswitch.c index e6c9d03a..e68647cc 100644 --- a/gst/switch/gstswitch.c +++ b/gst/switch/gstswitch.c @@ -81,8 +81,11 @@ gst_switch_request_new_pad (GstElement *element, if (name) g_free (name); - /* That pad will proxy caps */ - gst_pad_set_getcaps_function (sinkpad, gst_pad_proxy_getcaps); + /* That pad will proxy caps and link */ + gst_pad_set_link_function (sinkpad, + GST_DEBUG_FUNCPTR (gst_pad_proxy_pad_link)); + gst_pad_set_getcaps_function (sinkpad, + GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps)); gst_element_add_pad (GST_ELEMENT (gstswitch), sinkpad); @@ -98,6 +101,10 @@ gst_switch_request_new_pad (GstElement *element, gstswitch->nb_sinkpads); gstswitch->nb_sinkpads++; + if (GST_PAD_CAPS (gstswitch->srcpad)) { + gst_pad_try_set_caps (sinkpad, GST_PAD_CAPS (gstswitch->srcpad)); + } + return sinkpad; } @@ -238,7 +245,10 @@ gst_switch_init (GstSwitch *gstswitch) { gstswitch->srcpad = gst_pad_new ("src", GST_PAD_SRC); gst_element_add_pad (GST_ELEMENT (gstswitch), gstswitch->srcpad); - gst_pad_set_getcaps_function (gstswitch->srcpad, gst_pad_proxy_getcaps); + gst_pad_set_link_function (gstswitch->srcpad, + GST_DEBUG_FUNCPTR (gst_pad_proxy_pad_link)); + gst_pad_set_getcaps_function (gstswitch->srcpad, + GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps)); gst_element_set_loop_function (GST_ELEMENT (gstswitch), gst_switch_loop); gstswitch->sinkpads = NULL; -- cgit v1.2.1