[Sugar-devel] getting image from gStreamer

Puneet Kaur puneet.gkaur at gmail.com
Sun Jul 20 16:37:15 EDT 2014


Hey all,

I was able to get the webcam stream using gStreamer through this :

        self.src = Gst.ElementFactory.make('autovideosrc', None)
        self.sink = Gst.ElementFactory.make('autovideosink', None)

        (and more related corde...)


but how to modify in order to store the image (on click) to a file / buffer
?

I tried :

1)     gdk_display = GdkX11.X11Display.get_default()
        gdk_window =
GdkX11.X11Window.foreign_new_for_display(gdk_display,self.xid)



        width = gdk_window.get_width()
        height = gdk_window.get_height()

        ims = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)

        pb = Gdk.pixbuf_get_from_window(gdk_window, 0, 0, width, height)

        cr = cairo.Context(ims)
        Gdk.cairo_set_source_pixbuf(cr, pb, 0, 0)
        cr.paint()


2)
        pix = Gdk.pixbuf_get_from_window(self.get_window(),0,
0,self.get_window().get_width(),self.get_window().get_height())

        pix.savev('/home/broot/sugar-build/testimage.jpeg', 'jpeg', [], [])








but things dont seem to work.I see a black image in my disk :-(


Any idea ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20140721/09c89755/attachment-0001.html>


More information about the Sugar-devel mailing list