From bd773219b004c3666e4114b1b4edd9589b299edf Mon Sep 17 00:00:00 2001 From: Martin Piatka Date: Tue, 9 Jul 2024 14:54:56 +0200 Subject: [PATCH] dshow: capabilities: Hint RGB conversion only when needed --- src/video_capture/DirectShowGrabber.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/video_capture/DirectShowGrabber.cpp b/src/video_capture/DirectShowGrabber.cpp index f68fbe988..8a7e1e195 100644 --- a/src/video_capture/DirectShowGrabber.cpp +++ b/src/video_capture/DirectShowGrabber.cpp @@ -503,9 +503,14 @@ vidcap_dshow_probe_internal(device_info **available_cards, int *count, continue; } + codec_t ug_codec = get_ug_codec(&mediaType->subtype); + bool force_rgb = is_codec_opaque(ug_codec) || codec_is_planar(ug_codec) || ug_codec == VIDEO_CODEC_NONE; + snprintf(cards[card_count - 1].modes[mode_idx].id, sizeof cards[card_count - 1].modes[mode_idx].id, - "{\"mode\":\"%d\"}", i); + "{\"mode\":\"%d\", " + "\"force_rgb\":\"%c\"}", + i, force_rgb ? 't' : 'f'); snprintf(cards[card_count - 1].modes[mode_idx].name, sizeof cards[card_count - 1].modes[mode_idx].name, "%s %ux%u @%0.2lf%s %s%s", GetSubtypeName(&mediaType->subtype),