Cannot receive any frame data

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

Boris Brock

  • Posts: 2
  • Joined: Thu Nov 30, 2017 9:54 am

Cannot receive any frame data

PostThu Nov 30, 2017 12:33 pm

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");
}
Offline

Cameron Nichols

Blackmagic Design

  • Posts: 34
  • Joined: Mon Sep 04, 2017 4:05 am

Re: Cannot receive any frame data

PostWed Dec 06, 2017 5:03 am

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
Offline

Boris Brock

  • Posts: 2
  • Joined: Thu Nov 30, 2017 9:54 am

Re: Cannot receive any frame data

PostWed Dec 06, 2017 5:53 am

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?
Offline
User avatar

Jack Fairley

  • Posts: 434
  • Joined: Mon Oct 03, 2016 7:58 pm

Re: Cannot receive any frame data

PostWed Dec 06, 2017 11:29 pm

Boris Brock wrote:Does the input signal/hardware decide which video format has to be used?

Yep

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 2 guests