X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=decklink_output.cpp;h=28f433a8872945b3191608cc7283eea5fea4669e;hb=6ffaabac0a523617b686f40c154a25cb548cc561;hp=2285bb2a7ceed3b7ac1237224447f8c70ce78380;hpb=b706133a02b3baf1a1d87db4dfe734d4b7982a86;p=nageru diff --git a/decklink_output.cpp b/decklink_output.cpp index 2285bb2..28f433a 100644 --- a/decklink_output.cpp +++ b/decklink_output.cpp @@ -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(); @@ -115,9 +115,12 @@ void DeckLinkOutput::set_device(IDeckLink *decklink) // HDMI or SDI generally mean “both HDMI and SDI at the same time” on DeckLink cards // that support both; pick_default_video_connection() will generally pick one of those - // if they exist. We're not very likely to need analog outputs, so we don't need a way - // to change beyond that. + // if they exist. (--prefer-hdmi-input would also affect the selection despite the name + // of the option, but since either generally means both, it's inconsequential.) + // 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 +527,7 @@ unique_ptr 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();