<div dir="ltr">Hey all,<div><br></div><div>I was able to get the webcam stream using gStreamer through this :</div><div><br></div><div><div> self.src = Gst.ElementFactory.make('autovideosrc', None)</div><div>
self.sink = Gst.ElementFactory.make('autovideosink', None)</div></div><div><br></div><div> (and more related corde...)</div><div><br></div><div><br></div><div>but how to modify in order to store the image (on click) to a file / buffer ?</div>
<div><br></div><div>I tried : </div><div><br></div><div>1) gdk_display = GdkX11.X11Display.get_default()</div><div> gdk_window = GdkX11.X11Window.foreign_new_for_display(gdk_display,self.xid)</div><div><br></div>
<div> </div><div><br></div><div> width = gdk_window.get_width()</div><div> height = gdk_window.get_height() </div><div> </div><div> ims = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height) </div>
<div> pb = Gdk.pixbuf_get_from_window(gdk_window, 0, 0, width, height)</div><div> </div><div> cr = cairo.Context(ims) </div><div> Gdk.cairo_set_source_pixbuf(cr, pb, 0, 0) </div><div> cr.paint()</div>
<div><br></div><div><br></div><div>2)</div><div> pix = Gdk.pixbuf_get_from_window(self.get_window(),0, 0,self.get_window().get_width(),self.get_window().get_height())</div><div><br></div><div> pix.savev('/home/broot/sugar-build/testimage.jpeg', 'jpeg', [], [])</div>
<div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div>but things dont seem to work.I see a black image in my disk :-(</div><div><br></div><div><br></div>
<div>Any idea ?</div></div>