[gst-devel] Speed up my converter (gst-python)
Fredrik Persson
frepe at bredband.net
Sat Oct 21 11:10:10 CEST 2006
Hi!
I've written this class that takes a gst.Buffer and a gtk.Image and
displays the buffer in the gtk.Image. This is meant to be used as a
screenshot function.
But it's slow! It takes more than a second from the moment I click my
snapshot button in my gui to the moment when I see the image displayed.
I've measured this thing and it seems that it takes almost a full second
from the when I start the pipeline (self.ss_pipeline.set_state
(gst.STATE_PLAYING) ) until I reach my handoff callback,
__sinkHandoffHandler__.
Any ideas on how to speed this up is appreciated, thanks!
/Fredrik
class SnapshotCreatorAndSetInImagearea(threading.Thread):
def run(self,buffer,imagearea):
self.imagearea = imagearea
self.src = MyInjectorSrcBuffer2Pixbuf("injector_src",buffer)
self.csp = gst.element_factory_make("ffmpegcolorspace")
self.caps = gst.element_factory_make("capsfilter")
self.sink = gst.element_factory_make("fakesink")
self.caps.set_property('caps',gst.caps_from_string('video/x-raw-rgb,bpp=24,depth=24,endianness=BIG_ENDIAN,red_mask=0xff0000,green_mask=0x00ff00,blue_mask=0x0000ff'))
self.ss_pipeline = gst.Pipeline()
self.ss_pipeline.add(self.src,self.csp,self.caps,self.sink)
self.src.link(self.csp)
self.csp.link(self.caps)
self.caps.link(self.sink)
self.sink.set_property('signal-handoffs',True)
self.sink.set_property('preroll-queue-len',1)
self.sink.connect('handoff',self.__sinkHandoffHandler__)
self.ss_pipeline.set_state (gst.STATE_PLAYING)
def __sinkHandoffHandler__(self,element,buffer,pad):
gtk.threads_enter()
self.imagearea.set_from_pixbuf(gtk.gdk.pixbuf_new_from_data(buffer.data,gtk.gdk.COLORSPACE_RGB,False,8,buffer.get_caps()[0]["width"],buffer.get_caps()[0]["height"],buffer.get_caps()[0]["width"]*3))
gtk.threads_leave()
return True
More information about the gstreamer-devel
mailing list