From 010dae03ad094e48656e75e752937cd3e6a95205 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Wed, 24 Jan 2024 10:23:59 +0100 Subject: [PATCH] vcap/dshow: print streaming/grab type Instead of getting full format from vidcap_dshow_get_video_desc(), which translates the source pixel format to UG one, use the FourCC directly. Do write just the format, the same for grabber and then the complete output format (after eventual UG conversion). Except of the format, every other parameters should be currently the same. The previous approuach didn't work when there was either no VFW->UG mapping (I420 etc.) or there was not 1:1 mapping, eg. NV12 was displayed as UYVY because the conversion is such, which might be misleading. --- src/video_capture/DirectShowGrabber.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/video_capture/DirectShowGrabber.cpp b/src/video_capture/DirectShowGrabber.cpp index 390502053..51adcf17d 100644 --- a/src/video_capture/DirectShowGrabber.cpp +++ b/src/video_capture/DirectShowGrabber.cpp @@ -935,9 +935,9 @@ static int vidcap_dshow_init(struct vidcap_params *params, void **state) { s->desc.color_spec = get_ug_codec(&mediaType->subtype); if (s->desc.color_spec == VC_NONE) { MSG(WARNING, - "Pixel format %.4s not supported directly, " + "Pixel format %s not supported directly, " "capturing BGR.\n", - (char *) &mediaType->subtype.Data1); + GetSubtypeName(&mediaType->subtype)); s->desc.color_spec = BGR; } else { res = s->sampleGrabber->SetMediaType(mediaType); @@ -1051,11 +1051,10 @@ static int vidcap_dshow_init(struct vidcap_params *params, void **state) { res = s->sampleGrabber->GetConnectedMediaType(&sampleGrabberMT); HANDLE_ERR(res, "Cannot get current grabber format"); - LOG(LOG_LEVEL_INFO) - << MOD_NAME - << "streaming format: " << vidcap_dshow_get_video_desc(mediaType) - << "; grabber format: " - << vidcap_dshow_get_video_desc(&sampleGrabberMT) << "\n"; + MSG(INFO, "streaming type: %s, grabber type: %s, output: %s\n", + GetSubtypeName(&mediaType->subtype), + GetSubtypeName(&sampleGrabberMT.subtype), + ((string) vidcap_dshow_get_video_desc(&sampleGrabberMT)).c_str()); s->convert = get_conversion(&sampleGrabberMT.subtype); DeleteMediaType(mediaType);