X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=futatabi%2Fflags.cpp;h=a8ae958668ab0653d83cd6239efbc810d8b1ee10;hb=refs%2Fheads%2Fmaster;hp=c5bc722f5c6fa2eaeb3eecaf24a981da004cf2e8;hpb=a6f3a2275ad116e6ab338e583ab8ef1b1141b468;p=nageru diff --git a/futatabi/flags.cpp b/futatabi/flags.cpp index c5bc722..a8ae958 100644 --- a/futatabi/flags.cpp +++ b/futatabi/flags.cpp @@ -17,8 +17,9 @@ enum LongOption { OPTION_SLOW_DOWN_INPUT = 1001, OPTION_HTTP_PORT = 1002, OPTION_TALLY_URL = 1003, - OPTION_CUE_POINT_PADDING = 1004, - OPTION_MIDI_MAPPING = 1005 + OPTION_CUE_IN_POINT_PADDING = 1004, + OPTION_CUE_OUT_POINT_PADDING = 1005, + OPTION_MIDI_MAPPING = 1006 }; void usage() @@ -37,11 +38,13 @@ void usage() fprintf(stderr, " 2 = default (realtime 720p on fast embedded GPUs)\n"); fprintf(stderr, " 3 = good (realtime 720p on GTX 970 or so)\n"); fprintf(stderr, " 4 = best (not realtime on any current GPU)\n"); - fprintf(stderr, " --cue-point-padding SECS move cue-in/cue-out N seconds earlier/later on set\n"); + fprintf(stderr, " --cue-in-point-padding SECS move cue-in N seconds earlier on set\n"); + fprintf(stderr, " --cue-out-point-padding SECS move cue-out N seconds later on set\n"); fprintf(stderr, " -d, --working-directory DIR where to store frames and database\n"); fprintf(stderr, " --http-port PORT which port to listen on for output\n"); fprintf(stderr, " --tally-url URL URL to get tally color from (polled every 100 ms)\n"); fprintf(stderr, " --midi-mapping=FILE start with the given MIDI controller mapping\n"); + fprintf(stderr, " -l --source-label NUM:LABEL label source NUM as LABEL, if visible\n"); } void parse_flags(int argc, char *const argv[]) @@ -56,13 +59,15 @@ void parse_flags(int argc, char *const argv[]) { "working-directory", required_argument, 0, 'd' }, { "http-port", required_argument, 0, OPTION_HTTP_PORT }, { "tally-url", required_argument, 0, OPTION_TALLY_URL }, - { "cue-point-padding", required_argument, 0, OPTION_CUE_POINT_PADDING }, + { "cue-in-point-padding", required_argument, 0, OPTION_CUE_IN_POINT_PADDING }, + { "cue-out-point-padding", required_argument, 0, OPTION_CUE_OUT_POINT_PADDING }, { "midi-mapping", required_argument, 0, OPTION_MIDI_MAPPING }, + { "source-label", required_argument, 0, 'l' }, { 0, 0, 0, 0 } }; for (;;) { int option_index = 0; - int c = getopt_long(argc, argv, "w:h:r:q:d:", long_options, &option_index); + int c = getopt_long(argc, argv, "w:h:r:q:d:l:", long_options, &option_index); if (c == -1) { break; @@ -96,15 +101,31 @@ void parse_flags(int argc, char *const argv[]) case 'd': global_flags.working_directory = optarg; break; + case 'l': { + int prefix_len; + unsigned channel_idx; + if (sscanf(optarg, "%u:%n", &channel_idx, &prefix_len) == 1) { + const char *label = optarg + prefix_len; + global_flags.source_labels[channel_idx] = label; + } else { + fprintf(stderr, "Invalid source label format (must be on the form NUM:LABEL)\n"); + exit(1); + } + break; + } case OPTION_HTTP_PORT: global_flags.http_port = atoi(optarg); break; case OPTION_TALLY_URL: global_flags.tally_url = optarg; break; - case OPTION_CUE_POINT_PADDING: - global_flags.cue_point_padding_seconds = atof(optarg); - global_flags.cue_point_padding_set = true; + case OPTION_CUE_IN_POINT_PADDING: + global_flags.cue_in_point_padding_seconds = atof(optarg); + global_flags.cue_in_point_padding_set = true; + break; + case OPTION_CUE_OUT_POINT_PADDING: + global_flags.cue_out_point_padding_seconds = atof(optarg); + global_flags.cue_out_point_padding_set = true; break; case OPTION_MIDI_MAPPING: global_flags.midi_mapping_filename = optarg; @@ -125,7 +146,8 @@ void parse_flags(int argc, char *const argv[]) usage(); exit(1); } - if (global_flags.cue_point_padding_seconds < 0.0) { + if (global_flags.cue_in_point_padding_seconds < 0.0 || + global_flags.cue_out_point_padding_seconds < 0.0) { fprintf(stderr, "Cue point padding cannot be negative.\n"); usage(); exit(1);