fprintf(stderr, "StopStreams failed with error 0x%x\n", result);
abort();
}
- if (input->DisableVideoInput() != S_OK) {
- fprintf(stderr, "Failed to disable video input for card %d\n", card_index);
- exit(1);
- }
- if (input->DisableAudioInput() != S_OK) {
- fprintf(stderr, "Failed to disable audio input for card %d\n", card_index);
- exit(1);
- }
+
+ // We could call DisableVideoInput() and DisableAudioInput() here,
+ // but they seem to be taking a really long time, and we only do this
+ // during shutdown anyway (except when switching to output mode,
+ // where DeckLinkOutput does the disabling), so StopStreams() will suffice.
+
running = false;
}
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;
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);
}
}
+ if (input != nullptr) {
+ input->Release();
+ input = nullptr;
+ }
if (output != nullptr) {
output->Release();
output = nullptr;
bool last_frame_had_mode_mismatch = false;
movit::ResourcePool *resource_pool;
+ IDeckLinkInput *input = nullptr;
IDeckLinkOutput *output = nullptr;
BMDVideoConnection video_connection;
QSurface *surface;