]> git.sesse.net Git - nageru/blobdiff - decklink_capture.cpp
Support interlaced inputs with the official DeckLink driver.
[nageru] / decklink_capture.cpp
index 2df01aa2dab80a069eb087bfa12b8365dd35a2b2..1093ab11aa0f64f388a6e348520ac8cb57f023a6 100644 (file)
@@ -294,6 +294,7 @@ HRESULT STDMETHODCALLTYPE DeckLinkCapture::VideoInputFormatChanged(
                fprintf(stderr, "Could not get new frame rate\n");
                exit(1);
        }
+       field_dominance = display_mode->GetFieldDominance();
        return S_OK;
 }
 
@@ -314,6 +315,9 @@ HRESULT STDMETHODCALLTYPE DeckLinkCapture::VideoInputFrameArrived(
 
        video_format.frame_rate_nom = time_scale;
        video_format.frame_rate_den = frame_duration;
+       // TODO: Respect the TFF/BFF flag.
+       video_format.interlaced = (field_dominance == bmdLowerFieldFirst || field_dominance == bmdUpperFieldFirst);
+       video_format.second_field_start = 1;
 
        if (video_frame) {
                video_format.has_signal = !(video_frame->GetFlags() & bmdFrameHasNoInputSource);
@@ -473,6 +477,8 @@ void DeckLinkCapture::set_video_mode_no_restart(uint32_t video_mode_id)
                exit(1);
        }
 
+       field_dominance = display_mode->GetFieldDominance();
+
        if (running) {
                if (input->EnableVideoInput(video_mode_id, bmdFormat8BitYUV, 0) != S_OK) {
                        fprintf(stderr, "Failed to set video mode 0x%04x for card %d\n", video_mode_id, card_index);