multifilesrc and looping wav files: success story, sort of
Tim Müller
tim at centricular.com
Sat Sep 13 04:37:15 PDT 2014
On Thu, 2014-09-11 at 13:05 +0200, Antonio Ospite wrote:
Hi,
> > So first question: is there a better way to make an audio sample loop
> > with gst-launch-1.0?
> >
> > Or is handling EOS/about-to-finish from code the only sane way to do
> > that?
> >
>
> Does anyone know the proper way to loop an audio file in GStreamer
> from gst-launch?
>From gst-launch-1.0 it's not so easy. multifilesrc is not suitable for
this, because the demuxer/parser usually won't handle that right. If
that works, it's likely only by accident.
The best way is to write some code. This can be a python script or C
program, and it doesn't have to be long. Either use playbin and the
'about-to-finish' signal, which works fine if you want to loop the
entire file from beginning to end.
Alternatively you can use so-called 'segment seeks' (with
SEEK_FLAG_SEGMENT set), then you get a MESSAGE_DONE message on the bus
instead of an EOS message, and you can then do a non-flushing seek back
to the position you want to play from. You will get the MESSAGE_DONE
message as soon as the demuxer/parser is finished processing stuff, but
while there are still samples queued in the rest of the pipeline
(queues, audio ring buffer, etc.), so that gives you some time to go
back to the next position and queue more samples.
Cheers
-Tim
--
Tim Müller, Centricular Ltd - http://www.centricular.com
More information about the gstreamer-devel
mailing list