Please, help me with mpegpsdemux or/and mped2dec.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Please, help me with mpegpsdemux or/and mped2dec.

wl2776
Administrator
I am writing a video player. My application uses playbin2.
It constructs the following pipeline: player.png.
As can be seen from the pipeline, it uses Fluendo MPEG PS demuxer from gst-plugins-bad.

I am trying to implement the "Go end" command, which would position the player to the last frame.
The problem is that that last frame is not displayed, neither in paused, nor in playing state.
I perform this command in the following way

 gboolean rb=gst_element_seek_simple(GST_ELEMENT(m_player),
                              GST_FORMAT_TIME,
                              (GstSeekFlags)(GST_SEEK_FLAG_FLUSH|GST_SEEK_FLAG_ACCURATE),
                              m_stream_duration);

I tried different combinations of flags, also with _KEY_UNIT, tried subtracting a small amount of time from
m_stream_duration  (40ms)  - nothing helps.
The sound from the headphones suggests, that the pipeline has positioned to the end of file, but the last frame is not displayed.

But, this simple seeking to the end of file perfectly worked for OGG files.

I was studying the details of the video-sink and MPEG-2 demuxing and decoding plugins for already two weeks. From what I've studied, it can be seen, that when the seek issued, the mpeg2 demuxer processes some data and gives them further, mpeg2dec also tries decoding something but seems to drop frames. Videosink simply doesn't receive a video buffer.

I've also tried to set up a backward playing from the end of file:

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);

This helped for that particular file, but didn't work for another one.

Please, help me to make the playbin2 to display the last frame of any MPEG file.
Reply | Threaded
Open this post in threaded view
|

Re: Please, help me with mpegpsdemux or/and mped2dec.

wl2776
Administrator
wl2776 wrote
I am trying to implement the "Go end" command, which would position the player to the last frame.
The problem is that that last frame is not displayed, neither in paused, nor in playing state.
Ok, seeking backwards from the end of file seems doing the job.

void gst_player::go_end()
{
  if(m_player){
    gboolean rb;
    rb=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 displays the last frame in a movie.

However, there's another problem.
If I press play button, which triggers call
gst_element_set_state(GST_ELEMENT(m_player),GST_STATE_PAUSED);
I see some frames which are before the latest displayed frame in a movie file.
This, probably, caused by that the pipeline has prerolled some data for playing backwards from the movie end. This is wrong for my case. How can I flush the pipeline after seeking to the latest frame?