fftools/cmdutils: return AVERROR_EXIT for OPT_EXIT options instead of aborting()

pull/389/head
Anton Khirnov 2 years ago
parent 8173623e39
commit eda1fac27a
  1. 2
      fftools/cmdutils.c
  2. 3
      fftools/ffmpeg.c
  3. 2
      fftools/ffmpeg_opt.c
  4. 2
      fftools/ffplay.c
  5. 2
      fftools/ffprobe.c

@ -320,7 +320,7 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt,
}
}
if (po->flags & OPT_EXIT)
exit_program(0);
return AVERROR_EXIT;
return 0;
}

@ -1371,6 +1371,9 @@ int main(int argc, char **argv)
err_rate_exceeded ? 69 : ret;
finish:
if (ret == AVERROR_EXIT)
ret = 0;
exit_program(ret);
return ret;
}

@ -1345,7 +1345,7 @@ int ffmpeg_parse_options(int argc, char **argv)
fail:
uninit_parse_context(&octx);
if (ret < 0) {
if (ret < 0 && ret != AVERROR_EXIT) {
av_log(NULL, AV_LOG_FATAL, "Error %s: %s\n",
errmsg ? errmsg : "", av_err2str(ret));
}

@ -3657,7 +3657,7 @@ int main(int argc, char **argv)
ret = parse_options(NULL, argc, argv, options, opt_input_file);
if (ret < 0)
exit(1);
exit(ret == AVERROR_EXIT ? 0 : 1);
if (!input_filename) {
show_usage();

@ -4129,7 +4129,7 @@ int main(int argc, char **argv)
show_banner(argc, argv, options);
ret = parse_options(NULL, argc, argv, options, opt_input_file);
if (ret < 0)
exit_program(1);
exit_program(ret == AVERROR_EXIT ? 0 : 1);
if (do_show_log)
av_log_set_callback(log_callback);

Loading…
Cancel
Save