Esempio n. 1
0
        public override void BeforeClose()
        {
            if (cameraLoaded)
            {
                UnloadCamera();
            }

            if (pipelineManager != null)
            {
                // Destroy resources (symmetric to constructor).
                pipelineManager.FrameSignaled -= pipelineManager_FrameSignaled;
                pipelineManager = null;
            }

            consumerDisplay = null;

            nonGrabbingInteractionTimer.Stop();
            nonGrabbingInteractionTimer.Tick -= NonGrabbingInteractionTimer_Tick;
            grabTimer.Stop();
            grabTimer.Tick -= grabTimer_Tick;

            viewportController.DisplayRectangleUpdated -= ViewportController_DisplayRectangleUpdated;

            if (view != null)
            {
                view.DualCommandReceived -= OnDualCommandReceived;
                view.BeforeClose();
                view = null;
            }
        }
Esempio n. 2
0
        public void Connect(ImageDescriptor imageDescriptor, IFrameProducer producer, ConsumerDisplay consumerDisplay, ConsumerMJPEGRecorder consumerRecord)
        {
            // At that point the consumer threads are already started.
            // But only the display thread (actually the UI main thread) should be "active".
            // The producer thread is not started yet, it will be started outside the pipeline manager.
            this.producer        = producer;
            this.consumerDisplay = consumerDisplay;
            this.consumerRecord  = consumerRecord;

            consumerDisplay.SetImageDescriptor(imageDescriptor);
            consumerRecord.SetImageDescriptor(imageDescriptor);

            consumers.Clear();
            consumers.Add(consumerDisplay as IFrameConsumer);
            consumers.Add(consumerRecord as IFrameConsumer);

            int buffers = 8;

            pipeline = new FramePipeline(producer, consumers, buffers, imageDescriptor.BufferSize);
            pipeline.SetBenchmarkMode(BenchmarkMode.None);

            if (pipeline.Allocated)
            {
                producer.FrameProduced += producer_FrameProduced;
                connected = true;
            }
        }
        public void Connect(ImageDescriptor imageDescriptor, IFrameProducer producer, ConsumerDisplay consumerDisplay, ConsumerDelayer consumerDelayer)
        {
            // Same as above but for the recording mode "delay" case.
            this.producer         = producer;
            this.consumerRealtime = null;
            this.consumerDelayer  = consumerDelayer;
            this.filepath         = null;

            consumerDisplay.SetImageDescriptor(imageDescriptor);
            consumerDelayer.SetImageDescriptor(imageDescriptor);

            consumers.Clear();
            consumers.Add(consumerDisplay as IFrameConsumer);
            consumers.Add(consumerDelayer as IFrameConsumer);

            CreatePipeline(imageDescriptor);
        }
        public void Connect(ImageDescriptor imageDescriptor, IFrameProducer producer, ConsumerDisplay consumerDisplay, ConsumerRealtime consumerRealtime)
        {
            // At that point the consumer threads are already started.
            // But only the display thread (actually the UI main thread) should be "active".
            // The producer thread is not started yet, it will be started outside the pipeline manager.
            this.producer         = producer;
            this.consumerRealtime = consumerRealtime;
            this.consumerDelayer  = null;
            this.filepath         = null;

            consumerDisplay.SetImageDescriptor(imageDescriptor);
            consumerRealtime.SetImageDescriptor(imageDescriptor);

            consumers.Clear();
            consumers.Add(consumerDisplay as IFrameConsumer);
            consumers.Add(consumerRealtime as IFrameConsumer);

            CreatePipeline(imageDescriptor);
        }