Hello everyone I'm having some issues getting a new src pad from a tee
on a running pipeline. It's nearly working but I can't get it past that last step... So here's the deal, I have a simple queue that goes to an xvimagesink. When I click a gtk button it calls a function that is setup to create queue/filesrc pipe and request another src pad from the tee element already in the running pipeline. Hook it all up to the running pipe and let it save to a file as it is viewed... The file is created, but size 0, and my xvsink continues to play on... From some debugging print statements I've added it looks like the pipeline comes into my button callback in the PLAYING state, but then says it is the PAUSED state as I start adding things to it, which seems odd as it is still playing... Here is the relevant code: GstElement *bin = gst_bin_new ("recording_bin"); g_print("BIN: %d PIPELINE %d\n",GST_STATE(bin),GST_STATE(pipeline)); GstPad *srcpad = NULL; GstPad *sinkpad = NULL; filesink = gst_element_factory_make ("filesink", "filesink"); filequeue = gst_element_factory_make ("queue2", "filequeue"); g_object_set (G_OBJECT (filesink), "location", current_dir, NULL); gst_bin_add_many(GST_BIN(bin),filequeue,filesink,NULL); gst_element_link(filequeue,filesink); sinkpad = gst_element_get_static_pad(filequeue,"sink"); gst_element_add_pad(bin,gst_ghost_pad_new("sink",sinkpad)); gst_object_unref(GST_OBJECT(sinkpad)); GstStateChangeReturn ret = gst_element_set_state(bin, GST_STATE_PAUSED); g_print("STATE CHANGED TO PAUSED: %d\n",ret); gst_bin_add(GST_BIN(pipeline), bin); GstElement *tee = gst_bin_get_by_name (GST_BIN(pipeline),"tee"); sinkpad = gst_element_get_pad(filequeue,"sink"); srcpad = gst_element_get_request_pad(tee,"src2"); gst_pad_set_blocked(srcpad,TRUE); gst_pad_set_active(srcpad,TRUE); ret = gst_element_set_state(bin, GST_STATE_PLAYING); g_print("STATE CHANGED TO PLAYING: %d BIN: %d PIPELINE %d\n",ret,GST_STATE(bin),GST_STATE(pipeline)); gst_pad_link(srcpad,sinkpad); gst_pad_set_active(srcpad,TRUE); gst_pad_set_blocked(srcpad,FALSE); g_print("STATE CHANGED TO PLAYING: %d BIN: %d PIPELINE %d\n",ret,GST_STATE(bin),GST_STATE(pipeline)); Can anyone help me out with this? Thanks, -- Nathanael d. Noblet ------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://ad.doubleclick.net/clk;226879339;13503038;l? http://clk.atdmt.com/CRS/go/247765532/direct/01/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Try doing "GST_STATE_PLAYING" after you have linked everything.
BR, Praveen ________________________________________ From: Nathanael D. Noblet [[hidden email]] Sent: Wednesday, July 28, 2010 12:01 PM To: Discussion of the development of GStreamer Subject: [gst-devel] Adding new tee src%d to a running pipeline... Hello everyone I'm having some issues getting a new src pad from a tee on a running pipeline. It's nearly working but I can't get it past that last step... So here's the deal, I have a simple queue that goes to an xvimagesink. When I click a gtk button it calls a function that is setup to create queue/filesrc pipe and request another src pad from the tee element already in the running pipeline. Hook it all up to the running pipe and let it save to a file as it is viewed... The file is created, but size 0, and my xvsink continues to play on... From some debugging print statements I've added it looks like the pipeline comes into my button callback in the PLAYING state, but then says it is the PAUSED state as I start adding things to it, which seems odd as it is still playing... Here is the relevant code: GstElement *bin = gst_bin_new ("recording_bin"); g_print("BIN: %d PIPELINE %d\n",GST_STATE(bin),GST_STATE(pipeline)); GstPad *srcpad = NULL; GstPad *sinkpad = NULL; filesink = gst_element_factory_make ("filesink", "filesink"); filequeue = gst_element_factory_make ("queue2", "filequeue"); g_object_set (G_OBJECT (filesink), "location", current_dir, NULL); gst_bin_add_many(GST_BIN(bin),filequeue,filesink,NULL); gst_element_link(filequeue,filesink); sinkpad = gst_element_get_static_pad(filequeue,"sink"); gst_element_add_pad(bin,gst_ghost_pad_new("sink",sinkpad)); gst_object_unref(GST_OBJECT(sinkpad)); GstStateChangeReturn ret = gst_element_set_state(bin, GST_STATE_PAUSED); g_print("STATE CHANGED TO PAUSED: %d\n",ret); gst_bin_add(GST_BIN(pipeline), bin); GstElement *tee = gst_bin_get_by_name (GST_BIN(pipeline),"tee"); sinkpad = gst_element_get_pad(filequeue,"sink"); srcpad = gst_element_get_request_pad(tee,"src2"); gst_pad_set_blocked(srcpad,TRUE); gst_pad_set_active(srcpad,TRUE); ret = gst_element_set_state(bin, GST_STATE_PLAYING); g_print("STATE CHANGED TO PLAYING: %d BIN: %d PIPELINE %d\n",ret,GST_STATE(bin),GST_STATE(pipeline)); gst_pad_link(srcpad,sinkpad); gst_pad_set_active(srcpad,TRUE); gst_pad_set_blocked(srcpad,FALSE); g_print("STATE CHANGED TO PLAYING: %d BIN: %d PIPELINE %d\n",ret,GST_STATE(bin),GST_STATE(pipeline)); Can anyone help me out with this? Thanks, -- Nathanael d. Noblet ------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://ad.doubleclick.net/clk;226879339;13503038;l? http://clk.atdmt.com/CRS/go/247765532/direct/01/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel "DISCLAIMER: This message is proprietary to Aricent and is intended solely for the use of the individual to whom it is addressed. It may contain privileged or confidential information and should not be circulated or used for any purpose other than for what it is intended. If you have received this message in error, please notify the originator immediately. If you are not the intended recipient, you are notified that you are strictly prohibited from using, copying, altering, or disclosing the contents of this message. Aricent accepts no responsibility for loss or damage arising from the use of the information transmitted by this email including damage from virus." ------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://ad.doubleclick.net/clk;226879339;13503038;l? http://clk.atdmt.com/CRS/go/247765532/direct/01/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
In reply to this post by Nathanael D. Noblet
Hi,
Just a very minor thing which I doubt is the reason for the problem: > sinkpad = gst_element_get_pad(filequeue,"sink"); > srcpad = gst_element_get_request_pad(tee,"src2"); > gst_pad_set_blocked(srcpad,TRUE); > gst_pad_set_active(srcpad,TRUE); Should not the last line here be gst_pad_set_active(srcpad,FALSE); I doubt that it would help, but who knows :-) Regards, Andrey. ------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://ad.doubleclick.net/clk;226879339;13503038;l? http://clk.atdmt.com/CRS/go/247765532/direct/01/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
In reply to this post by Praveen Pandey
On 07/28/2010 12:43 AM, Praveen Pandey wrote:
> Try doing "GST_STATE_PLAYING" after you have linked everything. Well I have set the bin to PLAYING, I've now added another call to gst_element_set_state(pipeline,GST_STATE_PLAYING); but it has made no difference. ------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://ad.doubleclick.net/clk;226879339;13503038;l? http://clk.atdmt.com/CRS/go/247765532/direct/01/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
In reply to this post by Andrey Nechypurenko-2
On 07/28/2010 01:07 AM, Andrey Nechypurenko wrote:
> Hi, > > Just a very minor thing which I doubt is the reason for the problem: > >> sinkpad = gst_element_get_pad(filequeue,"sink"); >> srcpad = gst_element_get_request_pad(tee,"src2"); >> gst_pad_set_blocked(srcpad,TRUE); >> gst_pad_set_active(srcpad,TRUE); > > Should not the last line here be > gst_pad_set_active(srcpad,FALSE); > > I doubt that it would help, but who knows :-) I've actually removed the calls to this as they haven't done anything and based on the api docs it seems that they should more than likely be called by core, and emit pad-added type events like when a demuxer adds pads based on what it detects... ------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://ad.doubleclick.net/clk;226879339;13503038;l? http://clk.atdmt.com/CRS/go/247765532/direct/01/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
In reply to this post by Nathanael D. Noblet
So because I couldn't find the answer to these questions with google,
I'm answering how I got it working for those that come afterwards... ================================================================ // Attaching a new branch to a running pipe... ================================================================ bin = gst_bin_new ("recording_bin"); filesink = gst_element_factory_make ("filesink", "filesink"); filequeue = gst_element_factory_make ("queue2", "filequeue"); // Build the new branch bin... g_object_set (G_OBJECT (filesink), "location", current_dir, NULL); gst_bin_add_many(GST_BIN(bin),filequeue,filesink,NULL); gst_element_link(filequeue,filesink); sinkpad = gst_element_get_static_pad(filequeue,"sink"); gst_element_add_pad(bin,gst_ghost_pad_new("sink",sinkpad)); gst_object_unref(GST_OBJECT(sinkpad)); // set the new bin to PAUSE to preroll? gst_element_set_state(bin, GST_STATE_PAUSED); // get regular pipeline pre-existing tee element tee = gst_bin_get_by_name (GST_BIN(pipeline),"tee"); sinkpad = gst_element_get_pad(bin,"sink"); srcpad = gst_element_get_request_pad(tee,"src2"); gst_pad_set_blocked(srcpad,TRUE); // the main pipeline becomes paused (because the new one is paused) gst_bin_add(GST_BIN(pipeline), bin); gst_pad_link(srcpad,sinkpad); gst_pad_set_blocked(srcpad,FALSE); // set to PLAYING gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_PLAYING); ================================================================ // To detach ... ================================================================ bin = gst_bin_get_by_name(GST_BIN(pipeline), "recording_bin"); tee = gst_bin_get_by_name(GST_BIN(pipeline), "tee"); srcpad = gst_element_get_pad(tee,"src2"); sinkpad = gst_element_get_pad(bin,"sink"); gst_pad_set_blocked(srcpad,TRUE); gst_pad_unlink(srcpad,sinkpad); gst_pad_set_blocked(srcpad,FALSE); gst_element_remove_pad(tee,srcpad); gst_bin_remove(GST_BIN(pipeline),bin); ------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |