Hi,
Is it possible to add or remove elements to/from a tee dynamically? My pipeline looks like that: / [ queue | decodebin | autovideosink ] (playing_branch) filesrc | tee \ [ queue | filesink ] (recording_branch) When I start the pipeline only the playing_branch is connected. After a while I connect the recording_branch in the following way: gst_bin_add( GST_BIN(pipeline), recording_branch ); gst_element_link( tee, recording_branch ); gst_element_set_state( recording_branch, GST_STATE_PLAYING ); This, however, results only in a 0 bytes file being created and nothing else. Is there anything missing here, or is this approach wrong? |
Try below:
gst_element_set_state( recording_branch, GST_STATE_PAUSED ); gst_bin_add( GST_BIN(pipeline), recording_branch ); gst_element_link( tee, recording_branch ); gst_element_set_state( recording_branch, GST_STATE_PLAYING ); You may also want to move the first line to before and after element link line. Justin On Mon, Jul 20, 2009 at 5:02 AM, machinegodzilla <[hidden email]> wrote:
------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
In reply to this post by machinegodzilla
machinegodzilla schrieb:
> Hi, > > Is it possible to add or remove elements to/from a tee dynamically? > > My pipeline looks like that: > > / [ queue | decodebin | autovideosink ] > (playing_branch) > filesrc | tee > \ [ queue | filesink ] > (recording_branch) > > When I start the pipeline only the playing_branch is connected. After a > while I connect the recording_branch in the following way: > > gst_bin_add( GST_BIN(pipeline), recording_branch ); > gst_element_link( tee, recording_branch ); > gst_element_set_state( recording_branch, GST_STATE_PLAYING ); i think you need to: * request a pad from tee * set it blocked * link recording branch * set it to playing * unset pad-block Stefan > > This, however, results only in a 0 bytes file being created and nothing > else. > > Is there anything missing here, or is this approach wrong? ------------------------------------------------------------------------------ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
In reply to this post by joh-4
Hi,
Then how to REMOVE elements from a tee dynamically? for example, how to remove playing_branch or recording_branch from tee? Thanks a lot sincerely, karma
|
In reply to this post by joh-4
Hi,
Then how to REMOVE elements from a tee dynamically? e.g. how to remove recording_branch from tee dynamically? Thanks a lot sincerely, karma
|
On Thu, 2009-08-27 at 03:42 -0700, karma wrote:
> Hi, > > Then how to REMOVE elements from a tee dynamically? > e.g. how to remove recording_branch from tee dynamically? Try in this order: pad block the tee srcpad in the pad block, wake up the main thread to perform this: unlink the tee srcpad Set the elements after the srcpad to READY/NULL release the tee srcpad unblock tee srcpad Wim > > Thanks a lot > > sincerely, karma > > > joh-4 wrote: > > > > Try below: > > > > gst_element_set_state( recording_branch, GST_STATE_PAUSED ); > > gst_bin_add( GST_BIN(pipeline), recording_branch ); > > gst_element_link( tee, recording_branch ); > > gst_element_set_state( recording_branch, GST_STATE_PLAYING ); > > > > You may also want to move the first line to before and after element link > > line. > > > > Justin > > > > > > > > On Mon, Jul 20, 2009 at 5:02 AM, machinegodzilla > > <[hidden email]>wrote: > > > >> > >> Hi, > >> > >> Is it possible to add or remove elements to/from a tee dynamically? > >> > >> My pipeline looks like that: > >> > >> / [ queue | decodebin | autovideosink ] > >> (playing_branch) > >> filesrc | tee > >> \ [ queue | filesink ] > >> (recording_branch) > >> > >> When I start the pipeline only the playing_branch is connected. After a > >> while I connect the recording_branch in the following way: > >> > >> gst_bin_add( GST_BIN(pipeline), recording_branch ); > >> gst_element_link( tee, recording_branch ); > >> gst_element_set_state( recording_branch, GST_STATE_PLAYING ); > >> > >> This, however, results only in a 0 bytes file being created and nothing > >> else. > >> > >> Is there anything missing here, or is this approach wrong? > >> -- > >> View this message in context: > >> http://www.nabble.com/Dynamically-adding-and-removing-branches-of-a-tee...-tp24568543p24568543.html > >> Sent from the GStreamer-devel mailing list archive at Nabble.com. > >> > >> > >> > >> ------------------------------------------------------------------------------ > >> Enter the BlackBerry Developer Challenge > >> This is your chance to win up to $100,000 in prizes! For a limited time, > >> vendors submitting new applications to BlackBerry App World(TM) will have > >> the opportunity to enter the BlackBerry Developer Challenge. See full > >> prize > >> details at: http://p.sf.net/sfu/Challenge > >> _______________________________________________ > >> gstreamer-devel mailing list > >> [hidden email] > >> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel > >> > > > > ------------------------------------------------------------------------------ > > Enter the BlackBerry Developer Challenge > > This is your chance to win up to $100,000 in prizes! For a limited time, > > vendors submitting new applications to BlackBerry App World(TM) will have > > the opportunity to enter the BlackBerry Developer Challenge. See full > > prize > > details at: http://p.sf.net/sfu/Challenge > > _______________________________________________ > > gstreamer-devel mailing list > > [hidden email] > > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel > > > > > ------------------------------------------------------------------------------ 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 [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
The problem with Wim's solution is that you are dependant of getting another buffer on the tee srcpad after you block it. If this is no problem, then his solution is the easiest one. If there is a chance no more buffers will arrive on the src-pad you can do:
1. Attach an event-probe to the tee srcpad you want to unlink. 2. Send a custom downstream serialized event on the tee sinkpad 3. Inside the callback of the event-prove, confirm the arrival of your custom event and: a) Unlink the branch from the tee srcpad b) remove the probe c) release the tee srcpad (note that this is actually safe to do inside the callback!) d) return FALSE (so you don't pass that event downstream) Håvard -----Original Message----- From: Wim Taymans [mailto:[hidden email]] Sent: 27. august 2009 12:59 To: Discussion of the development of GStreamer Subject: Re: [gst-devel] Dynamically adding and removing branches of a tee... On Thu, 2009-08-27 at 03:42 -0700, karma wrote: > Hi, > > Then how to REMOVE elements from a tee dynamically? > e.g. how to remove recording_branch from tee dynamically? Try in this order: pad block the tee srcpad in the pad block, wake up the main thread to perform this: unlink the tee srcpad Set the elements after the srcpad to READY/NULL release the tee srcpad unblock tee srcpad Wim > > Thanks a lot > > sincerely, karma > > > joh-4 wrote: > > > > Try below: > > > > gst_element_set_state( recording_branch, GST_STATE_PAUSED ); > > gst_bin_add( GST_BIN(pipeline), recording_branch ); > > gst_element_link( tee, recording_branch ); > > gst_element_set_state( recording_branch, GST_STATE_PLAYING ); > > > > You may also want to move the first line to before and after element link > > line. > > > > Justin > > > > > > > > On Mon, Jul 20, 2009 at 5:02 AM, machinegodzilla > > <[hidden email]>wrote: > > > >> > >> Hi, > >> > >> Is it possible to add or remove elements to/from a tee dynamically? > >> > >> My pipeline looks like that: > >> > >> / [ queue | decodebin | autovideosink ] > >> (playing_branch) > >> filesrc | tee > >> \ [ queue | filesink ] > >> (recording_branch) > >> > >> When I start the pipeline only the playing_branch is connected. After a > >> while I connect the recording_branch in the following way: > >> > >> gst_bin_add( GST_BIN(pipeline), recording_branch ); > >> gst_element_link( tee, recording_branch ); > >> gst_element_set_state( recording_branch, GST_STATE_PLAYING ); > >> > >> This, however, results only in a 0 bytes file being created and nothing > >> else. > >> > >> Is there anything missing here, or is this approach wrong? > >> -- > >> View this message in context: > >> http://www.nabble.com/Dynamically-adding-and-removing-branches-of-a-tee...-tp24568543p24568543.html > >> Sent from the GStreamer-devel mailing list archive at Nabble.com. > >> > >> > >> > >> ------------------------------------------------------------------------------ > >> Enter the BlackBerry Developer Challenge > >> This is your chance to win up to $100,000 in prizes! For a limited time, > >> vendors submitting new applications to BlackBerry App World(TM) will have > >> the opportunity to enter the BlackBerry Developer Challenge. See full > >> prize > >> details at: http://p.sf.net/sfu/Challenge > >> _______________________________________________ > >> gstreamer-devel mailing list > >> [hidden email] > >> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel > >> > > > > ------------------------------------------------------------------------------ > > Enter the BlackBerry Developer Challenge > > This is your chance to win up to $100,000 in prizes! For a limited time, > > vendors submitting new applications to BlackBerry App World(TM) will have > > the opportunity to enter the BlackBerry Developer Challenge. See full > > prize > > details at: http://p.sf.net/sfu/Challenge > > _______________________________________________ > > gstreamer-devel mailing list > > [hidden email] > > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel > > > > > ------------------------------------------------------------------------------ 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 [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel ------------------------------------------------------------------------------ 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 [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
In reply to this post by joh-4
Hi All,
did this work? Thanks Shailesh |
In reply to this post by machinegodzilla
The following works for me for removing a branch from tee. I am removing src0 and keeping the src1 while the pipeline is still running. I am using gstreamermm but the concept should be similar in C API.
Glib::RefPtr<Gst::Pad> srcPad = gst()->pipeline->Gst::Bin::get_element("t")->get_static_pad("src0"); Glib::RefPtr<Gst::Pad> sinkPad = gst()->pipeline->Gst::Bin::get_element("queue0")->get_static_pad("sink"); srcPad->set_blocked(true); srcPad->unlink(sinkPad); gst()->pipeline->Gst::Bin::get_element("t")->remove_pad(srcPad); srcPad->set_blocked(false); |
Free forum by Nabble | Edit this page |