Skip to content

Commit 5858331

Browse files
committed
vcap/decklink: add autodetect-once option
This can be used as a workaround when for some reason the format flips. It sometimes occur eg. for PsF formats which is detected as progressive or vice versa. Maybe a driver issue but this option may be used as workaround also in other cases. For the above-mentioned case, it helps also setting :mode= explicitly or using :cfpr=yes|no.
1 parent 426382b commit 5858331

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/video_capture/decklink.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Dalibor Matura <255899@mail.muni.cz>
1010
* Ian Wesley-Smith <iwsmith@cct.lsu.edu>
1111
*
12-
* Copyright (c) 2005-2025 CESNET, zájmové sdružení právnických osob
12+
* Copyright (c) 2005-2026 CESNET, zájmové sdružení právnických osob
1313
*
1414
* Redistribution and use in source and binary forms, with or without
1515
* modification, is permitted provided that the following conditions
@@ -204,6 +204,7 @@ struct vidcap_decklink_state {
204204
{ bmdDeckLinkConfigCapturePassThroughMode, bmd_option((int64_t) bmdDeckLinkCapturePassthroughModeDisabled, false) },
205205
};
206206
bool detect_format = false;
207+
bool autodetect_once = true;
207208
unsigned int requested_bit_depth = 0; // 0, bmdDetectedVideoInput8BitDepth, bmdDetectedVideoInput10BitDepth or bmdDetectedVideoInput12BitDepth
208209
bool p_not_i = false;
209210

@@ -380,6 +381,10 @@ class VideoDelegate : public IDeckLinkInputCallback {
380381
deckLinkInput->FlushStreams();
381382
deckLinkInput->StartStreams();
382383

384+
if (s->autodetect_once) {
385+
s->enable_flags ^= bmdVideoInputEnableFormatDetection;
386+
}
387+
383388
return S_OK;
384389
}
385390
virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived(IDeckLinkVideoInputFrame*, IDeckLinkAudioInputPacket*) override;
@@ -610,6 +615,9 @@ decklink_help(bool full, const char *query_prop_fcc = nullptr)
610615
"autodetect, eg. \"-t "
611616
"decklink:connection=HDMI:detect-format\".\n";
612617

618+
col() << "\t" SBOLD("autodetect-once")
619+
<< " autodetect the format just once (eg. to prevent flipping P/PsF)\n";
620+
613621
col() << "\t" SBOLD("profile=<FourCC>") << " - use desired device profile:\n";
614622
print_bmd_device_profiles("\t\t");
615623
col() << "\t" SBOLD("sync_timecode") << " try to synchronize inputs based on timecode (for multiple inputs, eg. tiled 4K)\n";
@@ -764,6 +772,8 @@ static bool parse_option(struct vidcap_decklink_state *s, const char *opt)
764772
s->profile.parse(strchr(opt, '=') + 1);
765773
} else if (strcasecmp(opt, "detect-format") == 0) {
766774
s->detect_format = true;
775+
} else if (strcasecmp(opt, "autodetect-once") == 0) {
776+
s->autodetect_once = true;
767777
} else if (strcasecmp(opt, "p_not_i") == 0) {
768778
s->p_not_i = true;
769779
} else if (strstr(opt, "Use1080PsF") != nullptr) {

0 commit comments

Comments
 (0)