Skip to content

Commit dcdeb23

Browse files
committed
vcap/declink: unclutter help
- in short (default) help, offer the most often used options only - print the available codecs/connections inline - print opts "one-line" (or multiple line but with description starting on the line); this makes it compatible with vdisp/decklink - hide old positional syntax (shown in full-help), :help not red
1 parent c257c36 commit dcdeb23

File tree

1 file changed

+89
-97
lines changed

1 file changed

+89
-97
lines changed

src/video_capture/decklink.cpp

Lines changed: 89 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -510,122 +510,116 @@ vidcap_decklink_print_card_info(IDeckLink *deckLink, const char *query_prop_fcc)
510510
RELEASE_IF_NOT_NULL(deckLinkAttributes);
511511
}
512512

513+
static void
514+
print_codecs()
515+
{
516+
color_printf("\t" TBOLD("codec") " instead of detected one, eg. "
517+
"UYVY for 8-bit capture\n");
518+
col() << "\t\t available color spaces:";
519+
for (auto & i : uv_to_bmd_codec_map) {
520+
if (i != *uv_to_bmd_codec_map.begin()) {
521+
col() << ",";
522+
}
523+
524+
col() << " " << SBOLD(get_codec_name(i.first));
525+
}
526+
cout << "\n";
527+
}
528+
529+
static void
530+
print_connections()
531+
{
532+
color_printf("\t" TBOLD("connection") " input connector, one of:");
533+
for (const auto &i : get_connection_string_map()) {
534+
col() << " " << SBOLD(i.second);
535+
}
536+
color_printf("\n");
537+
}
538+
513539
/* HELP */
514540
static int
515541
decklink_help(bool full, const char *query_prop_fcc = nullptr)
516542
{
517-
col() << "\nDeckLink options:\n";
518-
col() << SBOLD(SRED("\t-t decklink") << ":[full]help") << " | "
519-
<< SBOLD(SRED("-t decklink") << ":query=<FourCC>") << " | "
520-
<< SBOLD(SRED("-t decklink") << ":help=FourCC") << "\n";
521-
col() << SBOLD(SRED("\t-t decklink")
522-
<< "{:m[ode]=<mode>|:d[evice]=<idx|ID|name>|:c[odec]=<"
523-
"colorspace>...<key>=<"
524-
"val>}*")
525-
<< "\n";
543+
col() << "DeckLink capture usage:\n";
526544
col() << SBOLD(SRED("\t-t decklink")
527-
<< "[:<device_index(indices)>[:<mode>:<colorspace>[:3D]["
528-
":sync_timecode][:connection=<input>][:detect-"
529-
"format][:conversion=<conv_mode>]]")
545+
<< "{:d[evice]=<idx|ID|name>|:c[odec]=<colorspace>[:"
546+
"con[nection]=<con>[:mode]=<mode>|...<key>=<val>}*")
530547
<< "\n";
531-
col() << "\t(mode specification is mandatory if your card does not support format autodetection; syntax on the first line is recommended, the second is obsolescent)\n";
532-
col() << "\n";
533-
534-
col() << SBOLD("3D") << "\n";
535-
printf("\tUse this to capture 3D from supported card (eg. DeckLink HD 3D Extreme).\n");
536-
printf("\tDo not use it for eg. Quad or Duo. Availability of the mode is indicated\n");
537-
printf("\tin video format listing above by flag \"3D\".\n");
538-
printf("\n");
539-
540-
col() << SBOLD("fullhelp") << "\n";
541-
col() << "\tPrint description of all available options.\n";
542-
col() << "\n";
543-
544-
col() << SBOLD("half-duplex | full-duplex | simplex") << "\n";
545-
col() << "\tSet a profile that allows maximal number of simultaneous "
546-
"IOs / set device to better compatibility (3D, dual-link) / "
547-
"use all connectors as single input.\n";
548-
col() << "\n";
549-
550-
col() << SBOLD("[no]passthrough[=keep]") << "\n";
551-
col() << "\tDisables/enables/keeps capture passthrough (default is "
552-
"disable).\n";
553-
col() << "\n";
548+
if (full) {
549+
col() << SBOLD(
550+
SRED("\t-t decklink")
551+
<< "[:<device_index(indices)>[:<mode>:<colorspace>"
552+
"[:3D]["
553+
":sync_timecode][:connection=<input>][:detect-"
554+
"format][:conversion=<conv_mode>]]")
555+
<< " (deprecated)\n";
556+
col()
557+
<< "\t(mode specification is mandatory if your card does "
558+
"not support format autodetection)\n";
559+
}
560+
col() << "\t" << SBOLD("-t decklink" << ":[full]help") << " | "
561+
<< SBOLD("-t decklink" << ":query=<FourCC>") << " | "
562+
<< SBOLD("-t decklink" << ":help=FourCC") << "\n";
563+
col() << "\nOptions:\n";
564+
color_printf("\t" TBOLD("fullhelp") " print description of all available options\n");
565+
color_printf("\t" TBOLD("device") " device identifier (index, ID or name)\n");
566+
print_codecs();
567+
print_connections();
554568

