| 23 | # |
| 24 | |
| 25 | class MySink(gst.Element): |
| 26 | |
| 27 | _sinkpadtemplate = gst.PadTemplate ("sinkpadtemplate", |
| 28 | gst.PAD_SINK, |
| 29 | gst.PAD_ALWAYS, |
| 30 | gst.caps_new_any()) |
| 31 | |
| 32 | def __init__(self): |
| 33 | gst.Element.__init__(self) |
| 34 | gst.info('creating sinkpad') |
| 35 | self.sinkpad = gst.Pad(self._sinkpadtemplate, "sink") |
| 36 | gst.info('adding sinkpad to self') |
| 37 | self.add_pad(self.sinkpad) |
| 38 | |
| 39 | gst.info('setting chain/event functions') |
| 40 | self.sinkpad.set_chain_function(self.chainfunc) |
| 41 | self.sinkpad.set_event_function(self.eventfunc) |
| 42 | |
| 43 | def chainfunc(self, pad, buffer): |
| 44 | self.info("%s timestamp(buffer):%d" % (pad, buffer.timestamp)) |
| 45 | return gst.FLOW_OK |
| 46 | |
| 47 | def eventfunc(self, pad, event): |
| 48 | self.info("%s event:%r" % (pad, event.type)) |
| 49 | return True |
| 50 | |
| 51 | gobject.type_register(MySink) |
| 52 | |