private async void StartCapture() { captureEngine = await CaptureEngine.CreateAsync(false); if (this.captureEngine != null) { await this.captureEngine.StartAsync(false, this.connection); } }
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); } } }
private async void CloseConnection() { if (this.captureEngine != null) { await this.captureEngine.StopAsync(); this.captureEngine.Uninitialize(); this.captureEngine = null; } if (this.connection != null) { this.connection.Disconnected -= Connection_Disconnected; this.connection.Received -= Connection_Received; this.connection.Uninitialize(); this.connection = null; } if (this.listener != null) { this.listener.Uninitialize(); this.listener = null; } }
private void OnLogRequested(object sender, CaptureEngine.LogEventArgs e) { Log.WriteLine(uint.MaxValue, e.Message); }
private void OnEngineEvent(CaptureEngine engine, MediaEvent mediaEvent) { throw new NotImplementedException(); }
public void CanGetCaptureSources() { var engine = new CaptureEngine(); engine.GetSources().Wait(); }