- Posts: 2
- Joined: Thu Nov 30, 2017 9:54 am
Hello,
today I received my two "Intensity Pro 4K" capturing cards. My goal is to write an application which captures the outputs from both cards and writes them to disk. Sadly I'm having a little trouble getting started with the DeckLink SDK. This is what I do:
At first I scan for devices with the IDeckLinkIterator. Both cards are found.
=> OK
For both devices I get the IDeckLinkInput objects and store them.
=> OK
Then I initialize both inputs:
- I check with DoesSupportVideoMode if the video mode is supported (I need bmdFormat8BitARGB)
=> Returns S_OK, says video mode is supported (bmdDisplayModeSupported)
- I enable the video input via EnableVideoInput
=> This returns S_OK, too
- I start the streams by calling StartStreams
=> This also returns S_OK
From that point on my callback function VideoInputFrameArrived is called from both inputs. So far so good. But here's the problem:
Every frame I get has the flag bmdFrameHasNoInputSource set. So there is no frame data at all.
What I tried so far:
I already ran the sample applications shipped with the SDK. They run fine and show the captured HDMI frames without any issues. So the grabber cards, the cables and my video sources seem to be OK. The error must lie somewhere in my code. But since all the calls I make return S_OK I have no idea where anything could go wrong...
PS:
This is the (hopefully) relevant excerpt from my device initialization code:
today I received my two "Intensity Pro 4K" capturing cards. My goal is to write an application which captures the outputs from both cards and writes them to disk. Sadly I'm having a little trouble getting started with the DeckLink SDK. This is what I do:
At first I scan for devices with the IDeckLinkIterator. Both cards are found.
=> OK
For both devices I get the IDeckLinkInput objects and store them.
=> OK
Then I initialize both inputs:
- I check with DoesSupportVideoMode if the video mode is supported (I need bmdFormat8BitARGB)
=> Returns S_OK, says video mode is supported (bmdDisplayModeSupported)
- I enable the video input via EnableVideoInput
=> This returns S_OK, too
- I start the streams by calling StartStreams
=> This also returns S_OK
From that point on my callback function VideoInputFrameArrived is called from both inputs. So far so good. But here's the problem:
Every frame I get has the flag bmdFrameHasNoInputSource set. So there is no frame data at all.
What I tried so far:
I already ran the sample applications shipped with the SDK. They run fine and show the captured HDMI frames without any issues. So the grabber cards, the cables and my video sources seem to be OK. The error must lie somewhere in my code. But since all the calls I make return S_OK I have no idea where anything could go wrong...
PS:
This is the (hopefully) relevant excerpt from my device initialization code:
- Code: Select all
// Initializes the device
void DeckLinkDevice::Initialize(std::string videoMode)
{
// Get input interfaces
if (mDev->QueryInterface(IID_IDeckLinkInput, (void**)&mInput) != S_OK)
throw std::runtime_error("Error: Could not acquire input interface for DeckLink device");
// Set capture callback
mInput->SetCallback(this);
// Get display mode
std::cout << "Searching for video mode " << videoMode << std::endl;
IDeckLinkDisplayModeIterator* displayModeIterator = nullptr;
IDeckLinkDisplayMode* displayMode = nullptr;
if (mInput->GetDisplayModeIterator(&displayModeIterator) == S_OK)
{
while (displayModeIterator->Next(&displayMode) == S_OK)
{
// Find the mode with the correct name
BSTR nameBSTR = nullptr;
displayMode->GetName(&nameBSTR);
auto name = DeckLinkUtils::BstrToStr(nameBSTR);
if (name == videoMode)
break;
}
}
displayModeIterator->Release();
if (displayMode == nullptr)
throw std::runtime_error("Error: Unable to find video mode ");
// Check if mode is supported
BMDDisplayModeSupport displayModeSupported;
auto result = mInput->DoesSupportVideoMode(displayMode->GetDisplayMode(), bmdFormat8BitARGB, bmdVideoInputFlagDefault, &displayModeSupported, NULL);
if (result != S_OK || displayModeSupported != bmdDisplayModeSupported)
throw std::runtime_error("Error: Required video mode is not supported by device.");
// Set the video input mode
if (mInput->EnableVideoInput(displayMode->GetDisplayMode(), bmdFormat8BitARGB, bmdVideoInputFlagDefault) != S_OK)
throw std::runtime_error("Error: Unable to select the chosen video mode. Perhaps, the selected device is currently in-use.");
// Start the captures
if (mInput->StartStreams() != S_OK)
throw std::runtime_error("Error: Could not start stream on device");
}