Beispiel #1
0
        public DLDirect(IDeckLink deckLink, IDeckLinkDisplayMode displayMode)
        {
            PreRollFrameCount = 4;

            this.displayMode = displayMode;
            this.m_deckLink  = deckLink;

            DisplayWidth  = displayMode.GetWidth();
            DisplayHeight = displayMode.GetHeight();

            m_running = false;

            // Get the IDeckLinkOutput interface
            m_deckLinkOutput = (IDeckLinkOutput)m_deckLink;

            // Provide this class as a delegate to the audio and video output interfaces
            m_deckLinkOutput.SetScheduledFrameCompletionCallback(this);

            m_frameWidth  = displayMode.GetWidth();
            m_frameHeight = displayMode.GetHeight();

            displayMode.GetFrameRate(out m_frameDuration, out m_frameTimescale);

            // Calculate the number of frames per second, rounded up to the nearest integer.  For example, for NTSC (29.97 FPS), framesPerSecond == 30.
            m_framesPerSecond = (uint)((m_frameTimescale + (m_frameDuration - 1)) / m_frameDuration);
            FPS = (int)m_framesPerSecond;

            // Set the video output mode
            m_deckLinkOutput.EnableVideoOutput(displayMode.GetDisplayMode(), _BMDVideoOutputFlags.bmdVideoOutputFlagDefault);

            // Generate the frame used for playback
            m_deckLinkOutput.CreateVideoFrame(m_frameWidth, m_frameHeight, m_frameWidth * 4, _BMDPixelFormat.bmdFormat8BitBGRA, _BMDFrameFlags.bmdFrameFlagDefault, out m_videoFramePlayback);
            m_totalFramesScheduled = 0;
        }
Beispiel #2
0
        public DeckLinkRenderer(IDeckLinkOutput newDeckLinkOutput, IDeckLinkDisplayMode newDisplayMode)
        {
            running        = false;
            deckLinkOutput = newDeckLinkOutput;
            displayMode    = newDisplayMode;

            frameWidth  = displayMode.GetWidth();
            frameHeight = displayMode.GetHeight();

            displayMode.GetFrameRate(out frameDuration, out frameTimescale);
            framesPerSecond = (uint)((frameTimescale + (frameDuration - 1)) / frameDuration);

            deckLinkOutput.SetScreenPreviewCallback(this);
            deckLinkOutput.SetScheduledFrameCompletionCallback(this);
            deckLinkOutput.SetAudioCallback(this);
        }