Page 1 of 1

Cannot receive any frame data

PostPosted: Thu Nov 30, 2017 12:33 pm
by Boris Brock
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:
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");
}

Re: Cannot receive any frame data

PostPosted: Wed Dec 06, 2017 5:03 am
by Cameron Nichols
Hi Boris,

The sample you provides looks OK. I suspect that the video mode does not match the actual input.

Can you retry with Automatic Mode Detection implemented as outlined in Section 2.4.6 in DeckLink SDK Manual. Do you receive the VideoInputFormatChanged callback?

Kind Regards
Cameron Nichols

Re: Cannot receive any frame data

PostPosted: Wed Dec 06, 2017 5:53 am
by Boris Brock
Hi,
maybe there is a misconception here. I thought I could choose the video format depending on how I need my frame data (for further processing). I expected the hardware to transform the incoming data into the desired format. Or is it the other way round? Does the input signal/hardware decide which video format has to be used?

Re: Cannot receive any frame data

PostPosted: Wed Dec 06, 2017 11:29 pm
by Jack Fairley
Boris Brock wrote:Does the input signal/hardware decide which video format has to be used?

Yep