public void OpenCamera(SystemCamera camera) { underlyingPlayer.StartCapture(camera); var newPlayback = new CapturePlayback(device, imagingFactory, underlyingPlayer); playbackSubject.OnNext(newPlayback); currentPlayback?.Dispose(); currentPlayback = newPlayback; }
partial void StartCaptureCore(SystemCamera camera, CancellationToken token) { using (var deviceAttributes = new MediaAttributes(2)) { deviceAttributes.Set(CaptureDeviceAttributeKeys.SourceType, CaptureDeviceAttributeKeys.SourceTypeVideoCapture.Guid); deviceAttributes.Set(CaptureDeviceAttributeKeys.SourceTypeVidcapSymbolicLink, camera.SystemIdentifier); MediaFactory.CreateDeviceSource(deviceAttributes, out MediaSource videoSource); using (videoSource) { var captureEngine = new CaptureEngine(captureFactory); captureEngine.CaptureEngineEvent += evt => OnEngineEvent(captureEngine, evt); captureEngine.Initialize(captureEngineAttributes, null, videoSource); } } }
partial void StartCaptureCore(SystemCamera camera, CancellationToken token);
public void StartCapture(SystemCamera camera) { tokenSource?.Cancel(); tokenSource = new CancellationTokenSource(); StartCaptureCore(camera, tokenSource.Token); }
public void OpenCamera(SystemCamera camera) => platformCameraFramebufferPlayer.OpenCamera(camera);