[gstreamer-bugs] [Bug 346666] A test filter element in gst-python

GStreamer (bugzilla.gnome.org) bugzilla-daemon at bugzilla.gnome.org
Wed Jul 5 10:27:23 PDT 2006


Do not reply to this via email (we are currently unable to handle email
responses and they get discarded).  You can add comments to this bug at
http://bugzilla.gnome.org/show_bug.cgi?id=346666
 GStreamer | gst-python | Ver: 0.10.4





------- Comment #2 from Corey O.  2006-07-05 17:27 UTC -------
Alright, so despite one setback of minor idiocy, here is the truly working
code.  HOWEVER, I believe that it should probably contain some more general
information, as in setting the element details, etc ... Also need to add in an
example of setting caps, etc ...

How's it look?

-------------------------------------------------------------------------------
import pygst
#pygst.require('0.10')
import gst
import gobject

class TestFilter(gst.Element):

  _srcpadtemplate = gst.PadTemplate ("srcpadtemplate",
                                     gst.PAD_SRC,
                                     gst.PAD_ALWAYS,
                                     gst.caps_new_any())

  _sinkpadtemplate = gst.PadTemplate ("sinkpadtemplate",
                                      gst.PAD_SINK,
                                      gst.PAD_ALWAYS,
                                      gst.caps_new_any())



  def __init__(self, name):
    gst.Element.__init__(self)
    self.set_name(name)
    self.srcpad = gst.Pad(self._srcpadtemplate, "src")
    self.sinkpad = gst.Pad(self._sinkpadtemplate, "sink")
    self.add_pad(self.srcpad)
    self.add_pad(self.sinkpad)

    self.sinkpad.set_chain_function(self.chainfunc)
    self.sinkpad.set_event_function(self.eventfunc)

  def chainfunc(self, pad, buffer):
    return self.srcpad.push(buffer)

  def eventfunc(self, pad, event):
    return self.srcpad.push_event(event)

gobject.type_register(TestFilter)

------------------------------------------------------------------------------


-- 
Configure bugmail: http://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.




More information about the Gstreamer-bugs mailing list