def f(): if self.vid_fd >= 0: try: val = int(self.ctrls[name].text()) except ValueError: pass else: print '%s changed => %d' % (name, val) ctrl_set(self.vid_fd, name, val)
def v4l_updated(self): for k, v in self.v4ls.iteritems(): try: val = int(str(v.text())) except ValueError: continue if k == 'E': val = min(val, 800) else: val = min(val, 1023) ctrl_set(self.vid_fd, k, val)
def v4l_load(self): vconfig = uconfig["imager"].get("v4l2", None) if not vconfig: return for configk, configv in vconfig.iteritems(): break #if type(configv) != dict or '"Gain"' not in configv: # raise Exception("Bad v4l default config (old style?)") print 'Selected config %s' % configk for k, v in configv.iteritems(): if k in self.ctrls: self.ctrls[k].setText(str(v)) else: ctrl_set(self.vid_fd, k, v)
def on_message(self, bus, message): t = message.type if self.vid_fd is not None and self.vid_fd < 0: self.vid_fd = self.source.get_property("device-fd") if self.vid_fd >= 0: print 'Initializing V4L controls' for k, v in uconfig["imager"].get("v4l2", {}).iteritems(): ctrl_set(self.vid_fd, k, v) if t == gst.MESSAGE_EOS: self.player.set_state(gst.STATE_NULL) print "End of stream" elif t == gst.MESSAGE_ERROR: err, debug = message.parse_error() print "Error: %s" % err, debug self.player.set_state(gst.STATE_NULL)
def v4l_load(self): from config import get_config uconfig = get_config() vconfig = uconfig["imager"].get("v4l2", None) if not vconfig: return for configk, configv in vconfig.iteritems(): break #if type(configv) != dict or '"Gain"' not in configv: # raise Exception("Bad v4l default config (old style?)") print 'Selected config %s' % configk for k, v in configv.iteritems(): if k in self.v4ls: self.v4ls[k].setText(str(v)) else: ctrl_set(self.vid_fd, k, v)
def f(): if self.vid_fd >= 0: val = int(self.ctrls[name].text()) print '%s changed => %d' % (name, val) ctrl_set(self.vid_fd, name, val)
def v4l_load(self): for k, v in uconfig.iteritems(): print '%s => %s' % (k, v) ctrl_set(self.vid_fd, k, v)