[gst-devel] How do I clean a pipeline to start/stop it several times?

AJAY GAUTAM ajaygautam1981 at gmail.com
Thu Jul 16 06:18:09 CEST 2009


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 <ldacvs at gmail.com> 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
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>



-- 
Thanx & Regards
Ajay Gautam
+91-9717785580
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20090716/eb1586df/attachment.htm>


More information about the gstreamer-devel mailing list