X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=decklink_capture.cpp;h=4db60120f3040a0325325959c7edd5a0463cc5a8;hb=96cb6414f85e0ef4d660b7bd56267303e80fcd05;hp=33bb73daa219fa51c31d1ebdd23a3f72709858d5;hpb=471db5155f58c3bf7a98c446575cfa0c483da765;p=nageru diff --git a/decklink_capture.cpp b/decklink_capture.cpp index 33bb73d..4db6012 100644 --- a/decklink_capture.cpp +++ b/decklink_capture.cpp @@ -340,8 +340,8 @@ HRESULT STDMETHODCALLTYPE DeckLinkCapture::VideoInputFrameArrived( if (video_frame) { video_format.has_signal = !(video_frame->GetFlags() & bmdFrameHasNoInputSource); - int width = video_frame->GetWidth(); - int height = video_frame->GetHeight(); + const int width = video_frame->GetWidth(); + const int height = video_frame->GetHeight(); const int stride = video_frame->GetRowBytes(); const BMDPixelFormat format = video_frame->GetPixelFormat(); assert(format == pixel_format_to_bmd(current_pixel_format)); @@ -473,20 +473,24 @@ void DeckLinkCapture::stop_dequeue_thread() void DeckLinkCapture::set_video_mode(uint32_t video_mode_id) { - if (input->PauseStreams() != S_OK) { - fprintf(stderr, "PauseStreams failed\n"); - exit(1); - } - if (input->FlushStreams() != S_OK) { - fprintf(stderr, "FlushStreams failed\n"); - exit(1); + if (running) { + if (input->PauseStreams() != S_OK) { + fprintf(stderr, "PauseStreams failed\n"); + exit(1); + } + if (input->FlushStreams() != S_OK) { + fprintf(stderr, "FlushStreams failed\n"); + exit(1); + } } set_video_mode_no_restart(video_mode_id); - if (input->StartStreams() != S_OK) { - fprintf(stderr, "StartStreams failed\n"); - exit(1); + if (running) { + if (input->StartStreams() != S_OK) { + fprintf(stderr, "StartStreams failed\n"); + exit(1); + } } }