Hello everyone,
I am currently in the process of making a custom plugin that would alter frames from a video file or a stream. As i could gather the best base for this is to subclass BaseTransform. The base code for this is : ***** class TfObjectDetection(GstBase.BaseTransform): __gsttemplates__ = ( Gst.PadTemplate.new( "src", Gst.PadDirection.SRC, Gst.PadPresence.ALWAYS, Gst.Caps.from_string("video/x-raw,format=(string)RGB")), Gst.PadTemplate.new( "sink", Gst.PadDirection.SINK, Gst.PadPresence.ALWAYS, Gst.Caps.from_string("video/x-raw,format=(string)RGB")) ) def __init__(self): GstBase.BaseTransform.__init__(self) self.set_passthrough(False) self.set_in_place(False) def do_transform(self, inbuf, outbuf): print("Tensorflow plugin : processing frame at timestamp(buffer):%s" % (Gst.TIME_ARGS(inbuf.pts))) print(" buffer size is :%s" % (inbuf.get_size())) * do stuff * outbuf.fill(0, data) return Gst.FlowReturn.OK ***** Nothing fancy but whatever i try : (<unknown>:63739): GStreamer-CRITICAL **: gst_buffer_fill: assertion 'gst_buffer_is_writable (buffer)' failed Trying in-place result in the same error so i really don’t know what i should do. I also tried to subclass Element but i cannot fathom how caps negotiations works and it always fail with a « non negotiated » error. I listened to queries and put a method like this : def _src_query(self, pad, parent, query): but i have no idea what i should do in there so the next element accept my source pad. Checking the C code for BaseTransform is way too complicated, after all my plugin used fixed caps since it only support RGB frame on its sink. Version for gstreamer is 1.12.3 and it is installed on OSX using brew. Python is 3.6 I’ve been stuck on this for a week now and i don’t really know what to do. I could abandon Python and write everything in C but that would require all my frame processing code to be rewritten in C as well which i would rather avoid. I would be very grateful for any insight. Thanks _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
You might want to subclass GstVideoFilter. And, in any case, the gstvideofilter.c has code to make buffers writable. Le Jeudi 7 décembre 2017 14h07, Jimmy De Pauw <[hidden email]> a écrit : Hello everyone, I am currently in the process of making a custom plugin that would alter frames from a video file or a stream. As i could gather the best base for this is to subclass BaseTransform. The base code for this is : ***** class TfObjectDetection(GstBase.BaseTransform): __gsttemplates__ = ( Gst.PadTemplate.new( "src", Gst.PadDirection.SRC, Gst.PadPresence.ALWAYS, Gst.Caps.from_string("video/x-raw,format=(string)RGB")), Gst.PadTemplate.new( "sink", Gst.PadDirection.SINK, Gst.PadPresence.ALWAYS, Gst.Caps.from_string("video/x-raw,format=(string)RGB")) ) def __init__(self): GstBase.BaseTransform.__init__(self) self.set_passthrough(False) self.set_in_place(False) def do_transform(self, inbuf, outbuf): print("Tensorflow plugin : processing frame at timestamp(buffer):%s" % (Gst.TIME_ARGS(inbuf.pts))) print(" buffer size is :%s" % (inbuf.get_size())) * do stuff * outbuf.fill(0, data) return Gst.FlowReturn.OK ***** Nothing fancy but whatever i try : (<unknown>:63739): GStreamer-CRITICAL **: gst_buffer_fill: assertion 'gst_buffer_is_writable (buffer)' failed Trying in-place result in the same error so i really don’t know what i should do. I also tried to subclass Element but i cannot fathom how caps negotiations works and it always fail with a « non negotiated » error. I listened to queries and put a method like this : def _src_query(self, pad, parent, query): but i have no idea what i should do in there so the next element accept my source pad. Checking the C code for BaseTransform is way too complicated, after all my plugin used fixed caps since it only support RGB frame on its sink. Version for gstreamer is 1.12.3 and it is installed on OSX using brew. Python is 3.6 I’ve been stuck on this for a week now and i don’t really know what to do. I could abandon Python and write everything in C but that would require all my frame processing code to be rewritten in C as well which i would rather avoid. I would be very grateful for any insight. Thanks gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |