EnableVideoInput systematically fails

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

Ali Mouizina

  • Posts: 1
  • Joined: Wed Dec 20, 2017 3:30 pm

EnableVideoInput systematically fails

PostWed Dec 20, 2017 3:34 pm

hi everyone,

I have an intensity shuttle USB 3.0 and Intensity Pro 4K. I am using the SDK in one of my project. I followed the sample code provided in the SDK but I have a failure for EnableVideoInput with the error code E_FAIL.

When I reboot the computer, the code sometimes works. The two devices are not plugged at the same time.

Here is the code for the device initialization, do you see anything wrong ?

Code: Select all
 HRESULT                  result;
    // Initialize COM on this thread
    result = CoInitialize(NULL);
    if (FAILED(result))
        Ktc::LogError("{},{}: Initialization of COM failed - result = {}.\n", __FUNCTION__, __LINE__, result);
        return 1;

    // Create an IDeckLinkIterator object to enumerate all DeckLink cards in the system
    result = CoCreateInstance(CLSID_CDeckLinkIterator, NULL, CLSCTX_ALL, IID_IDeckLinkIterator, (void**)&deckLinkIterator);
    if (FAILED(result))
        Ktc::LogError("{},{}: A DeckLink iterator could not be created.  The DeckLink drivers may not be installed. {}", __FUNCTION__, __LINE__, result);
        return 1;

    // We can get the version of the API like this:
    result = deckLinkIterator->QueryInterface(IID_IDeckLinkAPIInformation, (void**)&deckLinkAPIInformation);
    if (result == S_OK)
        LONGLONG      deckLinkVersion;
        int            dlVerMajor, dlVerMinor, dlVerPoint;

        // We can also use the BMDDeckLinkAPIVersion flag with GetString
        deckLinkAPIInformation->GetInt(BMDDeckLinkAPIVersion, &deckLinkVersion);

        dlVerMajor = (deckLinkVersion & 0xFF000000) >> 24;
        dlVerMinor = (deckLinkVersion & 0x00FF0000) >> 16;
        dlVerPoint = (deckLinkVersion & 0x0000FF00) >> 8;


    if (deckLinkIterator->Next(&deckLink) == S_OK)
        // Get input interface
        if (deckLink->QueryInterface(IID_IDeckLinkInput, (void**)&deckLinkInput) != S_OK)
            return false;

        // Check if input mode detection is supported.
        if (deckLink->QueryInterface(IID_IDeckLinkAttributes, (void**)&deckLinkAttributes) == S_OK)
            if (deckLinkAttributes->GetFlag(BMDDeckLinkSupportsInputFormatDetection, &supportsFormatDetection) != S_OK)
                supportsFormatDetection = false;


        // Retrieve and cache mode list
        if (deckLinkInput->GetDisplayModeIterator(&displayModeIterator) == S_OK)
            while (displayModeIterator->Next(&displayMode) == S_OK)


        // Enable input video mode detection if the device supports it
        if (supportsFormatDetection == TRUE)
            videoInputFlags |= bmdVideoInputEnableFormatDetection;

        // Set capture callback
        deckLinkInput->SetCallback((IDeckLinkInputCallback *)dlCallback);

        // Set the video input mode
        HRESULT error_ = deckLinkInput->EnableVideoInput(bmdModeHD1080i50, bmdFormat8BitYUV, videoInputFlags);

        if (FAILED(error_)) {
          switch (error_) {
          case E_INVALIDARG:
            Ktc::LogError("{},{}: video mode invalid.", __FUNCTION__, __LINE__);
          case E_ACCESSDENIED:
            Ktc::LogError("{},{}: access denied.", __FUNCTION__, __LINE__);
          case E_OUTOFMEMORY:
            Ktc::LogError("{},{}: out of memory.", __FUNCTION__, __LINE__);
            Ktc::LogError("{},{}: unknown error {}", __FUNCTION__, __LINE__, error_);
          return false;

        // Start the capture
        if (deckLinkInput->StartStreams() != S_OK)
            return false;

Cameron Nichols

Blackmagic Design

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

Re: EnableVideoInput systematically fails

PostThu Dec 21, 2017 10:06 pm

Hi Ali,

I have reviewed and run through the code locally and it appears to run OK.

I suspect the card is remnant capture state and only resolved on reboot. When you terminate the application, are you properly stopping capture via IDeckLinkInput::StopStreams and IDeckLinkInput::DisableVideoInput commands (StopStreams at a minimum)?

Kind Regards

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 3 guests