Records a video from the web camera directly to disk.

Inheritance: IDisposable
Exemplo n.º 1
0
        /**
         * Use this for initialization.
         */
        private void Start()
        {
            // Variable initialization
            this.ShouldCapture      = false;
            this.videoCaptureObject = null;
            this.tryStartRecording  = false;
            this.tryStopRecording   = false;
            this.isRecording        = false;
            this.tryStartVideoMode  = false;
            this.CaptureStarted     = false;
            this.disposeAction      = null;
            this.namingIndex        = 0;

            // Get reference to other scripts in the scene
            this.logger = DebugLogger.Instance;

            // Deactivate this script if necessary components are missing
            if (this.logger == null)
            {
                Debug.LogError("VideoCapture: Script references not set properly.");
                this.enabled = false;
                return;
            }

            // Set camera parameters and create a MR-VideoCapture object
            this.cameraParameters = new MRC.CameraParameters {
                hologramOpacity        = 1.0f,
                frameRate              = this.VideoFramerate,
                cameraResolutionWidth  = this.VideoResolution.width,
                cameraResolutionHeight = this.VideoResolution.height,
                pixelFormat            = MRC.CapturePixelFormat.BGRA32
            };
            MRC.VideoCapture.CreateAsync(true, this.OnVideoCaptureCreated);
        }
Exemplo n.º 2
0
 /**
  * Callback method that is called after the MR-VideoCapture object has been created.
  *
  * @param captureObject reference to MR-VideoCapture
  */
 private void OnVideoCaptureCreated(MRC.VideoCapture captureObject)
 {
     // Save the current capture object
     if (captureObject != null)
     {
         this.videoCaptureObject = captureObject;
     }
     else
     {
         this.logger.Log("Failed to create MR-VideoCapture instance.");
     }
 }
Exemplo n.º 3
0
 /**
  * This method disposes of the inactive capturing object.
  */
 public void DisposeInactive()
 {
     this.logger.Log("Video capture object disposed.");
     this.videoCaptureObject.Dispose();
     this.videoCaptureObject = null;
 }
Exemplo n.º 4
0
 public IntPtr GetUnsafePointerToVideoDeviceController()
 {
     return(VideoCapture.GetUnsafePointerToVideoDeviceController_Internal(this.m_NativePtr));
 }
Exemplo n.º 5
0
 private static void InvokeOnStoppedRecordingVideoToDiskDelegate(VideoCapture.OnStoppedRecordingVideoCallback callback, long hResult)
 {
     callback(VideoCapture.MakeCaptureResult(hResult));
 }
Exemplo n.º 6
0
 private static void InvokeOnVideoModeStoppedDelegate(VideoCapture.OnVideoModeStoppedCallback callback, long hResult)
 {
     callback(VideoCapture.MakeCaptureResult(hResult));
 }
Exemplo n.º 7
0
 public static IEnumerable <float> GetSupportedFrameRatesForResolution(Resolution resolution)
 {
     return(VideoCapture.GetSupportedFrameRatesForResolution_Internal(resolution.width, resolution.height));
 }