[gst-devel] How to dynamically add and remove branch to a "tee" element?

Uday Verma uday.karan at gmail.com
Fri Nov 6 15:51:41 CET 2009


In my experience, the bin/elements/branch you're trying to attach to one of
the src%d pads should be in the PLAYING state before you link it.  This is
because as the tee tries to push a buffer to its src pads, if any of the
pads is linked to a non-PLAYING element, the buffer push method returrn a
wrong-state value which propagates all the way to the source and pauses
everything, GST_DEBUG=4 will show you this.

Also, like you mentioned, gst_pad_link is how you would link a tee's src%d
to the branch.

While unlinking, I first unlink the pad and then take care of the disposing
the branch.  Ideally, however, we should block data on the pad and then
unlink it, but that hasn't work for me so far.

HTH

On Fri, Nov 6, 2009 at 8:37 AM, Peter Cai <newptcai at gmail.com> wrote:

> After a lot of search, I found this is not quite simple as I used to
> think.  The coding following only work when 2 sink is linked to the
> tee.
> When the 3rd comes, all 3 sink doesn't work.
>
> What is the correct way to add and remove branch to a "tee"?
> On IRC, I was told to try these
>
> 1. setting sink "asycn = FALSE"
> 2. add a queue between tee and sink
> 3. use pad instead of gst_element_link
>
> None of them works.
>
>         GstElement* dd = gst_element_factory_make("directdrawsink", NULL);
>         g_object_set(dd, "async", FALSE, NULL);
>         gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(dd), (gulong)handle);
>
>         gst_element_set_state (dd, GST_STATE_PAUSED);
>         gst_bin_add(GST_BIN (self->priv->pipeline), dd);
>
>         if(!gst_element_link (self->priv->tee, dd))
>         {
>             vivs_warning("Can not link tee to directdrawsink");
>         }
>
>         if(self->priv->sink_num == 1)
>             gst_element_set_state (self->priv->pipeline,
> GST_STATE_PLAYING);
>         else
>             gst_element_set_state (dd, GST_STATE_PLAYING);
>      self->priv->sink_num += 1
>
>
> --
> look to the things around you,the immediate world around you, if you
> are alive,it will mean something to you ——Paul Strand
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20091106/094e45f6/attachment.htm>


More information about the gstreamer-devel mailing list