write a python source plugin?
Mathias.Franzius at honda-ri.de
Tue Jul 12 07:07:05 PDT 2011
First, thanks for the constructive comments.
I'm still busy writing my data source in python but the easiest way I have
come across is to extend the videotestsource. Problem was that I cannot
directly subclass it (not wrapped in python?) so I instantiated
videotestsrc via gst.element_factory_make, got its type and extended this:
xxx = gst.element_factory_make("videotestsrc", "video-source")
xclass = type(xxx)
Then, I can change the part where the data is actually created:
def do_create(self, offset, length):
try: self._cnt; # i have no custom constructor, so I have to test if
its here already
except: self._cnt = 100; self.tic = time.time() # no, instantiate
origOutStat, origOutBuf = xclass.do_create(self, offset, length)
#parent output (videotestsrc)
dat = scipy.zeros(len(origOutBuf),'uint8') # my dummy output for
dat[:] = self._cnt # set to oscillating color, so we see something
buf = gst.Buffer(dat.ravel()) # overwrite buffer
return gst.FLOW_OK, buf
and register it:
gst.element_register(yyy, 'yyy', gst.RANK_MARGINAL)
This is rather ugly, but I think I can work my way on from here.
Concerning the "why python" question:
The comments in the posting above are all correct, additionally it depends
of course on my infrastructure. The data source that generates my images
happens to be in python, so it is the easiest way to stay within python.
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/write-a-python-source-plugin-tp3651443p3662390.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel