No EOS message at the end of file.

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

No EOS message at the end of file.

wl2776
Administrator
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 calls
gst_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.
Reply | Threaded
Open this post in threaded view
|

Re: No EOS message at the end of file.

Giles Atkinson
Earlier today, wl2776 wrote:

 > 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 do not have much experience with playbin2, but have found that playbin only puts GST_MESSAGE_EOS and GST_MESSAGE_BUFFERING on the bus when the pipeline is considered to be "streaming".  That pipeline property is set from the URI scheme of the source data:

/* list of URIs that we consider to be streams and that need buffering.
 * We have no mechanism yet to figure this out with a query. */
static const gchar *stream_uris[] = { "http://", "mms://", "mmsh://",
  "mmsu://", "mmst://", "myth://", NULL
};

I have been experimenting with a change to make "streaming" an explicit property of the playbin element, which can be set and read externally, but I am not certain that is the best approach.  There certainly seems to be a bug of some kind here, as the documentation implies that these bus messages are always sent.

Giles



------------------------------------------------------------------------------

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: No EOS message at the end of file.

Wim Taymans
On Fri, 2010-05-14 at 11:42 +0100, Giles Atkinson wrote:

> Earlier today, wl2776 wrote:
>
>  > 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 do not have much experience with playbin2, but have found that playbin only puts GST_MESSAGE_EOS and GST_MESSAGE_BUFFERING on the bus when the pipeline is considered to be "streaming".  That pipeline property is set from the URI scheme of the source data:
>
> /* list of URIs that we consider to be streams and that need buffering.
>  * We have no mechanism yet to figure this out with a query. */
> static const gchar *stream_uris[] = { "http://", "mms://", "mmsh://",
>   "mmsu://", "mmst://", "myth://", NULL
> };
>
> I have been experimenting with a change to make "streaming" an explicit property of the playbin element, which can be set and read externally, but I am not certain that is the best approach.  There certainly seems to be a bug of some kind here, as the documentation implies that these bus messages are always sent.

EOS should always be sent in the PLAYING state when the pipeline is EOS,
if not, please file a bug with an example or a way to reproduce the
strange behaviour that you are seeing.

Wim

>
> Giles
>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel



------------------------------------------------------------------------------

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: No EOS message at the end of file.

wl2776
Administrator
Wim Taymans wrote
On Fri, 2010-05-14 at 11:42 +0100, Giles Atkinson wrote:
>  > 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().

EOS should always be sent in the PLAYING state when the pipeline is EOS,
if not, please file a bug with an example or a way to reproduce the
strange behaviour that you are seeing.
Hmm... The problem is gone now. After rebuild.