コード例 #1
0
        private async void StartCapture()
        {
            captureEngine = await CaptureEngine.CreateAsync(false);

            if (this.captureEngine != null)
            {
                await this.captureEngine.StartAsync(false, this.connection);
            }
        }
コード例 #2
0
        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);
                }
            }
        }
コード例 #3
0
        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;
            }
        }
コード例 #4
0
 private void OnLogRequested(object sender, CaptureEngine.LogEventArgs e)
 {
     Log.WriteLine(uint.MaxValue, e.Message);
 }
コード例 #5
0
 private void OnEngineEvent(CaptureEngine engine, MediaEvent mediaEvent)
 {
     throw new NotImplementedException();
 }
コード例 #6
0
        public void CanGetCaptureSources()
        {
            var engine = new CaptureEngine();

            engine.GetSources().Wait();
        }