Hi,<div><br></div><div>What you are trying to do is simulating a live from a file, aren't you? You don't want to break the tcpserversink connection when you change the filesrc's location. Then you must do the next thing. You must install a pad-probe outside the decodebin or whatever demuxer you use. That pad probe must do several things. </div>
<div><br></div><div>The first one is modifying the first segment event. That event will have the video's original duration. It must be modified to have 0 as start and -1 as end. In such way you won't let the final muxer to know the duration, and it will assume that video has no end ( you can, of course, put whatever duration you wan, of course, for example half of the first video and the whole of the second one). </div>
<div><br></div><div>The second one is blocking the rest segment events which you will have when you replace the location. We will see later how to replace it.</div><div><br></div><div>The third thing is blocking the flush events.</div>
<div><br></div><div>The fourth thing is blocking the EOS events ( if you want to play a video until the end, of course).</div><div><br></div><div>The fifth thing ( and this is very important) is modifying the buffer's PTS and DTS. Several muxers ( like mp4mux or oggmux) will multiplex a video and an audio depending on each PTS and DTS frame. If they detect that repeated PTS's or DTS's, they will discard the buffer, so in the best case you will see the video delayed ( in the worst you will see nothing but errors in the logs). Think that video and audio have their own PTS's and DTS's, but they are related when you replace a file ( at the end both files must maintain the synchronization).</div>
<div><br></div><div>And now how to change a file. First of all emit a flush start and a flush end in the filesrc to clean the buffers. After it, put filesrc and the demuxer or the decodebin to NULL, change filesrc's location and put those elements again into PLAYING state.</div>
<div><br></div><div>Watch out with the events and the DTS's!!</div><div><br><div class="gmail_quote">2013/7/26 Serhiy Stetskovych <span dir="ltr"><<a href="mailto:patriotyk@gmail.com" target="_blank">patriotyk@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I think the second option with locking might help me but I don't understand how to use it.</div><div class="HOEnZb">
<div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">2013/7/25 Serhiy Stetskovych <span dir="ltr"><<a href="mailto:patriotyk@gmail.com" target="_blank">patriotyk@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Just investigated and found that after changing location, stream begins with new webm header. So Is it possible to create one stream from several files?</div>
<div><div><div class="gmail_extra"><br><br><div class="gmail_quote">
2013/7/25 Serhiy Stetskovych <span dir="ltr"><<a href="mailto:patriotyk@gmail.com" target="_blank">patriotyk@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Thank you,<div>I have tried with state READY and thought it don't work, but problem wasn't in connection. Looks like when file reaches end, gstreamer sends some end information, or there is some gap between streams or something else. Because connections still alive, but video didn't displays in browser, it begin playing again after refresh(reconnect)</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/7/25 Stirling Westrup <span dir="ltr"><<a href="mailto:swestrup@gmail.com" target="_blank">swestrup@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div>
<div dir="ltr"><div class="gmail_extra"><div><div class="gmail_quote">On Thu, Jul 25, 2013 at 6:44 AM, Serhiy Stetskovych <span dir="ltr"><<a href="mailto:patriotyk@gmail.com" target="_blank">patriotyk@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hello, I have a problem with changing media file in filesrc. After finishing playing one file I get event and in this point I need change media file to another but without breaking clients connected to tcpserversink. I can change file only after setting STATE_NULL, and then setting back to STATE_PLAYING. But this breaks all my connections.</div>
<div><br></div><div>Actually I use multifdsink with writing to sockets, but in explanation above I wrote about tcpserversink because It is easier to explain, but I think it doesnt matter.</div><a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank"></a><br>
</div></blockquote></div></div>You have two options. First, you can change the media file in filesrc when you are in STATE_READY rather than STATE_NULL. You only really need to go into STATE_NULL when you are about to dismantle your pipeline (ie for program cleanup).<br>
<br></div><div class="gmail_extra">If for some reason you have to put filesrc in a state that causes your sink to perform an action you don't like, you can LOCK the state of the sink so it ignores requests to change state. This is done with one of the gst_element_... function calls.<br>
<br></div><div class="gmail_extra"><br>--<br>Stirling Westrup<br>Programmer, Entrepreneur.<br><a href="https://www.linkedin.com/e/fpf/77228" target="_blank">https://www.linkedin.com/e/fpf/77228</a><br><a href="http://www.linkedin.com/in/swestrup" target="_blank">http://www.linkedin.com/in/swestrup</a><br>
<a href="http://technaut.livejournal.com" target="_blank">http://technaut.livejournal.com</a><br><a href="http://sourceforge.net/users/stirlingwestrup" target="_blank">http://sourceforge.net/users/stirlingwestrup</a>
</div></div>
<br></div></div>_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
<br></blockquote></div><br></div>