Can I have two sinks using the same chain function?

Thiago Sousa Santos thiago.sousa.santos at collabora.com
Thu May 17 07:04:12 PDT 2012


On Wed, 2012-05-16 at 10:48 -0700, iron_guitarist1987 wrote:

Hello,

> Can I have two sinks using the same chain function? The init function would
> look something like this:
> 
> static void
> gst_n_to_one_init (GstN_to_one * filter,
>     GstN_to_oneClass * gclass)
> {
>   filter->sinkpad1 = gst_pad_new_from_static_template (&sink_factory,
> "sink");
>   gst_pad_set_setcaps_function (filter->sinkpad1,
>                                 GST_DEBUG_FUNCPTR(gst_n_to_one_set_caps));
>   gst_pad_set_getcaps_function (filter->sinkpad1,
>                                 GST_DEBUG_FUNCPTR(gst_pad_proxy_getcaps));
>   gst_pad_set_chain_function (filter->sinkpad1,
>                               GST_DEBUG_FUNCPTR(gst_n_to_one_chain));
>   
>   
>   filter->sinkpad2 = gst_pad_new_from_static_template (&sink_factory,
> "sink");
>   gst_pad_set_setcaps_function (filter->sinkpad2,
>                                 GST_DEBUG_FUNCPTR(gst_n_to_one_set_caps));
>   gst_pad_set_getcaps_function (filter->sinkpad2,
>                                 GST_DEBUG_FUNCPTR(gst_pad_proxy_getcaps));
>   gst_pad_set_chain_function (filter->sinkpad2,
>                               GST_DEBUG_FUNCPTR(gst_n_to_one_chain));
>   
>   
>   filter->srcpad = gst_pad_new_from_static_template (&src_factory, "src");
>   gst_pad_set_getcaps_function (filter->srcpad,
>                                 GST_DEBUG_FUNCPTR(gst_pad_proxy_getcaps));
> 
>   gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad1);
>   gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad2);
>   gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
>   filter->silent = FALSE;
>   
> }
> 
> Otherwise, How can I combine two chain functions to use just one srcpad?

Yes you can, the same applies for event handling and other pad
functions. The first parameter is the pad itself, so you can check in
case you need some minor differences when handling data from one or
another pad.

--
Thiago

> 
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Can-I-have-two-sinks-using-the-same-chain-function-tp4641761.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel




More information about the gstreamer-devel mailing list