555569
if (full) {
556-
col() << SBOLD("conversion") << "\n";
557-
col() << SBOLD("\tnone") << " - No video input conversion\n";
558-
col() << SBOLD("\t10lb") << " - HD1080 to SD video input down conversion\n";
559-
col() << SBOLD("\t10am") << " - Anamorphic from HD1080 to SD video input down conversion\n";
560-
col() << SBOLD("\t72lb") << " - Letter box from HD720 to SD video input down conversion\n";
561-
col() << SBOLD("\t72ab") << " - Letterbox video input up conversion\n";
562-
col() << SBOLD("\tamup") << " - Anamorphic video input up conversion\n";
570+
col() << "\t" SBOLD("3D") << " use this to capture 3D from supported card (eg. "
571+
"DeckLink HD 3D Extreme)\n";
572+
573+
col() << "\t" SBOLD("half-duplex|full-duplex|simplex")
574+
<< " set a profile that allows maximal number of "
575+
"simultaneous IOs / set device to better "
576+
"compatibility (3D, dual-link) / use all connectors "
577+
"as single input\n";
578+
579+
col() << "\t" SBOLD("[no]passthrough[=keep]")
580+
<< " disables/enables/keeps capture passthrough (default "
581+
"is disable)\n";
582+
583+
col() << "\t" SBOLD("conversion") << "\n";
584+
col() << SBOLD("\t\tnone") << " - No video input conversion\n";
585+
col() << SBOLD("\t\t10lb") << " - HD1080 to SD video input down conversion\n";
586+
col() << SBOLD("\t\t10am") << " - Anamorphic from HD1080 to SD video input down conversion\n";
587+
col() << SBOLD("\t\t72lb") << " - Letter box from HD720 to SD video input down conversion\n";
588+
col() << SBOLD("\t\t72ab") << " - Letterbox video input up conversion\n";
589+
col() << SBOLD("\t\tamup") << " - Anamorphic video input up conversion\n";
563590
col() << "\tThen use the set the resulting mode (!) for capture, eg. for 1080p to PAL conversion:\n"
564591
"\t\t-t decklink:mode=pal:conversion=10lb\n";
565-
col() << "\n";
566592

567-
col() << SBOLD("query=<FourCC>") << "\n";
568-
col() << "\tQueries device attribute, eg. `decklink:q=mach` to "
593+
col() << "\t" SBOLD("query=<FourCC>") << " queries device attribute, eg. `decklink:q=mach` to "
569594
"see max embed. channels).\n";
570-
col() << "\n";
571595

572-
col() << SBOLD("p_not_i") << "\n";
573-
col() << "\tIncoming signal should be treated as progressive even if detected as interlaced (PsF).\n";
574-
col() << "\n";
596+
col() << "\t" SBOLD("p_not_i") << " incoming signal should be treated as progressive even if detected as interlaced (PsF).\n";
575597

576-
col() << SBOLD("nosig-send") << "\n";
577-
col() << "\tSend video even if no signal was detected (useful when video interrupts\n"
578-
"\tbut the video stream needs to be preserved, eg. to keep sync with audio).\n";
579-
col() << "\n";
598+
col() << "\t" SBOLD("nosig-send") << " send video even if no signal was detected (useful when video interrupts"
599+
" but the video stream needs to be preserved, eg. to keep sync with audio).\n";
580600

581-
col() << SBOLD("detect-format") << "\n";
582-
col() << "\tTry to detect input video format even if the "
583-
"device doesn't support\n"
584-
"\tautodetect, eg. \"-t "
601+
col() << "\t" SBOLD("detect-format")
602+
<< " try to detect input video format even if the "
603+
"device doesn't support "
604+
"autodetect, eg. \"-t "
585605
"decklink:connection=HDMI:detect-format\".\n";
586-
col() << "\n";
587606

588-
col() << SBOLD("profile=<FourCC>") << " - use desired device profile:\n";
589-
print_bmd_device_profiles("\t");
590-
col() << "\n";
591-
col() << SBOLD("sync_timecode") << "\n";
592-
col() << "\tTry to synchronize inputs based on timecode (for multiple inputs, eg. tiled 4K)\n";
593-
col() << "\n";
594-
col() << SBOLD("keep-settings") << "\n\tdo not apply any DeckLink settings by UG than required (keep user-selected defaults)\n";
595-
col() << "\n";
596-
col() << SBOLD("<option_FourCC>=<value>") << " - arbitrary BMD option (given a FourCC) and corresponding value, i.a.:\n";
597-
col() << SBOLD("\thelp=FourCC") << "\tshow FourCC opts syntax\n";
598-
col() << SBOLD("\taacl[=no]")
607+
col() << "\t" SBOLD("profile=<FourCC>") << " - use desired device profile:\n";
608+
print_bmd_device_profiles("\t\t");
609+
col() << "\t" SBOLD("sync_timecode") << " try to synchronize inputs based on timecode (for multiple inputs, eg. tiled 4K)\n";
610+
col() << "\t" SBOLD("keep-settings") << " do not apply any DeckLink settings by UG than required (keep user-selected defaults)\n";
611+
col() << "\t" SBOLD("<option_FourCC>=<value>") << " - arbitrary BMD option (given a FourCC) and corresponding value, i.a.:\n";
612+
col() << SBOLD("\t\thelp=FourCC") << "\tshow FourCC opts syntax\n";
613+
col() << SBOLD("\t\taacl[=no]")
599614
<< "\tset analog audio levels to maximum gain "
600615
"(consumer audio level)\n";
601-
col() << SBOLD("\tcfpr[=no]")
616+
col() << SBOLD("\t\tcfpr[=no]")
602617
<< "\tincoming signal should be treated as PsF instead of progressive\n";
603618
col() << "\n";
604619
} else {
605620
col() << "(other options available, use \"" << SBOLD("fullhelp") << "\" to see complete list of options)\n\n";
606621
}
607622

