[gst-devel] Seeking

Ron McOuat rmcouat at smartt.com
Mon Apr 5 23:19:15 CEST 2010


Comments inline below

On 10-04-05 1:34 PM, Wesley J. Miller wrote:
> Well, this is going to be harder than I thought it was.
>
> Because the kind help below didn't want to work, I tried just showing the video, no seek.
>
> I learned I can't get autovideosink to actually show video.
>
> So after whittling down the code to a minimum, here is my skeleton of just showing the video:
>
>
>
> int main( int argc, char **argv)
>    {
>    GstElement *pipeline;
>    GMainLoop *loop;
>
>    gst_init(&argc,&argv );
>    loop = g_main_loop_new( NULL, FALSE );
>
>    pipeline = gst_pipeline_new ("pipeline" );
>
> // ... dot dot dot ...
>
>    // souphttpsrc ! multipartdemux ! jpegdec ! ffmpegcolorspace ! autovideosink
>    

What happens when you put the pipeline above into the gst-launch command 
with -v and -m as options
to provide extra status messaging? Your pipeline looks right for display 
of MJPEG provided the device at
souphttpsrc location="URL of decice in MJPEG mode" is cooperating.
>    gst_bin_add_many( GST_BIN( pipeline ), src, multi_demux, jpegdec, colormapper, videoplayer, NULL);
>    gst_element_link_many( src, multi_demux, jpegdec, colormapper, videoplayer, NULL );
>
>    g_print("step 1 - start playing. \n" );
>
>    gst_element_set_state( pipeline, GST_STATE_PLAYING );
>    
The state change is asynchronous and the return status is not checked to 
be sure the call was accepted.
>
>    g_print("step 2 - state changed to playing. \n" );
>
>    g_main_loop_run( loop );
>    
This does not return until g_main_loop_quit is called from another 
thread such as in the Error / EOS handler you should have
set up for the pipeline as a message callback.
There should also be a callback to set up the association between the 
video sink and the window you need to provide as part
of the program GUI for the video to be rendered in.

I can see that you are using C but this documentation for Python will 
give you a good idea of how a program
needs to be set up to link a pipeline to a video playback window and to 
handle the end of stream. It adds another layer
with the GTK GUI library but looking at the overall structure should 
help you. I don't know what system you are on
so unless you use a somewhat system agnostic GUI library how you 
actually get the window ID will differ
significantly between system types.

Here is the Python tutorial URL:

http://pygstdocs.berlios.de/pygst-tutorial/index.html

with several example programs.
>
>    g_print("step 3 - after loop is running. \n" );
>
>    /* shutdown everything */
>    gst_element_set_state( pipeline, GST_STATE_NULL );
>
>    gst_object_unref (GST_OBJECT (pipeline));
>
>    return 0;
>    }
>
> Step 2 prints: "step 2 - state changed to playing."
> And then it hangs.  No video ever displays.
>
> I also tried this with a filesrc.  Same result.
>
>
> I DID get output with PLAYBIN and PLAYBIN2.
>
>
> So, can someone pick out my error and get me back to where I can TRY the seek stuff?
>
> Thanks,
>
> Wes
>
>
>
>
> -----Original Message-----
> From: Tim-Philipp Müller [mailto:t.i.m at zen.co.uk]
> Sent: Monday, April 05, 2010 2:02 PM
> To: gstreamer-devel at lists.sourceforge.net
> Subject: Re: [gst-devel] Seeking
>
> On Mon, 2010-04-05 at 10:22 -0400, Wesley J. Miller wrote:
>
> Hi,
>
>    
>> This pipeline is actually coded in C.  So, after I set the pipeline to
>> PAUSED, I’d like to be able to seek to one particular frame that is at
>> a specified  offset in time relative to the start of the saved mjpeg
>> stream.
>>
>> (...)
>>    gst_element_set_state( pipeline, GST_STATE_PAUSED );
>>
>> // perform a seek here
>>      
> Are you waiting for the pipeline to preroll / finish the sate change
> after doing _set_state(PAUSED)?
>
> Upward state changes to PAUSED/PLAYING are usually asynchronous (you
> might want to check the return value of _set_state() if you're not doing
> that yet), meaning that when _set_state() returns the pipeline is not in
> PAUSED/PLAYING state yet, meaning that you can't seek on it yet.
>
> You can wait for the pipeline to preroll with something like:
>
>    GstMessage *msg;
>
>    msg = gst_bus_timed_pop_filtered (GST_ELEMENT_BUS (pipeline),
>        GST_CLOCK_TIME_NONE,
>        GST_MESSAGE_ERROR | GST_MESSAGE_ASYNC_DONE);
>
>    if (msg == GST_MESSAGE_ERROR) {
>      .. handle error ..
>    }
>    gst_message_unref (msg);
>
>    gst_element_seek_simple (pipeline, GST_FORMAT_TIME,
>        GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE,
>        5 * GST_SECOND);
>
>    (N.B.: after this the pipeline will need to preroll again)
>
> Some info on frame stepping can be found here (it's not entirely clear
> what documentation you have found or not, or what information you're
> looking for exactly):
>
> http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-framestep.txt
> http://cgit.freedesktop.org/gstreamer/gstreamer/tree/tests/examples/stepping
>
> Hope this helps.
>
> Cheers
>   -Tim
>
>
>
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> 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