Unable to set input connection via C++

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

eric_poulsen

  • Posts: 5
  • Joined: Tue Jul 25, 2017 4:53 pm

Unable to set input connection via C++

PostFri Aug 04, 2017 10:15 pm

The essential problem is that it seems I cannot programmatically set the input connection.


* Decklink Mini recorder
* Ubuntu 16.04 X64


This:
Code: Select all
 
result = deckLinkConfiguration->SetInt(bmdDeckLinkConfigVideoInputConnection, bmdVideoConnectionHDMI);
// (full code below)

doesn't seem to work. I can change the input via the "Video Setup" app, and it sticks.

Doesn't matter if I'm trying to change it from SDI-->HDMI or HDMI-->SDI.

Below is the constructor for a subclass of IDeckLinkInputCallback. The "CaptureDelegate" parameter it takes is for a higher-level API.

Code: Select all
Capture::Capture(CaptureDelegate& delegate) : m_delegate(delegate) {
    HRESULT result;
    const char*             errstr = NULL;
    IDeckLinkConfiguration* deckLinkConfiguration;
    IDeckLinkIterator*      it;

    it = CreateDeckLinkIteratorInstance();

    if (it == NULL) {
        errstr = "Unable to load DeckLink drivers";
        goto cleanup;
    }

    it->Next(&m_deckLink);

    if (m_deckLink == NULL) {
        errstr = "Capture device not found";
        goto cleanup;
    }

    result = m_deckLink->QueryInterface(IID_IDeckLinkInput, (void**)&m_deckLinkInput);
    if (result != S_OK) {
        errstr = "Unable to obtain input object";
        goto cleanup;
    }

    result = m_deckLink->QueryInterface(IID_IDeckLinkConfiguration, (void**)&deckLinkConfiguration);

    if (result != S_OK) {
        errstr = "Unable to get DeckLinkConfiguration object";
    }

    //result = deckLinkConfiguration->SetInt(bmdDeckLinkConfigVideoInputConnection, bmdVideoConnectionHDMI);
    result = deckLinkConfiguration->SetInt(bmdDeckLinkConfigVideoInputConnection, bmdVideoConnectionSDI);
    if (result != S_OK) {
        errstr = "Unable to select HDMI as input";
        goto cleanup;
    }



cleanup:

    if (it != NULL)
        it->Release();

    if (deckLinkConfiguration != NULL)
        deckLinkConfiguration->Release();

    if (errstr != NULL)
        throw CaptureException(errstr);


    m_callback = new CaptureCallback(m_deckLinkInput, m_delegate);

    m_deckLinkInput->SetCallback(m_callback);

    m_deckLinkInput->EnableVideoInput(bmdModeHD1080p30, bmdFormat8BitYUV, bmdVideoInputEnableFormatDetection);
    printf("everything ok\n");
}
Offline

Nicholas Gill

Blackmagic Design

  • Posts: 169
  • Joined: Mon May 04, 2015 10:28 pm

Re: Unable to set input connection via C++

PostFri Aug 11, 2017 6:03 am

Hi Eric,

The sample code shown is releasing the IDeckLinkConfiguration[1] reference immediately after making the change.

As WriteConfigurationToPreferences[2] is not called, the change is immediately reverted to the previous value.

Your application has the option then to either maintain a reference to the IDeckLinkConfiguration object for as long as the modified configuration is required, or call WriteConfigurationToPreferences to persist the new configuration.

Cheers,

-nick

[1] 2.5.15 IDeckLinkConfiguration Interface
[1] 2.5.15.9 IDeckLinkConfiguration::WriteConfigurationToPreferences method
Offline

eric_poulsen

  • Posts: 5
  • Joined: Tue Jul 25, 2017 4:53 pm

Re: Unable to set input connection via C++

PostFri Aug 11, 2017 5:34 pm

Nick,

Thanks, looks like I need to RTFM :D

-- Eric

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 11 guests