Hi all, I have programmed a C application where I capture video, then I encode it, and finally I stream it using an udpsink element. It works, but if I stop the pipeline (sending it EOS) and then start it again, I get old video, when it should be alive. How can I clean absolutely the pipeline to avoid this? My code is something like this: ... // Create the elements pipeline = gst_pipeline_new( "pipe" ); video_src = gst_element_factory_make( "mfw_v4lsrc", "video-source" ); video_enc = gst_element_factory_make( "mfw_vpuencoder", "video-encoder" ); sink = gst_element_factory_make( "udpsink", "sink" ); // Add the elements to the pipeline gst_bin_add_many( GST_BIN( pipeline ), video_src, video_enc, sink, NULL ); gst_element_link_with_filter( video_src, video_enc, &settings ); gst_element_link( video_enc, sink ); ... // Start/Stop the video stream while ( 1 ) { if ( do_stream ) { gst_element_set_state( pipeline, GST_STATE_PLAYING ); g_main_loop_run( loop ); gst_element_set_state( pipeline, GST_STATE_NULL ); } else sleep( 1 ); } ... Another function changes the variable 'do_stream' to true/false, and send also the EOS signal to the pipeline when required. So, specifically, my question is: What do I clean my pipeline when stopped to start again with the buffers and everything clean? Do I have to delete the pipeline object and do I have to create and link all the pipeline again? Thank you very much. All the best. LD. ------------------------------------------------------------------------------ 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 |
Why not just have separate pipelines for the two tasks?
On Wed, Jul 15, 2009 at 13:43, ldac<[hidden email]> wrote: > > Hi all, > > I have programmed a C application where I capture video, then I encode > it, and finally I stream it using an udpsink element. It works, but if I > stop the pipeline (sending it EOS) and then start it again, I get old > video, when it should be alive. How can I clean absolutely the pipeline > to avoid this? > > My code is something like this: > > ... > // Create the elements > pipeline = gst_pipeline_new( "pipe" ); > video_src = gst_element_factory_make( "mfw_v4lsrc", > "video-source" ); > video_enc = gst_element_factory_make( "mfw_vpuencoder", > "video-encoder" ); > sink = gst_element_factory_make( "udpsink", "sink" ); > // Add the elements to the pipeline > gst_bin_add_many( GST_BIN( pipeline ), video_src, video_enc, > sink, NULL ); > gst_element_link_with_filter( video_src, video_enc, &settings ); > gst_element_link( video_enc, sink ); > ... > // Start/Stop the video stream > while ( 1 ) > { > if ( do_stream ) > { > gst_element_set_state( pipeline, GST_STATE_PLAYING ); > g_main_loop_run( loop ); > gst_element_set_state( pipeline, GST_STATE_NULL ); > } > else > sleep( 1 ); > } > ... > > Another function changes the variable 'do_stream' to true/false, and > send also the EOS signal to the pipeline when required. > > So, specifically, my question is: What do I clean my pipeline when > stopped to start again with the buffers and everything clean? Do I have > to delete the pipeline object and do I have to create and link all the > pipeline again? > > Thank you very much. > All the best. > LD. > > > > ------------------------------------------------------------------------------ > 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 > -- Philip Jägenstedt ------------------------------------------------------------------------------ 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 ldac
There is two way :
1. you can delete old pipeline ,delete the pipeline object and set new video path and with creating new pipeline after getting EOS. 2. you can do like this after getting EOS: gst_element_set_state( pipeline, GST_STATE_NULL ); gst_element_set_state( pipeline, GST_STATE_READY); then set new video path gst_element_set_state( pipeline, GST_STATE_PLAY); Definitly it will work. On Wed, Jul 15, 2009 at 5:13 PM, ldac <[hidden email]> wrote:
-- Thanx & Regards Ajay Gautam +91-9717785580 ------------------------------------------------------------------------------ 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 ldac
ldac schrieb:
> Hi all, > > I have programmed a C application where I capture video, then I encode > it, and finally I stream it using an udpsink element. It works, but if I > stop the pipeline (sending it EOS) and then start it again, I get old > video, when it should be alive. How can I clean absolutely the pipeline > to avoid this? > > My code is something like this: > > ... > // Create the elements > pipeline = gst_pipeline_new( "pipe" ); > video_src = gst_element_factory_make( "mfw_v4lsrc", > "video-source" ); > video_enc = gst_element_factory_make( "mfw_vpuencoder", > "video-encoder" ); > sink = gst_element_factory_make( "udpsink", "sink" ); > // Add the elements to the pipeline > gst_bin_add_many( GST_BIN( pipeline ), video_src, video_enc, > sink, NULL ); > gst_element_link_with_filter( video_src, video_enc, &settings ); > gst_element_link( video_enc, sink ); > ... > // Start/Stop the video stream > while ( 1 ) > { > if ( do_stream ) > { > gst_element_set_state( pipeline, GST_STATE_PLAYING ); > g_main_loop_run( loop ); > gst_element_set_state( pipeline, GST_STATE_NULL ); > } > else > sleep( 1 ); > } > ... > > Another function changes the variable 'do_stream' to true/false, and > send also the EOS signal to the pipeline when required. > > So, specifically, my question is: What do I clean my pipeline when > stopped to start again with the buffers and everything clean? Do I have > to delete the pipeline object and do I have to create and link all the > pipeline again? You need to talk to the vendor of mfw_v4lsrc, mfw_vpuencoder to get confirmation from them that their elements are reusable (that is they correcly cleanup their state in state_changed()). Stefan > > Thank you very much. > All the best. > LD. > > > > ------------------------------------------------------------------------------ > 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 |
Free forum by Nabble | Edit this page |