예제 #1
0
        public void StartCapture(IDeckLinkDisplayMode displayMode, IDeckLinkScreenPreviewCallback screenPreviewCallback, bool applyDetectedInputMode)
        {
            if (m_currentlyCapturing)
            {
                return;
            }

            var videoInputFlags = _BMDVideoInputFlags.bmdVideoInputFlagDefault;

            m_applyDetectedInputMode = applyDetectedInputMode;
            m_validInputSignal       = false;

            // Enable input video mode detection if the device supports it
            if (supportsFormatDetection && m_applyDetectedInputMode)
            {
                videoInputFlags |= _BMDVideoInputFlags.bmdVideoInputEnableFormatDetection;
            }

            // Set the screen preview
            m_deckLinkInput.SetScreenPreviewCallback(screenPreviewCallback);

            // Set capture callback
            m_deckLinkInput.SetCallback(this);

            // Set the video input mode
            m_deckLinkInput.EnableVideoInput(displayMode.GetDisplayMode(), _BMDPixelFormat.bmdFormat8BitYUV, videoInputFlags);

            // Start the capture
            m_deckLinkInput.StartStreams();

            m_currentlyCapturing = true;
        }
예제 #2
0
        // Initialize DeckLink Stream
        public bool Initialize()
        {
            if (!cardWorking)
            {
                return(false);
            }

            // DeckLink Input Callback
            deckLinkInput.SetCallback(this);
            deckLinkInput.SetScreenPreviewCallback(this);
            var flags  = _BMDVideoInputFlags.bmdVideoInputFlagDefault | _BMDVideoInputFlags.bmdVideoInputEnableFormatDetection;
            var format = _BMDPixelFormat.bmdFormat8BitYUV;
            //var format = _BMDPixelFormat.bmdFormat8BitARGB;
            //var display = _BMDDisplayMode.bmdModeHD1080p5994; // input display mode
            _BMDDisplayModeSupport support;
            IDeckLinkDisplayMode   tmp;

            deckLinkInput.DoesSupportVideoMode(inputDisplayMode, format, flags, out support, out tmp);
            if (support != _BMDDisplayModeSupport.bmdDisplayModeSupported)
            {
                throw new Exception("display mode not working: " + support);
            }

            // Keyer
            if (keyerEnabled)
            {
                if (internalKeying)
                {
                    deckLinkKeyer.Enable(0); // 1: External alpha output, 2: Internal
                    deckLinkKeyer.SetLevel((byte)keyingLevel);
                }
                else
                {
                    deckLinkKeyer.Enable(1); // 1: External alpha output, 2: Internal
                }
            }

            // Enable Input Stream
            deckLinkInput.EnableVideoInput(inputDisplayMode, format, flags);
            deckLinkInput.EnableAudioInput(_AudioSampleRate, _AudioSampleType, _AudioChannels);
            deckLinkInput.StartStreams();

            // Enable Video Output
            //deckLinkOutput.EnableVideoOutput(displayMode, _BMDVideoOutputFlags.bmdVideoOutputFlagDefault);

            return(true);
        }
예제 #3
0
        public void StopCapture()
        {
            logger.Debug("StopCapture()");

            if (!currentlyCapturing)
            {
                return;
            }


            RemoveAllListeners();

            // Stop the capture
            deckLinkInput.StopStreams();

            // disable callbacks
            deckLinkInput.SetScreenPreviewCallback(null);
            deckLinkInput.SetCallback(null);

            currentlyCapturing = false;
        }