@@ -0,0 +1,1964 @@
+#!/usr/bin/env python%0A%0A%22%22%22%0AThis module sets up a video stream from internal or connected webcam using Gstreamer.%0AYou can then take snapshots.%0A%0Aimport qrtools%0Aqr = qrtools.QR()%0Aqr.decode(%22cam.jpg%22)%0Aprint qr.data%0A%0A%22%22%22%0Aimport gi%0Agi.require_version('Gtk', '3.0')%0Agi.require_version('Gst', '1.0')%0Afrom gi.repository import Gtk as gtk%0Afrom gi.repository import Gdk%0Afrom gi.repository import Gst as gst%0Afrom gi.repository import GdkPixbuf%0A%0Afrom avocado import Test%0Afrom os.path import exists, relpath%0Aimport qrtools%0Aimport time%0A%0A#import pyqrcode%0A%0Aclass WebcamReadQR(Test):    %0A    def setUp(self):%0A        # if not exists('/dev/video0'):%0A            # self.skip(%22No webcam detected: /dev/video0 cannot be found%22);%0A        self.device = '/dev/video0'%0A        %0A        Gdk.threads_init()%0A        gtk.main()%0A        self.take_snapshot()%0A%0A    def test(self):%0A        self.create_video_pipeline()%0A       %0A    def create_video_pipeline(self):%0A        gst.init(%5B%5D)%0A        #v4l2src%0A        self.video_player = gst.parse_launch(%22videotestsrc ! jpegenc ! filesink location=cam.jpg%22)%0A        self.video_player.set_state(gst.State.PLAYING)%0A        %0A        bus = self.video_player.get_bus()%0A        bus.add_signal_watch()%0A        bus.connect(%22message%22, self.on_message)%0A        bus.enable_sync_message_emission()%0A        bus.connect(%22sync-message::element%22, self.on_sync_message)        %0A%0A    def on_message(self, bus, message):%0A        t = message.type%0A        if t == gst.MessageType.EOS:%0A            self.exit()%0A        elif t == gst.MessageType.ERROR:%0A            self.exit()%0A            self.fail(%22Error %7B0%7D%22.format(message.parse_error()))%0A%0A    def on_sync_message(self, bus, message):%0A        if message.structure is None:%0A            return%0A        message_name = message.structure.get_name()%0A                   %0A    def exit(self):%0A        self.video_player.set_state(gst.State.NULL) %0A        gtk.main_quit()%0A        %0A    def take_snapshot(self):%0A        #TODO:fill this in%0A

Put gst code into Avocado test format. Needs to be edited to take a snapshot and read the qr code.