]> git.sesse.net Git - nageru/commitdiff
Fix DeckLink capture using the 11.7 or newer drivers.
authorSteinar H. Gunderson <steinar+nageru@gunderson.no>
Sun, 15 Aug 2021 13:06:34 +0000 (15:06 +0200)
committerSteinar H. Gunderson <steinar+nageru@gunderson.no>
Sun, 15 Aug 2021 13:06:34 +0000 (15:06 +0200)
Reported by Marcus Nilsen.

nageru/bmusb
nageru/decklink_capture.h
nageru/decklink_output.cpp
nageru/decklink_output.h
nageru/mixer.cpp

index 0c0182f453e8bc26e630615ea6d2a2f05e868fde..327dca2d848e4c4656be1bfb54a2edf2e6587a71 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 0c0182f453e8bc26e630615ea6d2a2f05e868fde
+Subproject commit 327dca2d848e4c4656be1bfb54a2edf2e6587a71
index f940241a854f7acc941b1af56d2a35567389458e..a2e25c8224ff5aeadd203eaab93f0f5ce651d633 100644 (file)
@@ -26,6 +26,8 @@ public:
        DeckLinkCapture(IDeckLink *card, int card_index);  // Takes ownership of <card>.
        ~DeckLinkCapture();
 
+       IDeckLinkInput *get_input() const { return input; }
+
        // IDeckLinkInputCallback.
        HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, LPVOID *) override;
        ULONG STDMETHODCALLTYPE AddRef() override;
index da172af686acbc3ff7acf489a7befd01a2efb2f7..20de9229fdc35e42502626c40b571f5741150f4c 100644 (file)
@@ -82,11 +82,9 @@ DeckLinkOutput::DeckLinkOutput(ResourcePool *resource_pool, QSurface *surface, u
        });
 }
 
-bool DeckLinkOutput::set_device(IDeckLink *decklink)
+bool DeckLinkOutput::set_device(IDeckLink *decklink, IDeckLinkInput *input_arg)
 {
-       if (decklink->QueryInterface(IID_IDeckLinkInput, (void**)&input) != S_OK) {
-               input = nullptr;
-       }
+       input_arg = input;
        if (decklink->QueryInterface(IID_IDeckLinkOutput, (void**)&output) != S_OK) {
                fprintf(stderr, "Warning: Card %u has no outputs\n", card_index);
                return false;
index f1b40f468abdd703eb8df9c1e0410d3a78696d29..8213f498a9d0677df7fe77b928acc7dce8951825 100644 (file)
@@ -39,7 +39,11 @@ class DeckLinkOutput : public IDeckLinkVideoOutputCallback {
 public:
        DeckLinkOutput(movit::ResourcePool *resource_pool, QSurface *surface, unsigned width, unsigned height, unsigned card_index);
 
-       bool set_device(IDeckLink *output);
+       // The IDecklinkInput argument is to work around a bug
+       // in the 11.7 and newer drivers against older SDKs,
+       // where you get a freeze if querying an IDeckLinkInput interface
+       // on an already-started card.
+       bool set_device(IDeckLink *decklink, IDeckLinkInput *input_arg);
        void start_output(uint32_t mode, int64_t base_pts);  // Mode comes from get_available_video_modes().
        void end_output();
 
index ce8a73237fd4a838ee85ca0c307663d6e3c9edda..3a137d68a9b0d39b2a52388f699be0b9fa004c4b 100644 (file)
@@ -429,7 +429,7 @@ Mixer::Mixer(const QSurfaceFormat &format)
 
                                DeckLinkCapture *capture = new DeckLinkCapture(decklink, card_index);
                                DeckLinkOutput *output = new DeckLinkOutput(resource_pool.get(), decklink_output_surface, global_flags.width, global_flags.height, card_index);
-                               if (!output->set_device(decklink)) {
+                               if (!output->set_device(decklink, capture->get_input())) {
                                        delete output;
                                        output = nullptr;
                                }