Skip to content

Commit e7873a6

Browse files
committed
vcap/decklink: capture 10b if 12-bit input not sup
4K Extreme supports 12 bit on output but not in input. Those devices correctly detect 12-bit input but the captured buffer is scrambled. So enforce 10-bit capture if 12 bit input is detected but not supported.
1 parent 4517c15 commit e7873a6

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/video_capture/decklink.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ class VideoDelegate : public IDeckLinkInputCallback {
332332
s->enable_flags ^= bmdVideoInputDualStream3D;
333333
}
334334

335+
IDeckLinkInput *deckLinkInput = device.deckLinkInput;
335336
// set the codec but only if has changed
336337
BMDDetectedVideoInputFormatFlags csBitDepth = flags & (csMask | bitDepthMask);
337338
if (notificationEvents == bmdVideoInputColorspaceChanged && csBitDepth == configuredCsBitDepth) {
@@ -353,18 +354,22 @@ class VideoDelegate : public IDeckLinkInputCallback {
353354
{bmdDetectedVideoInputRGB444 | bmdDetectedVideoInput12BitDepth, R12L},
354355
};
355356
if (s->requested_bit_depth == 0 && (csBitDepth & bmdDetectedVideoInput8BitDepth) == 0) {
356-
const string & depth = (flags & bmdDetectedVideoInput10BitDepth) != 0U ? "10"s : "12"s;
357-
LOG(LOG_LEVEL_WARNING)
358-
<< MOD_NAME << "Detected " << depth
359-
<< "-bit signal, use \":codec=UYVY\" to "
360-
"enforce 8-bit capture (old "
361-
"behavior).\n";
357+
const int depth = (flags & bmdDetectedVideoInput10BitDepth) != 0U ? 10 : 12;
358+
if (depth == 12 && !decklink_supports_codec(deckLinkInput, bmdFormat12BitRGBLE)) {
359+
MSG(WARNING, "12-bit input detected but not supported "
360+
"by the device! Using 10-bit.\n");
361+
csBitDepth = (flags & csMask) |
362+
bmdDetectedVideoInput10BitDepth;
363+
}
364+
MSG(WARNING,
365+
"Detected %d-bit signal, use \":codec=UYVY\" to "
366+
"enforce 8-bit capture (old behavior).\n",
367+
depth);
362368
}
363369

364370
unique_lock<mutex> lk(s->lock);
365371
s->set_codec(m.at(csBitDepth));
366372

367-
IDeckLinkInput *deckLinkInput = device.deckLinkInput;
368373
deckLinkInput->PauseStreams();
369374
BMDPixelFormat pf{};
370375
if (HRESULT result = set_display_mode_properties(s, device.tile, mode, /* out */ &pf); FAILED(result)) {

0 commit comments

Comments
 (0)