Initialize webcam device.
426286
private synchronized void init() {

		if (!initialized.compareAndSet(false, true)) {
			return;
		}

		LOG.debug("GStreamer webcam device initialization");

		pipe = new Pipeline(getName());
		source = ElementFactory.make(GStreamerDriver.getSourceBySystem(), "source");

		if (Platform.isWindows()) {
			source.set("device-index", deviceIndex);
		} else if (Platform.isLinux()) {
			source.set("device", videoFile.getAbsolutePath());
		} else if (Platform.isMacOSX()) {
			throw new IllegalStateException("not yet implemented");
		}

		sink = new RGBDataSink(getName(), this);
		sink.setPassDirectBuffer(true);
		sink.getSinkElement().setMaximumLateness(LATENESS, TimeUnit.MILLISECONDS);
		sink.getSinkElement().setQOSEnabled(true);

		filter = ElementFactory.make("capsfilter", "capsfilter");

		jpegdec = ElementFactory.make("jpegdec", "jpegdec");

		pipelineReady();
		resolutions = parseResolutions(source.getPads().get(0));
		pipelineStop();
	}
341835
function () {
            var self = this;

            // add all defined cameras
            this.settings.cameras.forEach(function(camera) {
                self.cameras.set(camera.name, camera);
            });

            // empty or no default camera
            if (this.cameras.has("default") === false) {
                if (typeof default_camera === "undefined") {
                    var width = me.video.renderer.getWidth();
                    var height = me.video.renderer.getHeight();
                    // new default camera instance
                    default_camera = new me.Camera2d(0, 0, width, height);
                }
                this.cameras.set("default", default_camera);
            }

            // reset the game manager
            me.game.reset();

            // call the onReset Function
            this.onResetEvent.apply(this, arguments);
        }
1064159
private function init()
    {
        if ($this->encoder === null) {
            // Send the adapter config as JSON payload to the host
            $config = new AdapterConfig(
                $this->codec->getName(),
                $this->getAdapterType(),
                $this->getExtraConfig()
            );
            Codecs::json()->newEncoder($this->output)->useNewlines(false)->encode($config);

            // Set up encoder / decoder for further communication
            $this->decoder = $this->codec->newDecoder($this->input);
            $this->encoder = $this->codec->newEncoder($this->output);
        }
    }
242138
public synchronized void initDevice() {
        MDC.setContextMap(contextMap);
        xlogger.entry();
        if (stateImpl == null) {
            stateImpl = new StateImpl(businessObject, null, null);
        }
        if (statusImpl == null) {
            statusImpl = new StatusImpl(businessObject, null, null);
        }
        if (initImpl == null) {
            buildInit(null, false);
        }
        doInit();
        try {
            pushInterfaceChangeEvent(true);
        } catch (final DevFailed e) {
            // ignore
            logger.error("error pushing event", e);
        }
        logger.debug("device init done");
        xlogger.exit();
    }
12693
def init(self):
        """"""
        self.debug('Initializing %r', self)
        proto = self.server.split('://')[0]

        if proto == 'https':
            if hasattr(ssl, 'create_default_context'):
                context = ssl.create_default_context()

                if self.ssl_verify:
                    context.check_hostname = True
                    context.verify_mode = ssl.CERT_REQUIRED
                else:
                    context.check_hostname = False
                    context.verify_mode = ssl.CERT_NONE

                self._http_handler = urllib2.HTTPSHandler(debuglevel=0, context=context)
            else:
                self._http_handler = urllib2.HTTPSHandler(debuglevel=0)
        elif proto == 'http':
            self._http_handler = urllib2.HTTPHandler(debuglevel=0)
        else:
            raise ValueError('Invalid protocol %s' % proto)

        self._api_url = self.server + '/api_jsonrpc.php'
        self._http_headers = {
            'Content-Type': 'application/json-rpc',
            'User-Agent': 'python/zabbix_api',
        }

        if self.httpuser:
            self.debug('HTTP authentication enabled')
            auth = self.httpuser + ':' + self.httppasswd
            self._http_headers['Authorization'] = 'Basic ' + b64encode(auth.encode('utf-8')).decode('ascii')
460712
def start(self):
        
        running = self._webcam.start()
        if not running:
            return running

        running &= self._phoxi.start()
        if not running:
            self._webcam.stop()
        return running
