]> git.sesse.net Git - nageru/blobdiff - nageru/decklink_output.cpp
Reintroduce faster DeckLink shutdown; now with a fix for the UI switcher.
[nageru] / nageru / decklink_output.cpp
index 6b21edb0c45d066ebf3d8d68a6f8ed27410f4f8d..f1e06e8902cc268f4098bf74c363698725155e1b 100644 (file)
@@ -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;