[gst-devel] No EOS message at the end of file.

wl2776 wl2776 at gmail.com
Fri May 14 09:46:33 CEST 2010


Sorry for repeating, I've written about my problem already, but my previous
explanations were too sparse and vague. No I can somewhat clarify them.

My problem is that the EOS message doesn't appear on playbin2's bus, after
some manipulations with reverse and forward playback. But the playbin2 is
surely at the end of file, as reported by _query_position().

I am working with MPEG2 program streams.

Now details.
I am developing a video player using playbin2.
One of the desired functionality is "Go End" feature. The player should
display the very last movie frame and pause. Then, if the play button is
pressed again, it should again go to paused state. 
Auto-pausing is implemented by processing the EOS message on the bus.

"Go End" is implemented by pause the playbin2 and turning it to reverse
playback:

gst_element_set_state(GST_ELEMENT(m_player),GST_STATE_PAUSED);
gboolean 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,m_stream_duration);


I also set internal flags, stating that "Go End" command was issued, and
catch ASYNC_DONE message. 
When caught, I set the forward playback direction again:

gboolean bus_watch(GstBus *bus, GstMessage *msg)
{
    switch (GST_MESSAGE_TYPE (msg)) {
        case GST_MESSAGE_EOS:
             gst_element_set_state(GST_ELEMENT(m_player),GST_STATE_PAUSED);
             GST_INFO("eos");
             break;

  ....
        case GST_MESSAGE_ASYNC_DONE:{
            GstFormat fmt=GST_FORMAT_TIME;
            gst_element_query_position(m_player,&fmt,&m_current_position);
            GST_DEBUG("async-done: current player position %dms",
                                       
GST_TIME_AS_MSECONDS(m_current_position));
            if(m_flags & FLAG_GO_END){
                flag_unset(FLAG_GO_END);

                rb=gst_element_seek(m_player,1.0,GST_FORMAT_TIME,
                   
(GstSeekFlags)(GST_SEEK_FLAG_FLUSH|GST_SEEK_FLAG_ACCURATE),
                       
GST_SEEK_TYPE_SET,m_current_position,GST_SEEK_TYPE_SET,m_stream_duration);
                GST_DEBUG("async-done: seek returned %d",rb);
            }
        }
        break;
  ....
    }
    gst_message_unref(msg);
    return TRUE;

}

The problem is that if after "Go End" I press the Play button on my form,
which simply
callsgst_element_set_state(GST_ELEMENT(m_player),GST_STATE_PLAYING), there
is no EOS message on the bus.

Since that, the player displays the last movie frame, remains in the playing
state and waits for something unclear.
If I drag the progress indicator on my player's form to some point on the
time line, which issues _seek_simple() call, the player plays successfully
from that position till EOS, then processes the EOS message and goes to the
paused state.

I can add some checks in the play() function as a workaround for this
problem, but I suspect that I am doing something wrong and would like to
avoid such ill patches.

I also tried setting new segment, but NEWSEGMENT message was rejected - the
call to _send_event( <new segment event> ) returned FALSE.

Querying the current segment after all this shows that the currently
configured segment is starting from 0 and is ending with 0.
-- 
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/No-EOS-message-at-the-end-of-file-tp2216227p2216227.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.




More information about the gstreamer-devel mailing list