3 # vi:si:et:sw=4:sts=4:ts=4
6 # 2016 Marianna S. Buschle <msb@qtec.com>
8 # Simple identity element in python
10 # You can run the example from the source doing from gst-python/:
12 # $ export GST_PLUGIN_PATH=$GST_PLUGIN_PATH:$PWD/plugin:$PWD/examples/plugins
13 # $ GST_DEBUG=python:4 gst-launch-1.0 fakesrc num-buffers=10 ! identity_py ! fakesink
16 gi.require_version('GstBase', '1.0')
18 from gi.repository import Gst, GObject, GstBase
22 # Simple Identity element created entirely in python
24 class Identity(GstBase.BaseTransform):
25 __gstmetadata__ = ('Identity Python','Transform', \
26 'Simple identity element written in python', 'Marianna S. Buschle')
28 __gsttemplates__ = (Gst.PadTemplate.new("src",
30 Gst.PadPresence.ALWAYS,
32 Gst.PadTemplate.new("sink",
33 Gst.PadDirection.SINK,
34 Gst.PadPresence.ALWAYS,
37 def do_transform_ip(self, buffer):
38 Gst.info("timestamp(buffer):%s" % (Gst.TIME_ARGS(buffer.pts)))
39 return Gst.FlowReturn.OK
41 GObject.type_register(Identity)
42 __gstelementfactory__ = ("identity_py", Gst.Rank.NONE, Identity)