private int InitCameraDevice(int camera)
 {
     if (VuforiaRuntimeUtilities.IsPlayMode())
     {
         int result = 0;
         try
         {
             WebCamARController expr_0E = WebCamARController.Instance;
             expr_0E.InitCamera();
             CameraDeviceImpl.mWebCam = expr_0E.ImplementationClass;
             VuforiaRenderer.Vec2I resampledTextureSize = CameraDeviceImpl.mWebCam.ResampledTextureSize;
             if (resampledTextureSize.y != 0)
             {
                 VuforiaWrapper.Instance.CameraDeviceSetCameraConfiguration(resampledTextureSize.x, resampledTextureSize.y);
             }
             result = 1;
         }
         catch (NullReferenceException arg_4B_0)
         {
             Debug.LogError(arg_4B_0.Message);
         }
         VuforiaWrapper.Instance.CameraDeviceInitCamera(camera);
         this.mCameraImages.Clear();
         return(result);
     }
     return(VuforiaWrapper.Instance.CameraDeviceInitCamera(camera));
 }
Exemple #2
0
        public bool Start(IWebCam webCam, WebCamFrameEventHandler newFrameCallback)
        {
            lock (_objSync)
            {
                AssertDisposed();

                VideoCaptureDevice vcd;
                if (webCam == null || _capturingCams.TryGetValue(webCam, out vcd))
                {
                    return(false);
                }

                vcd           = new VideoCaptureDevice(((WebCam)webCam).CamId);
                vcd.NewFrame += (sender, args) =>
                {
                    newFrameCallback?.Invoke(webCam, args.Frame);
                };
                vcd.VideoResolution = vcd.VideoCapabilities.FirstOrDefault(vc => webCam.FrameSize.Equals(vc.FrameSize));
                vcd.Start();

                _capturingCams.Add(webCam, vcd);

                return(true);
            }
        }
Exemple #3
0
 private void button5_Click(object sender, EventArgs e)
 {
     if (webCam == null)
     {
         webCam = new IWebCam(this.Handle);
         timer1.Start();
     }
 }
Exemple #4
0
        public bool Stop(IWebCam webCam)
        {
            lock (_objSync)
            {
                AssertDisposed();

                if (InternalStop(webCam))
                {
                    _capturingCams.Remove(webCam);
                    return(true);
                }

                return(false);
            }
        }
Exemple #5
0
        private bool InternalStop(IWebCam webCam)
        {
            VideoCaptureDevice vcd;

            if (webCam == null || !_capturingCams.TryGetValue(webCam, out vcd))
            {
                return(false);
            }

            if (vcd.IsRunning)
            {
                vcd.SignalToStop();
                vcd.WaitForStop();
            }

            return(true);
        }
Exemple #6
0
 private void button2_Click_1(object sender, EventArgs e)
 {
     if (webCam == null || live == false)
     {
         codec  = new MicrosoftAdpcmChatCodec();
         webCam = new IWebCam(this.Handle);
         live   = true;
         timer1.Start();
         btnLiveStreaming.Text = "Stop";
         connectLiveAudio(0, codec);
         btnLive.BackColor = Color.Red;
     }
     else
     {
         socket.Emit("stop streaming", "");
         btnLive.BackColor = Color.Gray;
         disconnectLiveAudio();
         disconnectVideo();
     }
 }
Exemple #7
0
        public bool SetFrameSize(IWebCam webCam, FrameSize size)
        {
            lock (_objSync)
            {
                AssertDisposed();

                if (webCam == null)
                {
                    return(false);
                }

                ((WebCam)webCam).FrameSize = size;

                VideoCaptureDevice vcd;
                if (_capturingCams.TryGetValue(webCam, out vcd))
                {
                    vcd.VideoResolution = vcd.VideoCapabilities.FirstOrDefault(vc => size.Equals(vc.FrameSize));
                }

                return(true);
            }
        }
Exemple #8
0
        public bool IsStarted(IWebCam webCam)
        {
            VideoCaptureDevice vdc;

            return(webCam != null && _capturingCams.TryGetValue(webCam, out vdc) && vdc.IsRunning);
        }