From 6fdee3e08f94d892a82e67972b6bf646fa50321e Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Fri, 16 Aug 2024 15:37:00 +0200 Subject: [PATCH] vcap/dshow: improved new-lines in help - avoid extra NL for even number of modes - print NL before Mode flags for shorthelp (otherwise it will be just after last device in the short mode) --- src/video_capture/DirectShowGrabber.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video_capture/DirectShowGrabber.cpp b/src/video_capture/DirectShowGrabber.cpp index 26e4bf0fb..e765f5779 100644 --- a/src/video_capture/DirectShowGrabber.cpp +++ b/src/video_capture/DirectShowGrabber.cpp @@ -377,11 +377,11 @@ show_help(struct vidcap_dshow_state *s, const char *help_str) int i = 0; // iterate over all capabilities while (strlen(cards[n].modes[i].id) > 0) { + fputs(i == 0 ? "" : i % 2 == 0 ? "\n" : "\t", stdout); int mode_idx = -1; sscanf(cards[n].modes[i].id, "{\"mode\":\"%d", &mode_idx); UG_ASSERT_NO_FATAL(mode_idx != -1); printf(" Mode %2d: %s", mode_idx, cards[n].modes[i].name); - putchar(i % 2 == 1 ? '\n' : '\t'); ++i; } @@ -390,7 +390,7 @@ show_help(struct vidcap_dshow_state *s, const char *help_str) deleter = IF_NOT_NULL_ELSE(deleter, (void (*)(void *)) free); deleter(cards); - printf("Mode flags:\n"); + printf("%sMode flags:\n", short_h ? "\n" : ""); printf("C - codec not natively supported by UG%s\n\n", full_h ? "; F - video format is " "not supported"