Example #1
0
    public bool StartCapture()
    {
        if (_capturing)
        {
            return(false);
        }

        if (_handle < 0)
        {
            if (!PrepareCapture())
            {
                return(false);
            }
        }

        if (_handle >= 0)
        {
            if (_audioCapture && _audioDeviceIndex < 0 && !_noAudio)
            {
                _audioCapture.FlushBuffer();
            }

            AVProMovieCapturePlugin.Start(_handle);
            ResetFPS();
            _capturing = true;
            _paused    = false;
        }

        if (_startPaused)
        {
            PauseCapture();
        }

        return(_capturing);
    }
 public virtual void EncodePointer(System.IntPtr ptr)
 {
     if (_audioCapture == null || (_audioDeviceIndex >= 0 || _noAudio))
     {
         AVProMovieCapturePlugin.EncodeFrame(_handle, ptr);
     }
     else
     {
         AVProMovieCapturePlugin.EncodeFrameWithAudio(_handle, ptr, _audioCapture.BufferPtr, (uint)_audioCapture.BufferLength);
         _audioCapture.FlushBuffer();
     }
 }
    protected void EncodeTexture(Texture2D texture)
    {
        Color32[] bytes        = texture.GetPixels32();
        GCHandle  _frameHandle = GCHandle.Alloc(bytes, GCHandleType.Pinned);

        if (_audioCapture == null || (_audioDeviceIndex >= 0 || _noAudio))
        {
            AVProMovieCapturePlugin.EncodeFrame(_handle, _frameHandle.AddrOfPinnedObject());
        }
        else
        {
            AVProMovieCapturePlugin.EncodeFrameWithAudio(_handle, _frameHandle.AddrOfPinnedObject(), _audioCapture.BufferPtr, (uint)_audioCapture.BufferLength);
            _audioCapture.FlushBuffer();
        }

        if (_frameHandle.IsAllocated)
        {
            _frameHandle.Free();
        }
    }