[gst-devel] How do I clean a pipeline to start/stop it several times?
Stefan Kost
ensonic at hora-obscura.de
Sun Jul 19 20:03:58 CEST 2009
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
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
More information about the gstreamer-devel
mailing list