Using concat to switch src

Antonio Ospite ao2 at ao2.it
Tue Oct 16 11:27:58 UTC 2018


On Tue, 16 Oct 2018 03:24:46 -0500 (CDT)
TheGiamig <thegiamig at gmail.com> 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?


More information about the gstreamer-devel mailing list