Page 1 of 1

Unable to set input connection via C++

PostPosted: Fri Aug 04, 2017 10:15 pm
by eric_poulsen
The essential problem is that it seems I cannot programmatically set the input connection.

* Decklink Mini recorder
* Ubuntu 16.04 X64

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;


    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;


    if (it != NULL)

    if (deckLinkConfiguration != NULL)

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

    m_callback = new CaptureCallback(m_deckLinkInput, m_delegate);


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

Re: Unable to set input connection via C++

PostPosted: Fri Aug 11, 2017 6:03 am
by Nicholas Gill
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.



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

Re: Unable to set input connection via C++

PostPosted: Fri Aug 11, 2017 5:34 pm
by eric_poulsen

Thanks, looks like I need to RTFM :D

-- Eric