[gst-devel] Element states

Stefan Kost ensonic at hora-obscura.de
Mon Feb 13 07:54:03 CET 2006

hi all,

I had an irc discussion this morning with a new application developer. He faces 
a problem a bit similar to what I stuggle with.
He tries to write gstreamer backend for a dj-mixing application. For this app he 
needs to start the playback of a sources at specific times:
| src1 |-------
+------+      v
             +-------+   +-----------+
             | adder |---| audiosink |
             +-------+   +-----------+
+------+     ^
| src2 |------

where src2 is paused and starts at some streamtime.
I've re-read 

Still I see problems here:

1.) gstreamer doesn't like to have paused elements in a pipeline that is 
playing. Don't know it it is a bug in adder or elsewhere. On the other hand this 
looks like it requires the sparse streams feature.

2.) if we could start src2 later it needs to stamp its buffer to be in sync with 
those of src1. How to do that? Buffers should not be late in adder. The src need 
to maintain is local timstamp (e.g. to seek in its filesrc) and a global stream 
time for the buffers.

 From the part-clocks.txt file it looks like buffers can have a local timestamp, 
if there is segented playback, where the segment has the offset. Is that right?

In buzztard its a bit similar. I've described this several times already. We 
want to mute sources (make them emit nothing for a while). This sounds like an 
application for sparse streams too. Additionally for effect we like mute or 
bypass them. Where mute kind of turns the effect into a sparse source (we don't 
want anything behind the effect to render data). Bypass should just pass data 

Right now I've tried to implement this element independently. For mute I've 
hot-swapped the element with a audiotest-src that played silence. For bypass I 
'bypassed the effect'. Problem here is that when temporarily taking source out 
of the pipeline they don't increment their timestamps and if you link them in 
again they send old-data :(

An alternative could be to have elements support this via an interface (good 
name needed, as GstMixer is alredy taken). The iface would just force sources to 
have a boolean mute property and transformers to have a tristate normal, mute 
and bypass.
Mute can for the time-beeing send silence and later be turned into sparse stream 
handling. I am not sure if we can properly handle it for effects (avoid upstream 
elements to do calculations).
Bypass is easy to do, just exchange the process function to return the buffer it 
just received. This could even go into the baseclass (maybe).

What do you think/recommend.


More information about the gstreamer-devel mailing list