X-Git-Url: https://git.sesse.net/?p=nageru;a=blobdiff_plain;f=nageru%2Fdecklink_output.cpp;fp=nageru%2Fdecklink_output.cpp;h=f1e06e8902cc268f4098bf74c363698725155e1b;hp=6b21edb0c45d066ebf3d8d68a6f8ed27410f4f8d;hb=9a0f617093e7cde02a824b90f82f129c47193939;hpb=0eaa4d8a29782ae20d7b54fd8334371e724f1c57 diff --git a/nageru/decklink_output.cpp b/nageru/decklink_output.cpp index 6b21edb..f1e06e8 100644 --- a/nageru/decklink_output.cpp +++ b/nageru/decklink_output.cpp @@ -84,6 +84,9 @@ DeckLinkOutput::DeckLinkOutput(ResourcePool *resource_pool, QSurface *surface, u bool DeckLinkOutput::set_device(IDeckLink *decklink) { + if (decklink->QueryInterface(IID_IDeckLinkInput, (void**)&input) != S_OK) { + input = nullptr; + } if (decklink->QueryInterface(IID_IDeckLinkOutput, (void**)&output) != S_OK) { fprintf(stderr, "Warning: Card %u has no outputs\n", card_index); return false; @@ -193,6 +196,15 @@ void DeckLinkOutput::start_output(uint32_t mode, int64_t base_pts) display_mode->Release(); + if (input != nullptr) { + if (input->DisableVideoInput() != S_OK) { + fprintf(stderr, "Warning: Failed to disable video input for card %d\n", card_index); + } + if (input->DisableAudioInput() != S_OK) { + fprintf(stderr, "Warning: Failed to disable audio input for card %d\n", card_index); + } + } + HRESULT result = output->EnableVideoOutput(mode, bmdVideoOutputFlagDefault); if (result != S_OK) { fprintf(stderr, "Couldn't enable output with error 0x%x\n", result); @@ -249,6 +261,10 @@ void DeckLinkOutput::end_output() } } + if (input != nullptr) { + input->Release(); + input = nullptr; + } if (output != nullptr) { output->Release(); output = nullptr;