[gst-devel] gst-python: how to use BaseSink.set_sync()
bilboed at gmail.com
Fri Oct 20 12:11:55 CEST 2006
On 10/20/06, Antoine Pitrou <antoine.pitrou at wengo.fr> wrote:
> I'm trying to write a sink that needs to receive buffers lazily (for
> streaming purposes), not all at once. For that it seems that the
> set_sync() method in gst.BaseSink is the right one. I've noticed that
> it's how fakesink works (by reading gstfakesink.c).
> However, I can't manage to reproduce this behaviour in Python. Although
> I call set_sync(True), when linking a source like audiotestsrc or mad to
> this sink, it still sends buffers greedily (while it does not if use
> fakesink sync=true).
The sync property is to synchronize the call to render(), it has
nothing to do with the *speed* at which buffers arrive in the sync.
> I also tried to define get_times() and render() methods but they never
> get called.
Those are virtual methods. To implement virtual methods with
pygobject (and therefore gst-python), you need to implement a
If you implement do_render() it will be called.
> Here is the current code for my sink. I use gst-python 0.10.4 (as
> shipped with Ubuntu Dapper).
> class MySink(gst.BaseSink):
> __gsttemplates__ = (
> sink_pad = property(lambda self: self.get_pad("sink"))
> def __init__(self):
> logging.info('setting chain/event functions')
> sink_pad = self.sink_pad
> self.num_bytes = 0
> def sink_chain(self, pad, buf):
> size = buf.size
> self.num_bytes += size
> logging.debug("%s timestamp:%d size:%d(%d)",
> pad, buf.timestamp, size, len(buf.data))
> return gst.FLOW_OK
> def sink_event(self, pad, event):
> logging.info("%s event:%r" % (pad, event.type))
> return True
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
Multimedia editing developer / Fluendo S.A.
More information about the gstreamer-devel