Beispiel #1
0
        void IDeckLinkInputCallback.VideoInputFormatChanged(_BMDVideoInputFormatChangedEvents notificationEvents, IDeckLinkDisplayMode newDisplayMode, _BMDDetectedVideoInputFormatFlags detectedSignalFlags)
        {
            // Restart capture with the new video mode if told to
            if (!m_applyDetectedInputMode)
            {
                return;
            }

            var pixelFormat = _BMDPixelFormat.bmdFormat10BitYUV;

            if (detectedSignalFlags.HasFlag(_BMDDetectedVideoInputFormatFlags.bmdDetectedVideoInputRGB444))
            {
                m_pxFormat  = "10 bit RGB";
                pixelFormat = _BMDPixelFormat.bmdFormat10BitRGB;
            }
            if (detectedSignalFlags.HasFlag(_BMDDetectedVideoInputFormatFlags.bmdDetectedVideoInputYCbCr422))
            {
                m_pxFormat  = "10 bit YUV";
                pixelFormat = _BMDPixelFormat.bmdFormat10BitYUV;
            }
            if (detectedSignalFlags.HasFlag(_BMDDetectedVideoInputFormatFlags.bmdDetectedVideoInputDualStream3D))
            {
                m_pxFormat  = "Dual Stream 3D";
                pixelFormat = _BMDPixelFormat.bmdFormat10BitYUV;
            }

            // Stop the capture
            m_deckLinkInput.StopStreams();

            // Set the video input mode
            //For upload to GPU we need 8bitYUV
            //   m_deckLinkInput.EnableVideoInput(newDisplayMode.GetDisplayMode(), pixelFormat, _BMDVideoInputFlags.bmdVideoInputEnableFormatDetection);
            m_deckLinkInput.EnableVideoInput(newDisplayMode.GetDisplayMode(), _BMDPixelFormat.bmdFormat8BitYUV, _BMDVideoInputFlags.bmdVideoInputEnableFormatDetection);
            m_deckLinkInput.EnableAudioInput(_BMDAudioSampleRate.bmdAudioSampleRate48kHz, _BMDAudioSampleType.bmdAudioSampleType16bitInteger, 16);

            // Start the capture
            m_deckLinkInput.StartStreams();

            InputFormatChanged(newDisplayMode);
        }
Beispiel #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);
        }
Beispiel #3
0
 public void Start()
 {
     try
     {
         var cb = new Callback(config);
         recorder = config.Recorder;
         cb.FingerprintCreated += OnFingerprintCreated;
         recorder.SetCallback(cb);
         recorder.EnableVideoInput(config.VideoMode, _BMDPixelFormat.bmdFormat8BitYUV, _BMDVideoInputFlags.bmdVideoInputFlagDefault);
         recorder.EnableAudioInput(_BMDAudioSampleRate.bmdAudioSampleRate48kHz, _BMDAudioSampleType.bmdAudioSampleType16bitInteger, CHANNELS);
         recorder.StartStreams();
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Cannot start fingerprinting: {ex.Message}", "Error", MessageBoxButton.OK);
         Stop(false);
     }
 }
        public void StartCapture(IDeckLinkDisplayMode displayMode, IDeckLinkScreenPreviewCallback screenPreviewCallback, bool applyDetectedInputMode)
        {
            logger.Debug("StartCapture(...)");

            if (currentlyCapturing)
            {
                return;
            }

            validInputSignal            = false;
            this.applyDetectedInputMode = applyDetectedInputMode;


            var videoInputFlags = _BMDVideoInputFlags.bmdVideoInputFlagDefault;

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

            var pixelFormat    = _BMDPixelFormat.bmdFormat8BitYUV;
            var bdmDisplayMode = displayMode.GetDisplayMode();


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

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


            // Set the video input mode
            deckLinkInput.EnableVideoInput(bdmDisplayMode, pixelFormat, videoInputFlags);

            deckLinkInput.EnableAudioInput(AudioSampleRate, AudioSampleType, (uint)AudioChannelsCount);

            // Start the capture
            deckLinkInput.StartStreams();


            currentlyCapturing = true;
        }