608-
col() << "Available color spaces:";
609-
for (auto & i : uv_to_bmd_codec_map) {
610-
if (i != *uv_to_bmd_codec_map.begin()) {
611-
col() << ",";
612-
}
613-
614-
col() << " " << SBOLD(get_codec_name(i.first));
615-
}
616-
cout << "\n";
617-
if (!full) {
618-
col() << "Possible connections:";
619-
for (const auto &i : get_connection_string_map()) {
620-
col() << (i == *get_connection_string_map().cbegin()
621-
? " "
622-
: ", ")
623-
<< SBOLD(i.second);
624-
}
625-
cout << "\n";
626-
}
627-
cout << "\n";
628-
629623
// Create an IDeckLinkIterator object to enumerate all DeckLink cards in the system
630624
bool com_initialized = false;
631625

@@ -669,8 +663,9 @@ decklink_help(bool full, const char *query_prop_fcc = nullptr)
669663
col() << "\n(use \"-t decklink:"
670664
<< SBOLD(
671665
"fullhelp") "\" to see full list of device modes "
672-
"and available connections)\n\n";
666+
"and available connections)\n";
673667
}
668+
color_printf("\n");
674669

675670
decklink_uninitialize(&com_initialized);
676671

@@ -682,11 +677,8 @@ decklink_help(bool full, const char *query_prop_fcc = nullptr)
682677

683678
printf("Examples:\n");
684679
col() << "\t" << SBOLD(uv_argv[0] << " -t decklink")
685-
<< " # captures autodetected video from first DeckLink (index 0) "
686-
"in system\n";
687-
col() << "\t" << SBOLD(uv_argv[0] << " -t decklink:d=b:m=Hp30:c=v210")
688-
<< " # specify mode for 2nd device which doesn't have "
689-
"autodetection\n";
680+
<< " # captures from first DeckLink (index 0) in system\n";
681+
col() << "\t" << SBOLD(uv_argv[0] << " -t decklink:d=b:m=Hp30:c=v210") << "\n";
690682
col() << "\t"
691683
<< SBOLD(uv_argv[0]
692684
<< " -t decklink:d=\"DeckLink 8K Pro (1)\":profile=1dfd")

0 commit comments

Comments
 (0)