[gst-devel] How to make playbin to redraw frames on seek?

wl2776 wl2776 at gmail.com
Tue Dec 22 10:51:59 CET 2009


Hi all.
My problem is that the playbin doesn't redraw video frames, when I try to
seek in paused state.
I tried both playbin and playbin2 with the same result.

I am using the following code to play a video file.
player = gst_element_factory_make("playbin","playbin0"); 
GstElement *bus = (GstElement *)gst_pipeline_get_bus(GST_PIPELINE(player));
gst_bus_set_sync_handler (GST_BUS(bus),
(GstBusSyncHandler)gst_bus_sync_handler, this);
gst_bus_add_watch (GST_BUS(bus), bus_call, this);
gst_object_unref(bus);

[ ... ]
// open and play a media file
g_object_set(G_OBJECT(player),"uri",
g_locale_to_utf8(input->filename,-1,NULL,NULL,NULL),NULL);
gst_element_set_state(GST_ELEMENT(player),GST_STATE_PLAYING);
[ ... ]

I also have a slider in my application, which shows an overall playing
progress and allows seeking. My condition is to pause the playback when a
user clicks on it. Here is the function, processing events from that slider. 
 
void CControlMainDialog::OnMarkerCtrlPosChange(LONG nPos)
{
  if(!player || !GST_CLOCK_TIME_IS_VALID(stream_duration)) return;
  gint64 nLLPos = (gint64)(stream_duration * nPos/MARKER_CTRL_SCALE) ;
  gst_element_seek_simple(GST_ELEMENT(player),GST_FORMAT_TIME,
                                    (GstSeekFlags)(GST_SEEK_FLAG_FLUSH |
GST_SEEK_FLAG_KEY_UNIT),
                                    nLLPos);
  gst_element_get_state(GST_ELEMENT(player),NULL,NULL,100 * GST_MSECOND);
  gst_element_set_state(GST_ELEMENT(player),GST_STATE_PAUSED);
  UpdateToolbarState();
  repaint_video();
}

void CControlMainDialog::repaint_video()
{
  gst_x_overlay_expose(GST_X_OVERLAY(videosink));
}


The repaint_video method is called, I've added calls to OutputDebugString
and seen the messages in the debug window. 
However, it displays always the last displayed frame, not the frame the
playbin is currently positioned on.
I tried digging the totem, however, it didn't help
-- 
View this message in context: http://n4.nabble.com/How-to-make-playbin-to-redraw-frames-on-seek-tp976820p976820.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.




More information about the gstreamer-devel mailing list