slow motion using playbin2

James jkim at jetheaddev.com
Mon Dec 30 00:24:25 PST 2013


Frame stepping while in PAUSED state seems to work perfectly 
when done with new-step event.

Slow motioning, however, does not seem to work all the time
by simply changing the rate to a value, 0.0 < rate < 1.0 with seek event.
pipeline is basically playbin2 and I am feeding MPEG2 transport stream data
from a local file using something like   
   g_object_set (data.playbin2, "uri",
"file:///home/james/Videos/test-mpeg2-ac3.ts", NULL);

The code below is what I used to send a seek event with the playback rate
set to 0.5: 

What's interesting is that this sometimes works and sometimes doesn't.
If someone could tell point to me what I may be missing here...

{
  gint64 position;
  GstFormat format = GST_FORMAT_TIME;
  GstEvent *seek_event;

  /* Obtain the current position, needed for the seek event */
  if (!gst_element_query_position (data->pipeline, &format, &position)) {
    g_printerr ("Unable to retrieve current position.\n");
    return;
  }

    data->rate = 0.5; // half-speed
    seek_event = gst_event_new_seek (data->rate, 
                                                       GST_FORMAT_TIME, 
                                                       GST_SEEK_FLAG_FLUSH |
GST_SEEK_FLAG_ACCURATE,
                                                       GST_SEEK_TYPE_SET, 
                                                       position, 
                                                       GST_SEEK_TYPE_SET, 
                                                       -1);

  if (data->video_sink == NULL) {
    /* If we have not done so, obtain the sink through which we will send
the seek events */
    g_object_get (data->pipeline, "video-sink", &data->video_sink, NULL);
  }

  /* Send the event */
  gst_element_send_event (data->video_sink, seek_event);
}





--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/slow-motion-using-playbin2-tp4664340.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list