[gst-devel] Speed up my converter (gst-python)

Fredrik Persson frepe at bredband.net
Sun Oct 22 11:47:31 CEST 2006


Yes, I am using a gtk.main() and I am not polling the bus.

I have tried with gobject.threads_init() at the beginning of my code, as
you suggest. But for some reason, if I don't do the gtk.threads_*
things, my GUI freezes up when click the button that uses this
converter, so the gtk.threads_* is needed here.

/Fredrik

On Sun, 2006-10-22 at 11:37 +0200, Edward Hervey wrote:
> Hi,
> 
>   Are you using a mainloop ? Or are you polling the bus ? Also,
> gtk.threads_* is a tricky way of handling threads. You should remove
> those and rather use at the beginning of your code:
>   import gobject
>   gobjec.threads_init()
>   import pygst
>   ....
> 
> On 10/21/06, Fredrik Persson <frepe at bredband.net> wrote:
> > 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
> >
> > -------------------------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > _______________________________________________
> > gstreamer-devel mailing list
> > gstreamer-devel at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> >
> 
> 




More information about the gstreamer-devel mailing list