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)
This commit is contained in:
Martin Pulec
2024-08-16 15:37:00 +02:00
parent 8f2239374f
commit 6fdee3e08f

View File

@@ -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"