[gst-devel] Re: Python PushSrc example

Edward Hervey bilboed at gmail.com
Thu May 11 01:28:04 CEST 2006

Hi all,

On 5/9/06, Johan Rydberg <jrydberg at gnu.org> wrote:
> Nigel Sim <nigel.sim at jcu.edu.au> writes:
> > I have two projects which require me to push data down a GStreamer
> > pipeline using Python. I am aware that the PushSrc has recently been
> > fully implemented in Python, but I can't find any examples of how to
> > properly use it.
> I'm afraid not, but I have a hacked up example of filesrc.py that uses
> a BaseSink and a BaseSrc.  It might be of some help to you.

  Those two examples are valid. Currently creating a PushSrc is
problematic, since the current version of the python bindings don't
handle the case where you have:
   Class A has virtual method do_this
   Class B is a subclass of Class A
   Class B has virtual method do_this (same name)

  Right now if you implement a PushSrc and override the do_this
method, the python bindings will think it's the method from Class A.

  This should be solved once the switch to the new codegenerator has
been fully tested will existing programs.

  On the other hand, it's quite easy to reproduce the PushSrc
behaviour. You implement the check_get_range virtual metod and return
False, and then you implement the create method ... ignoring the
offset and size arguments:

  Class MyPushSrc(gst.BaseSrc):

     def do_check_get_range(self):
        return False

     def do_create(self, offset, size):
        #ignore the offset and size argument and return a buffer

  Hope this helps, and mail us your findings :)


> ~j

Edward Hervey
Junior developer / Fluendo S.L.

More information about the gstreamer-devel mailing list