]> git.sesse.net Git - nageru/blobdiff - decklink_output.cpp
Support audio-only FFmpeg inputs. Somewhat wonky, though.
[nageru] / decklink_output.cpp
index 2285bb2a7ceed3b7ac1237224447f8c70ce78380..a3d220b37c98bb96834415af5a277c47424b83cb 100644 (file)
@@ -82,17 +82,17 @@ DeckLinkOutput::DeckLinkOutput(ResourcePool *resource_pool, QSurface *surface, u
        });
 }
 
-void DeckLinkOutput::set_device(IDeckLink *decklink)
+bool DeckLinkOutput::set_device(IDeckLink *decklink)
 {
        if (decklink->QueryInterface(IID_IDeckLinkOutput, (void**)&output) != S_OK) {
-               fprintf(stderr, "Card %u has no outputs\n", card_index);
-               exit(1);
+               fprintf(stderr, "Warning: Card %u has no outputs\n", card_index);
+               return false;
        }
 
        IDeckLinkDisplayModeIterator *mode_it;
        if (output->GetDisplayModeIterator(&mode_it) != S_OK) {
-               fprintf(stderr, "Failed to enumerate output display modes for card %u\n", card_index);
-               exit(1);
+               fprintf(stderr, "Warning: Failed to enumerate output display modes for card %u\n", card_index);
+               return false;
        }
 
        video_modes.clear();
@@ -118,6 +118,7 @@ void DeckLinkOutput::set_device(IDeckLink *decklink)
        // if they exist. We're not very likely to need analog outputs, so we don't need a way
        // to change beyond that.
        video_connection = pick_default_video_connection(decklink, BMDDeckLinkVideoOutputConnections, card_index);
+       return true;
 }
 
 void DeckLinkOutput::start_output(uint32_t mode, int64_t base_pts)
@@ -524,7 +525,7 @@ unique_ptr<DeckLinkOutput::Frame> DeckLinkOutput::get_frame()
        check_error();
        glBindBuffer(GL_PIXEL_PACK_BUFFER, frame->pbo);
        check_error();
-       glBufferStorage(GL_PIXEL_PACK_BUFFER, stride * height, NULL, GL_MAP_READ_BIT | GL_MAP_PERSISTENT_BIT);
+       glBufferStorage(GL_PIXEL_PACK_BUFFER, stride * height, nullptr, GL_MAP_READ_BIT | GL_MAP_PERSISTENT_BIT);
        check_error();
        frame->uyvy_ptr = (uint8_t *)glMapBufferRange(GL_PIXEL_PACK_BUFFER, 0, stride * height, GL_MAP_READ_BIT | GL_MAP_PERSISTENT_BIT);
        check_error();