Struggling with displaying the very last movie frame.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Struggling with displaying the very last movie frame.

wl2776
Administrator
Hi all.
I am writing a player using GStreamer.

I've got two questions actually.
Either, how can I display the very last frame?
Or, how do I flush the playbin2 without clearing the last displayed frame?

One of the tasks is "Go End" function, which makes the player to display the very last frame and go to the paused state.
I am using playbin2.
Simple seek to the 'duration' position doesn't work always.
Currently, I've found the following solution - perform a reverse playback from the end of file and set the player to the paused state.

gst_element_seek(GST_ELEMENT(m_player),-1.0,
       GST_FORMAT_TIME,(GstSeekFlags)(GST_SEEK_FLAG_FLUSH|GST_SEEK_FLAG_ACCURATE),
       GST_SEEK_TYPE_SET,0,GST_SEEK_TYPE_END,0);

gst_element_set_state(GST_ELEMENT(m_player),GST_STATE_PAUSED);

This seems to reliably display a last frame, but there is the problem.

If I press the play button after this, which performs the single call:
  gst_element_set_state(GST_ELEMENT(m_player),GST_STATE_PLAYING)
, then, the unexpected behavior occurs, depending on the file loaded.

If the MPEG2 file is loaded, the player displays several frames which are before the very last frame and pauses.
If the OGG file is loaded, then the playbin2 plays it backwards.

Oups, just noticed, if the wmv file is loaded, this method doesn't work at all, the gst_element_seek returns false.

Please, help me to display the latest frame of a movie.
The most of my movies are mpeg2, and playbin2 selects mpegdemux2 and mpeg2dec for them.