1014693
def init_device(self):
        
        try:
            product_id = int(self._send_command('_d2', 1))
        except ValueError:
            product_id = self._send_command('_d2', 1)

        if product_id == 0:
            self._impl = ResponseDevice(
                self.con,
                'Cedrus Lumina LP-400 Response Pad System',
                lumina_keymap)
        elif product_id == 1:
            self._impl = ResponseDevice(
                self.con,
                'Cedrus SV-1 Voice Key',
                None,
                'Voice Response')
        elif product_id == 2:
            model_id = int(self._send_command('_d3', 1))
            if model_id == 1:
                self._impl = ResponseDevice(
                    self.con,
                    'Cedrus RB-530',
                    rb_530_keymap)
            elif model_id == 2:
                self._impl = ResponseDevice(
                    self.con,
                    'Cedrus RB-730',
                    rb_730_keymap)
            elif model_id == 3:
                self._impl = ResponseDevice(
                    self.con,
                    'Cedrus RB-830',
                    rb_830_keymap)
            elif model_id == 4:
                self._impl = ResponseDevice(
                    self.con,
                    'Cedrus RB-834',
                    rb_834_keymap)
            else:
                raise XidError('Unknown RB Device')
        elif product_id == 4:
            self._impl = StimTracker(
                self.con,
                'Cedrus C-POD')
        elif product_id == b'S':
            self._impl = StimTracker(
                self.con,
                'Cedrus StimTracker')

        elif product_id == -99:
            raise XidError('Invalid XID device')
866898
def _init_browser(self):
        """"""
        self.browser = splinter.Browser('phantomjs')
        self.browser.visit(self.server_url + "/youraccount/login")
        try:
            self.browser.fill('nickname', self.user)
            self.browser.fill('password', self.password)
        except:
            self.browser.fill('p_un', self.user)
            self.browser.fill('p_pw', self.password)
        self.browser.fill('login_method', self.login_method)
        self.browser.find_by_css('input[type=submit]').click()
1114610
def start(self):
        
        self._sensor = cv2.VideoCapture(self._device_id)
        if not self._sensor.isOpened():
            raise Exception("Unable to open OpenCVCameraSensor for id {0}".format(self._device_id))
        self.flush()
1204174
@Override
    public void webcamFound(WebcamDiscoveryEvent event) {
        Webcam webcam = event.getWebcam();
        LOG.debug("Discovered webcam : {}", webcam.getDevice().getName());

        webcams.put(webcam.getDevice().getName(), webcam);
    }
438303
def init_loopback(self, data):
        """"""
        self.name = data["name"]
        self.description = data['description']
        self.win_index = data['win_index']
        self.mac = data["mac"]
        self.guid = data["guid"]
        self.ip = "127.0.0.1"
739548
def init_device(**kwargs):
    
    new_device = OCLDevice(**kwargs)

    # just change globals if new_device is different from old
    if _ocl_globals.device.device != new_device.device:
        _ocl_globals.device = new_device
622093
def set_camera(self, camera_id):
        
        self.viewer.cam.fixedcamid = camera_id
        self.viewer.cam.type = const.CAMERA_FIXED
44700
public void setCamera() {
		glu.gluLookAt(width / 2.0, height / 2.0,
				(height / 2.0) / Math.tan(Math.PI * 60.0 / 360.0), width / 2.0,
				height / 2.0, 0, 0, 1, 0);
	}
32269
public void start() {

		// if configured to not start, then simply return

		if (!enabled.get()) {
			LOG.info("Discovery service has been disabled and thus it will not be started");
			return;
		}

		// capture driver does not support discovery - nothing to do

		if (support == null) {
			LOG.info("Discovery will not run - driver {} does not support this feature", driver.getClass().getSimpleName());
			return;
		}

		// return if already running

		if (!running.compareAndSet(false, true)) {
			return;
		}

		// start discovery service runner

		runner = new Thread(this, "webcam-discovery-service");
		runner.setUncaughtExceptionHandler(WebcamExceptionHandler.getInstance());
		runner.setDaemon(true);
		runner.start();
	}
187383
def initialize(self):
        """"""
        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
        QApplication.processEvents()
        self.start_server()
753449
def _post_init(self):
        """"""
        if WIN:
            self._find_devices_win()
        elif MAC:
            self._find_devices_mac()
        else:
            self._find_devices()
        self._update_all_devices()
        if NIX:
            self._find_leds()