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 void StartCapture() { if (_capturing) { return; } if (_handle < 0) { PrepareCapture(); } if (_audioCapture && _audioDeviceIndex < 0 && !_noAudio) { _audioCapture.FlushBuffer(); _audioCapture.enabled = true; } if (_handle >= 0) { AVProMovieCapturePlugin.Start(_handle); ResetFPS(); _capturing = true; _paused = false; } }
public void ResumeCapture() { if (_capturing && _paused) { AVProMovieCapturePlugin.Start(_handle); _paused = false; } }
public void ResumeCapture() { if (_capturing && _paused) { if (_audioCapture && _audioDeviceIndex < 0 && !_noAudio) { _audioCapture.FlushBuffer(); } AVProMovieCapturePlugin.Start(_handle); _paused = false; } }
public void CreateVideoFromByteArray(string filePath, int width, int height, int frameRate) { byte[] frameData = new byte[width * height * 4]; GCHandle frameHandle = GCHandle.Alloc(frameData, GCHandleType.Pinned); // Start the recording session int encoderHandle = AVProMovieCapturePlugin.CreateRecorderAVI(filePath, (uint)width, (uint)height, frameRate, (int)AVProMovieCapturePlugin.PixelFormat.RGBA32, false, _videoCodecIndex, false, 0, 0, -1, -1, false, false, false); if (encoderHandle >= 0) { AVProMovieCapturePlugin.Start(encoderHandle); // Write out 100 frames int numFrames = 100; for (int i = 0; i < numFrames; i++) { // TODO: update the byte array with your data :) // Wait for the encoder to be ready for the next frame int numAttempts = 32; while (numAttempts > 0) { if (AVProMovieCapturePlugin.IsNewFrameDue(encoderHandle)) { // Encode the new frame AVProMovieCapturePlugin.EncodeFrame(encoderHandle, frameHandle.AddrOfPinnedObject()); break; } System.Threading.Thread.Sleep(1); numAttempts--; } } // End the session AVProMovieCapturePlugin.Stop(encoderHandle, false); AVProMovieCapturePlugin.FreeRecorder(encoderHandle); } if (frameHandle.IsAllocated) { frameHandle.Free(); } }