Using concat to switch src
TheGiamig
thegiamig at gmail.com
Wed Oct 17 08:01:28 UTC 2018
Antonio Ospite-2 wrote
> On Tue, 16 Oct 2018 03:24:46 -0500 (CDT)
> TheGiamig <
> thegiamig@
> > wrote:
>
>> Any ideas about a bin with play/stop/pause/seek functions for PCM audio
>> files
>> that flows with seamless timestamps?
>>
>
> When you say "seameless timestamps" do you mean that you want to be able
> to pause/stop/seek your audio, possibly producing silence, without the
> rest of the pipeline noticing?
>
> Let's schematize the options:
>
> a. Normal pause:
>
> Time: 0 4
> Sample: ABCD...........EFG
> Event: ^pause ^play
>
> b. Pause/Silence with time progressing and audio discarded:
>
> Time: 0 15
> Sample: ABCD...........PQR
> Event: ^pause ^play
>
> c. Pause with time progressing but audio "frozen":
>
> Time: 0 15
> Sample: ABCD...........EFG
> Event: ^pause ^play
>
>
> a. is a normal pause, when you pause the whole pipeline,
>
> b. can be achieved using input-selector and switching between your audio
> source and an audiotestsrc which produces silence, see:
> https://git.ao2.it/experiments/gstreamer.git/blob/HEAD:/python/gst-input-selector-switch.py
>
> c. could be achieved using two separate pipelines connected by
> interaudiosink and interaudiosrc, and you would pause the first pipeline
> without affecting the second pipeline, look at:
> https://git.ao2.it/experiments/gstreamer.git/blob/HEAD:/python/gst-decoupled-pipelines.py
>
> Maybe c. could also be achieved with input-selector changing the state
> of inactive sources with a change like this:
>
> diff --git a/python/gst-input-selector-switch.py
> b/python/gst-input-selector-switch.py
> index 4f622c6..55d0bef 100755
> --- a/python/gst-input-selector-switch.py
> +++ b/python/gst-input-selector-switch.py
> @@ -13,9 +13,9 @@ GObject.threads_init()
>
> # The following pipeline works
> PIPELINE = """
> -videotestsrc pattern=0 ! selector.
> -videotestsrc pattern=18 background-color=4294901760 ! selector.
> -input-selector name=selector ! autovideosink
> +videotestsrc pattern=0 is-live=true ! selector.
> +videotestsrc pattern=18 background-color=4294901760 is-live=true !
> selector.
> +input-selector name=selector sync-streams=false ! autovideosink
> """
>
>
> @@ -53,7 +53,9 @@ class Player:
> print("switching from %s to %s" % (active_pad.get_name(),
> new_pad.get_name()))
>
> + active_pad.get_peer().get_parent().set_state(Gst.State.PAUSED)
> self.selector.set_property("active-pad", new_pad)
> + new_pad.get_peer().get_parent().set_state(Gst.State.PLAYING)
>
> def on_eos(self, bus, msg):
> self.quit()
>
>
> For seeking, using interaudiosink/interaudiosrc is probably the quickest
> way.
>
> These are just quick and dirty examples of course.
>
> Ciao,
> Antonio
>
> --
> Antonio Ospite
> https://ao2.it
> https://twitter.com/ao2it
>
> A: Because it messes up the order in which people normally read text.
> See http://en.wikipedia.org/wiki/Posting_style
> Q: Why is top-posting such a bad thing?
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at .freedesktop
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Hi Antonio, you got it.
C is my case, but a second pipeline sounds to me a little overkill (but
working :) ).
I will think about your solution, but my idea was to insert a custom element
between the PCM source (filesrc/multifilesrc/fakesrc) and the parser
(audioparse) so I can intercept any data and events.
I think the "seamless timestamps" can be achieved just modifying some events
content and/or buffer PTS. In pause/stop the source have to be a silence
generator like fakesrc or audiotestsrc, so input-selector can help the
switch.
In this case the state play/pause/stop will be an internal logical state,
not directly linked to the elements state (the pipeline will be always in
playing state).
I think the fist step can be to understand which events and how to modify
them so timestamps never jump (as per concat element?).
Thanks
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
More information about the gstreamer-devel
mailing list