[gst-devel] a good GStreamer design issue question

Ronald Bultje rbultje at ronald.bitfreak.net
Mon Sep 22 00:35:08 CEST 2003


Hi Thomas,

I'm on the move, so low in internet access, but I'll try to join the
discussion anyway.

On Fri, 2003-09-19 at 19:41, Thomas Vander Stichele wrote:
> After some time, I had an element that signaled proper values for
> display by a VU meter.  The problem was, since it was analyzing audio
> before it went to the sink, the VU meter displaying the audio level was
> preceding the actual output. It would be nice to find some way to fix
> this.
> 
> So, here are some thoughts:
> 
> a) one possible way to solve this would be some trickery in having the
> level plugin emit the signal only at the right moment by telling the
> clock to wait on the timestamp of the buffer; don't know if that would
> work, though

I like this. I think it's doable.

The thing is: subclassing is generally considered to be useful if the
child class needs all the stuff that's in the subclass - no matter what.
So the parent is just a genericity for what's in the child class. Here,
that's obviously not the case, since most people won't care at all about
a vu meter. Or maybe they do, but they don't know it yet, but the point
is that they won't use it.

Interfaces only fix this partially. The runtime and allocation code is
separated from the gobject allocation, so people that won't use it won't
have any slowdown and hardly any more memory usage (depends on how the
element implements this, though), but this is really for a generic model
of things, where the actual implementation is completely different for
each element. The element has to make most of the code. GstInterfaces
(aka GstSupportsInterface. ;) ) don't help at all here, they're a hack
for something different.

My feeling tells me that the proper way to do this is to make it a
separate element that's connected to the pipeline using a tee. After
all, it's an output, right?

           /- queue - osssink
bla - tee - 
           \- queue - volumelevel

Then the main problem is the synchronization, as you pointed out. Now,
vumeter can synchronize to the master clock just as well as the
xvideosink can. So you wait for the master clock to reach a certain
time, and then you emit the signal with the volume level.

Does that sound reasonable?

Ronald

-- 
Ronald Bultje <rbultje at ronald.bitfreak.net>
Linux Video/Multimedia developer





More information about the gstreamer-devel mailing list