OPTION_HTTP_AUDIO_BITRATE,
OPTION_HTTP_PORT,
OPTION_NO_TRANSCODE_AUDIO,
+ OPTION_DISABLE_AUDIO,
OPTION_FLAT_AUDIO,
OPTION_GAIN_STAGING,
OPTION_DISABLE_LOCUT,
}
if (range_end < range_begin) {
fprintf(stderr, "ERROR: Invalid range %u-%u in --mjpeg-export-cards=\n", range_begin, range_end);
- abort();
+ exit(1);
}
if (range_end >= unsigned(global_flags.num_cards)) {
// There are situations where we could possibly want to
// require more functionality the the JPEG encoder.
fprintf(stderr, "ERROR: Asked for (zero-indexed) card %u in --mjpeg-export-cards=, but there are only %u cards\n",
range_end, global_flags.num_cards);
- abort();
+ exit(1);
}
for (unsigned card_idx = range_begin; card_idx <= range_end; ++card_idx) {
if (ret.count(card_idx)) {
fprintf(stderr, "ERROR: Card %u was given twice in --mjpeg-export-cards=\n", card_idx);
- abort();
+ exit(1);
}
ret[card_idx] = stream_idx++;
}
if (program == PROGRAM_KAERU) {
fprintf(stderr, " --no-transcode-audio copy encoded audio raw from the source stream\n");
fprintf(stderr, " (requires --http-audio-codec= to be set)\n");
+ fprintf(stderr, " --disable-audio do not include any audio in the stream\n");
}
if (program == PROGRAM_NAGERU) {
fprintf(stderr, " --flat-audio start with most audio processing turned off\n");
{ "http-audio-bitrate", required_argument, 0, OPTION_HTTP_AUDIO_BITRATE },
{ "http-port", required_argument, 0, OPTION_HTTP_PORT },
{ "no-transcode-audio", no_argument, 0, OPTION_NO_TRANSCODE_AUDIO },
+ { "disable-audio", no_argument, 0, OPTION_DISABLE_AUDIO },
{ "flat-audio", no_argument, 0, OPTION_FLAT_AUDIO },
{ "gain-staging", required_argument, 0, OPTION_GAIN_STAGING },
{ "disable-locut", no_argument, 0, OPTION_DISABLE_LOCUT },
bool card_to_mjpeg_stream_export_set = false;
for ( ;; ) {
int option_index = 0;
- int c = getopt_long(argc, argv, "c:t:I:r:v:m:M:w:h:", long_options, &option_index);
+ int c = getopt_long(argc, argv, "c:o:t:I:r:v:m:M:w:h:", long_options, &option_index);
if (c == -1) {
break;
char *ptr = strchr(optarg, ',');
if (ptr == nullptr) {
fprintf(stderr, "ERROR: Invalid argument '%s' to --map-signal (needs a signal and a card number, separated by comma)\n", optarg);
- abort();
+ exit(1);
}
*ptr = '\0';
const int signal_num = atoi(optarg);
if (global_flags.default_stream_mapping.count(signal_num)) {
fprintf(stderr, "ERROR: Signal %d already mapped to card %d\n",
signal_num, global_flags.default_stream_mapping[signal_num]);
- abort();
+ exit(1);
}
global_flags.default_stream_mapping[signal_num] = card_num;
break;
case OPTION_NO_TRANSCODE_AUDIO:
global_flags.transcode_audio = false;
break;
+ case OPTION_DISABLE_AUDIO:
+ global_flags.transcode_audio = false;
+ global_flags.enable_audio = false;
+ break;
case OPTION_HTTP_X264_VIDEO:
global_flags.x264_video_to_http = true;
break;
char *ptr = strchr(optarg, ',');
if (ptr == nullptr) {
fprintf(stderr, "ERROR: Invalid argument '%s' to --input-ycbcr-interpretation (needs a card and an interpretation, separated by comma)\n", optarg);
- abort();
+ exit(1);
}
*ptr = '\0';
const int card_num = atoi(optarg);
if (card_num < 0 || card_num >= MAX_VIDEO_CARDS) {
fprintf(stderr, "ERROR: Invalid card number %d\n", card_num);
- abort();
+ exit(1);
}
YCbCrInterpretation interpretation;
interpretation.full_range = false;
} else {
fprintf(stderr, "ERROR: Invalid Y'CbCr range '%s' (must be “full” or “limited”)\n", range);
- abort();
+ exit(1);
}
}
interpretation.ycbcr_coefficients_auto = true;
if (interpretation.full_range) {
fprintf(stderr, "ERROR: Cannot use “auto” Y'CbCr coefficients with full range\n");
- abort();
+ exit(1);
}
} else {
fprintf(stderr, "ERROR: Invalid Y'CbCr coefficients '%s' (must be “rec601”, “rec709” or “auto”)\n", interpretation_str);
- abort();
+ exit(1);
}
global_flags.ycbcr_interpretation[card_num] = interpretation;
break;
case OPTION_MJPEG_EXPORT_CARDS: {
if (card_to_mjpeg_stream_export_set) {
fprintf(stderr, "ERROR: --mjpeg-export-cards given twice\n");
- abort();
+ exit(1);
}
global_flags.card_to_mjpeg_stream_export = parse_mjpeg_export_cards(optarg);
card_to_mjpeg_stream_export_set = true;
fprintf(stderr, "Unknown option '%s'\n", argv[option_index]);
fprintf(stderr, "\n");
usage(program);
- abort();
+ exit(1);
}
}
if (global_flags.uncompressed_video_to_http &&
global_flags.x264_video_to_http) {
fprintf(stderr, "ERROR: --http-uncompressed-video and --http-x264-video are mutually incompatible\n");
- abort();
+ exit(1);
}
if (global_flags.num_cards <= 0) {
fprintf(stderr, "ERROR: --num-cards must be at least 1\n");
- abort();
+ exit(1);
}
if (global_flags.output_card < -1 ||
global_flags.output_card >= global_flags.num_cards) {
fprintf(stderr, "ERROR: --output-card points to a nonexistant card\n");
- abort();
+ exit(1);
}
- if (!global_flags.transcode_audio && global_flags.stream_audio_codec_name.empty()) {
+ if (global_flags.enable_audio && !global_flags.transcode_audio && global_flags.stream_audio_codec_name.empty()) {
fprintf(stderr, "ERROR: If not transcoding audio, you must specify ahead-of-time what audio codec is in use\n");
fprintf(stderr, " (using --http-audio-codec).\n");
- abort();
+ exit(1);
}
if (global_flags.x264_speedcontrol) {
if (!global_flags.x264_preset.empty() && global_flags.x264_preset != "faster") {
if (global_flags.width <= 0 || (global_flags.width % 8) != 0 ||
global_flags.height <= 0 || (global_flags.height % 8) != 0) {
fprintf(stderr, "ERROR: --width and --height must be positive integers divisible by 8\n");
- abort();
+ exit(1);
}
for (pair<int, int> mapping : global_flags.default_stream_mapping) {
if (mapping.second >= global_flags.num_cards) {
fprintf(stderr, "ERROR: Signal %d mapped to card %d, which doesn't exist (try adjusting --num-cards)\n",
mapping.first, mapping.second);
- abort();
+ exit(1);
}
}
global_flags.ycbcr_auto_coefficients = false;
} else {
fprintf(stderr, "ERROR: --output-ycbcr-coefficients must be “rec601”, “rec709” or “auto”\n");
- abort();
+ exit(1);
}
if (global_flags.output_buffer_frames < 0.0f) {
// Actually, even zero probably won't make sense; there is some internal
// delay to the card.
fprintf(stderr, "ERROR: --output-buffer-frames can't be negative.\n");
- abort();
+ exit(1);
}
if (global_flags.output_slop_frames < 0.0f) {
fprintf(stderr, "ERROR: --output-slop-frames can't be negative.\n");
- abort();
+ exit(1);
}
if (global_flags.max_input_queue_frames < 1) {
fprintf(stderr, "ERROR: --max-input-queue-frames must be at least 1.\n");
- abort();
+ exit(1);
}
if (global_flags.max_input_queue_frames > 10) {
fprintf(stderr, "WARNING: --max-input-queue-frames has little effect over 10.\n");
if (!isinf(global_flags.x264_crf)) { // CRF mode is selected.
if (global_flags.x264_bitrate != -1) {
fprintf(stderr, "ERROR: --x264-bitrate and --x264-crf are mutually incompatible.\n");
- abort();
+ exit(1);
}
if (global_flags.x264_vbv_max_bitrate != -1 && global_flags.x264_vbv_buffer_size != -1) {
fprintf(stderr, "WARNING: VBV settings are ignored with --x264-crf.\n");