Hi Otto,
I had a look through your source in pastebin. I believe the issue relates to one of 2 issues:
In the VideoInputFrameArrived callback, check that the call to
- Code: Select all
Global::frameStore->receiveFrame( videoFrame, audioPacket );
does not exceed the frame period. If this occurs then you will end up with backlog of input frames queued waiting for subsequent
IDeckLinkInputCallback::VideoInputFrameArrived callbacks. The method
IDeckLinkOutput::GetBufferedVideoFrameCount will provide clue whether input frames are being buffered.
The second suggestion, is in Desktop Video 11.6, new format detection flags for detecting depth were added. I suggest making the following change to your VideoInputFormatChanged callback:
- Code: Select all
HRESULT DeckLinkDevice::VideoInputFormatChanged(/* in */ BMDVideoInputFormatChangedEvents notificationEvents, /* in */ IDeckLinkDisplayMode *newMode, /* in */ BMDDetectedVideoInputFormatFlags detectedSignalFlags )
{
unsigned int modeIndex = 0;
BMDPixelFormat pixelFormat = m_pixelFormat;
// Restart capture with the new video mode if told to
if( !m_applyDetectedInputMode )
goto bail;
if (notificationEvents & bmdVideoInputColorspaceChanged)
{
if( detectedSignalFlags & bmdDetectedVideoInputRGB444 )
pixelFormat = bmdFormat10BitRGB;
else if (detectedSignalFlags & bmdDetectedVideoInputYCbCr422)
pixelFormat = bmdFormat8BitYUV;
else
goto bail;
}
// Restart streams if either dispay mode or colorspace has changed
if ((notificationEvents & bmdVideoInputDisplayModeChanged) || (pixelFormat != m_pixelFormat))
{
// Stop the capture
m_deckLinkInput->StopStreams( );
// Set the video input mode
if( m_deckLinkInput->EnableVideoInput( newMode->GetDisplayMode( ), pixelFormat, bmdVideoInputEnableFormatDetection ) != S_OK )
{
// Let the UI know we couldnt restart the capture with the detected input mode
//PostMessage( m_uiDelegate->GetSafeHwnd( ), WM_ERROR_RESTARTING_CAPTURE_MESSAGE, 0, 0 );
goto bail;
}
// Start the capture
if( m_deckLinkInput->StartStreams( ) != S_OK )
{
// Let the UI know we couldnt restart the capture with the detected input mode
//PostMessage( m_uiDelegate->GetSafeHwnd( ), WM_ERROR_RESTARTING_CAPTURE_MESSAGE, 0, 0 );
goto bail;
}
m_pixelFormat = pixelFormat;
}
if (notificationEvents & bmdVideoInputDisplayModeChanged)
{
// Find the index of the new mode in the mode list so we can update the UI
while( modeIndex < m_modeList.size( ) )
{
if( m_modeList[modeIndex]->GetDisplayMode( ) == newMode->GetDisplayMode( ) )
{
//PostMessage( m_uiDelegate->GetSafeHwnd( ), WM_SELECT_VIDEO_MODE_MESSAGE, modeIndex, 0 );
if( m_uiDelegate ) m_uiDelegate->onMessage( (int)MessageType::SELECT_VIDEO_MODE, modeIndex );
break;
}
modeIndex++;
}
}
bail:
return S_OK;
}
Create member variable m_pixelFormat keep track of whether output mode is bmdFormat8BitYUV or bmdFormat10BitRGB for when detected colorspace/depth is different to the output pixel format.
Regards
Cameron