コード例 #1
0
    public void Update(bool force)
    {
        bool isConnected = AVProLiveCameraPlugin.IsDeviceConnected(_deviceIndex);

        // If there is a change in the connection
        if (IsConnected != isConnected)
        {
            if (!isConnected)
            {
                Debug.Log("[AVProLiveCamera] device #" + _deviceIndex + " '" + Name + "' disconnected");
                Pause();
            }
            else
            {
                Debug.Log("[AVProLiveCamera] device #" + _deviceIndex + " '" + Name + "' reconnected");
                if (IsRunning)
                {
                    Start(_lastModeIndex, _lastVideoInputIndex);
                }
            }

            IsConnected = isConnected;
        }

        if (IsRunning)
        {
            bool ready = false;
#if AVPRO_UNITY_4_X
            ready = true;
#else
            if (!force)
            {
                ready = AVProLiveCameraPlugin.IsNextFrameReadyForGrab(_deviceIndex);
            }
#endif

            if (ready || force)
            {
                if (_formatConverter != null)
                {
                    if (_formatConverter.Update())
                    {
                        UpdateDisplayFPS();
                    }
                }
            }

            CaptureFPS           = AVProLiveCameraPlugin.GetCaptureFrameRate(_deviceIndex);
            CaptureFramesDropped = AVProLiveCameraPlugin.GetCaptureFramesDropped(_deviceIndex);
        }
    }
コード例 #2
0
 private void Update_FrameRates()
 {
     CaptureFPS           = AVProLiveCameraPlugin.GetCaptureFrameRate(_deviceIndex);
     CaptureFramesDropped = AVProLiveCameraPlugin.GetCaptureFramesDropped(_deviceIndex);
 }