<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Am 04.05.2015 um 09:27 schrieb Sebastian Dröge:<br>
</div>
<blockquote cite="mid:1430724426.2224.19.camel@centricular.com" type="cite">
<pre wrap="">On Mo, 2015-05-04 at 09:15 +0200, Thomas Scheuermann wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi all,

I need to write a player that loops over a file and plays it
continuously. I found in some mails that I should use gst_element_seek
with GST_SEEK_FLAG_SEGMENT. But it doesn't work. Here is the event loop
I use:
[...]
</pre>
</blockquote>
<pre wrap="">
What kind of file are you using, which container format? And which
GStreamer version? Until recently there were some bugs related to this.

The procedure in general is to a) first to a FLUSHING|SEGMENT seek to
your start position, then b) whenever you receive the segment-done
message you would do a SEGMENT (non-flushing!) see to the loop start and
c) in the very end for the last loop you do a non-segment, non-flushing
seek for the last loop (so that you get EOS in the end instead of
segment-done).
</pre>
</blockquote>
I'm now working with GStreamer 1.4.4 on Debian Jessie.<br>
I've changed my event loop now in the following way:<br>
<br>
    bus = gst_pipeline_get_bus(GST_PIPELINE(bin));<br>
<br>
    while(!done)<br>
    {<br>
        message = gst_bus_timed_pop(bus, GST_CLOCK_TIME_NONE);<br>
        switch(GST_MESSAGE_TYPE(message))<br>
        {<br>
            case GST_MESSAGE_ERROR:<br>
                g_print("Error occured\n");<br>
                g_print("%s :\n", GST_MESSAGE_SRC_NAME(message));<br>
                break;<br>
            case GST_MESSAGE_STATE_CHANGED:<br>
                gst_element_get_state(GST_ELEMENT(GST_MESSAGE_SRC(message)), &state, NULL, 0);<br>
                g_print("Element %s changed state to %d\n", GST_MESSAGE_SRC_NAME(message), state);<br>
                if(GST_ELEMENT(message->src) == bin) {<br>
                    if(state == GST_STATE_PLAYING) {<br>
                        if(!once) {<br>
                            once = TRUE;<br>
                            g_print("gst_element_seek_simple (GST_SEEK_FLAG_SEGMENT | GST_SEEK_FLAG_FLUSH)\n");<br>
                            if(!gst_element_seek_simple(bin, GST_FORMAT_TIME, GST_SEEK_FLAG_SEGMENT | GST_SEEK_FLAG_FLUSH, 0)) {<br>
                                g_print("gst_element_seek_simple failed\n");<br>
                            }<br>
                        }<br>
                    }<br>
                }<br>
                break;<br>
            case GST_MESSAGE_EOS:<br>
                g_print("End Of Stream\n");<br>
                done = TRUE;<br>
                break;<br>
            case GST_MESSAGE_SEGMENT_DONE:<br>
                g_print("segment done\n");<br>
                        g_print("gst_element_seek_simple (GST_SEEK_FLAG_SEGMENT)\n");<br>
                        if(!gst_element_seek_simple(bin, GST_FORMAT_TIME, GST_SEEK_FLAG_SEGMENT, 0)) {<br>
                            g_print("gst_element_seek failed\n");<br>
                        }<br>
                break;<br>
            default:<br>
                g_print("Messgae %s\n", GST_MESSAGE_TYPE_NAME(message));<br>
                break;<br>
        }<br>
        gst_message_unref(message);<br>
    }<br>
    gst_object_unref(bus);<br>
<br>
<br>
Now the first time the file plays normal. At the end the file starts playing again from the beginning but in high speed, not in normal speed. So the player loops over the file but only the first time in normal speed.<br>
How can this be fixed?<br>
<blockquote cite="mid:1430724426.2224.19.camel@centricular.com" type="cite">
<pre wrap="">
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset> <br>
<pre wrap="">_______________________________________________
gstreamer-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a>
</pre>
</blockquote>
<br>
This message is subject to the following terms and conditions: <a href="http://www.barco.com/en/maildisclaimer">
MAIL DISCLAIMER</a>
</body>
</html>