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

Julien Moutte julien at moutte.net
Tue Dec 22 11:08:54 CET 2009


What video sink are you using ? It does not appear in your code sample.

You should not have to set the pipeline to PAUSED state after you issued the
seek, but that can depend on the exact use case of your application though.

Best regards,

Julien Moutte,
FLUENDO S.A.


On Tue, Dec 22, 2009 at 10:51 AM, wl2776 <wl2776 at gmail.com> wrote:

>
> 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.
>
>
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and
> easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20091222/6adf3f5f/attachment.htm>


More information about the gstreamer-devel mailing list