[gst-devel] Seeking

Wesley J. Miller WMiller at sdr.com
Mon Apr 5 22:34:11 CEST 2010


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

  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 );
   
  g_print("step 2 - state changed to playing. \n" );

  g_main_loop_run( loop );
   
  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


More information about the gstreamer-devel mailing list