protected override void SetupCommandBuffer(RenderTexture renderTexture)
            {
#if CAPTURE_ACTION
                CameraCaptureBridge.AddCaptureAction(targetCamera, AddCaptureCommands);
#else
                CameraCapture.AddCaptureAction(targetCamera, AddCaptureCommands);
#endif
            }
Example #2
0
 private void OnEnable()
 {
     if (targetCamera)
     {
         CameraCaptureBridge.AddCaptureAction(targetCamera, AddCaptureCommands);
     }
     else
     {
         Debug.Log("CameraGrab WARNING MISSING camera ");
     }
 }
Example #3
0
        // Reset the component state without disposing the NDI send object.
        internal void ResetState(bool willBeActive)
        {
            // Disable the subcomponents.
            StopAllCoroutines();

            //
            // Remove the capture callback from the camera.
            //
            // NOTE: We're not able to remove the capture callback correcly when
            // the camera has been destroyed because we end up with getting a null
            // reference from _attachedCamera. To avoid causing issues in the
            // callback, we make sure that _attachedCamera has a null reference.
            //
            if (_attachedCamera != null)
            {
        #if KLAK_NDI_HAS_SRP
                CameraCaptureBridge.RemoveCaptureAction
                    (_attachedCamera, OnCameraCapture);
        #endif
            }

            _attachedCamera = null;

            frameRateND = Util.FrameRateND(_frameRate);

            // The following blocks are to activate the subcomponents.
            // We can return here if willBeActive is false.
            if (!willBeActive)
            {
                return;
            }

            if (_captureMethod == CaptureMethod.Camera)
            {
                // Enable the camera capture callback.
                if (_sourceCamera != null)
                {
                    _attachedCamera = _sourceCamera;
            #if KLAK_NDI_HAS_SRP
                    CameraCaptureBridge.AddCaptureAction
                        (_attachedCamera, OnCameraCapture);
            #endif
                }
            }
            else
            {
                // Enable the immediate capture coroutine.
                StartCoroutine(ImmediateCaptureCoroutine());
            }
        }
Example #4
0
        // Component state reset without NDI object disposal
        internal void ResetState(bool willBeActive)
        {
            // Camera capture coroutine termination
            // We use this to kill only a single coroutine. It may sound like
            // overkill, but I think there is no side effect in doing so.
            StopAllCoroutines();

        #if KLAK_NDI_HAS_SRP
            // A SRP may call this callback after camera destruction. We can
            // exclude those cases by null-checking _attachedCamera.
            if (_attachedCamera != null)
            {
                CameraCaptureBridge.RemoveCaptureAction(_attachedCamera, OnCameraCapture);
            }
        #endif

            _attachedCamera = null;

            // The following part of code is to activate the subcomponents. We can
            // break here if willBeActive is false.
            if (!willBeActive)
            {
                return;
            }

            if (captureMethod == CaptureMethod.Camera)
            {
            #if KLAK_NDI_HAS_SRP
                // Camera capture callback setup
                if (sourceCamera != null)
                {
                    CameraCaptureBridge.AddCaptureAction(sourceCamera, OnCameraCapture);
                }
            #endif

                _attachedCamera = sourceCamera;
            }
            else
            {
                // Capture coroutine initiation
                StartCoroutine(CaptureCoroutine());
            }
        }
Example #5
0
        void PrepareCameraCapture(Camera target)
        {
            // If it has been attached to another camera, detach it first.
            if (_attachedCamera != null && _attachedCamera != target)
            {
            #if KLAK_SPOUT_HAS_SRP
                CameraCaptureBridge
                .RemoveCaptureAction(_attachedCamera, OnCameraCapture);
            #endif
                _attachedCamera = null;
            }

            // Attach to the target if it hasn't been attached yet.
            if (_attachedCamera == null && target != null)
            {
            #if KLAK_SPOUT_HAS_SRP
                CameraCaptureBridge
                .AddCaptureAction(target, OnCameraCapture);
            #endif
                _attachedCamera = target;
            }
        }
        private void RefreshOutputType()
        {
            KillCaptures();

            switch (outputType)
            {
            case SendTechnique.NDI:
                if (ndiAction != null)
                {
                    ndiSender.Setup(gameObject.name);
                    CameraCaptureBridge.AddCaptureAction(GetComponent <Camera>(), ndiAction);
                }

                break;

            case SendTechnique.SyphonSpout:
                if (syphonSpoutAction != null)
                {
                    syphonSpoutSender.Setup(gameObject.name);
                    CameraCaptureBridge.AddCaptureAction(GetComponent <Camera>(), syphonSpoutAction);
                }
                break;
            }
        }
Example #7
0
 void OnEnable()
 {
     m_Camera = GetComponent <Camera>();
     CameraCaptureBridge.AddCaptureAction(m_Camera, Capture);
 }