GNOME Bugzilla – Bug 760403
VideoFilter works with gst 1.4.5 but not 1.6
Last modified: 2018-11-03 15:36:54 UTC
#!/usr/bin/env python from gi.repository import GObject, GstVideo, Gst, GstBase GObject.threads_init() Gst.init() class TestFilter(GstVideo.VideoFilter): """ A basic, buffer forwarding Gstreamer element """ #here we register our plugin details __gstmetadata__ = ( "TeetFilter plugin", "Generic", "TestFilter is a filter", "Test Author") _srctemplate = Gst.PadTemplate.new('src', Gst.PadDirection.SRC, Gst.PadPresence.ALWAYS, Gst.Caps.from_string("video/x-raw,format=I420")) _sinktemplate = Gst.PadTemplate.new('sink', Gst.PadDirection.SINK, Gst.PadPresence.ALWAYS, Gst.Caps.from_string("video/x-raw,format=I420")) __gsttemplates__ = (_srctemplate, _sinktemplate) def __init__(self): GstVideo.VideoFilter.__init__(self) self.set_passthrough(True) def do_transform_frame_ip(self, inframe): print("succes!!!") return Gst.FlowReturn.OK def do_set_info(self, incaps, in_info, outcaps, out_info): return True def plugin_init_testfilter(plugin): t = GObject.type_register (TestFilter) Gst.Element.register(plugin, "testfilter", 0, t) return True Gst.Plugin.register_static(Gst.VERSION_MAJOR, Gst.VERSION_MINOR, "testfilter", "test filter plugin", plugin_init_testfilter, '1', 'LGPL', 'testfilter', 'testfilter', '') # # Simple Sink element created entirely in python # class TestVideoSink(GstBase.BaseSink): __gstmetadata__ = ('TestVideoSink','Sink', \ 'Custom test sink element', 'Edward Hervey') __gsttemplates__ = Gst.PadTemplate.new("sink", Gst.PadDirection.SINK, Gst.PadPresence.ALWAYS, Gst.Caps.new_any()) def do_render(self, buffer): Gst.info("timestamp(buffer):%s" % (Gst.TIME_ARGS(buffer.pts))) print("do_render") return Gst.FlowReturn.OK def plugin_init_testvideosink(plugin): t = GObject.type_register(TestVideoSink) Gst.Element.register(plugin, "testvideosink", 0, t) return True Gst.Element.register(None, "testvideosink", Gst.Rank.NONE, TestVideoSink) if __name__ == '__main__': filter = Gst.ElementFactory.make('testfilter') sink = Gst.ElementFactory.make('testvideosink') assert(filter) assert(sink)
The above test works on Ubuntu 15.04 with gstreamer 1.4.5 but not with Ubuntu 15.10 with 1.6.1. On 1.6.1 I get: (See next comment cuz Android sux at copy paste)
python testfilter.py (python:8202): GStreamer-WARNING **: Element factory metadata for 'testfilter' has no valid long-name field (python:8202): GStreamer-WARNING **: Element factory metadata for 'testvideosink' has no valid long-name field Traceback (most recent call last):
+ Trace 235887
assert(filter) AssertionError
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-python/issues/6.