You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
fftools/ffmpeg_opt: consolidate printing errors in ffmpeg_parse_options()
This commit is contained in:
@@ -1289,6 +1289,7 @@ static int open_files(OptionGroupList *l, const char *inout,
|
|||||||
int ffmpeg_parse_options(int argc, char **argv)
|
int ffmpeg_parse_options(int argc, char **argv)
|
||||||
{
|
{
|
||||||
OptionParseContext octx;
|
OptionParseContext octx;
|
||||||
|
const char *errmsg = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
memset(&octx, 0, sizeof(octx));
|
memset(&octx, 0, sizeof(octx));
|
||||||
@@ -1297,14 +1298,14 @@ int ffmpeg_parse_options(int argc, char **argv)
|
|||||||
ret = split_commandline(&octx, argc, argv, options, groups,
|
ret = split_commandline(&octx, argc, argv, options, groups,
|
||||||
FF_ARRAY_ELEMS(groups));
|
FF_ARRAY_ELEMS(groups));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
av_log(NULL, AV_LOG_FATAL, "Error splitting the argument list: ");
|
errmsg = "splitting the argument list";
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* apply global options */
|
/* apply global options */
|
||||||
ret = parse_optgroup(NULL, &octx.global_opts);
|
ret = parse_optgroup(NULL, &octx.global_opts);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
av_log(NULL, AV_LOG_FATAL, "Error parsing global options: ");
|
errmsg = "parsing global options";
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1314,21 +1315,21 @@ int ffmpeg_parse_options(int argc, char **argv)
|
|||||||
/* open input files */
|
/* open input files */
|
||||||
ret = open_files(&octx.groups[GROUP_INFILE], "input", ifile_open);
|
ret = open_files(&octx.groups[GROUP_INFILE], "input", ifile_open);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
av_log(NULL, AV_LOG_FATAL, "Error opening input files: ");
|
errmsg = "opening input files";
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create the complex filtergraphs */
|
/* create the complex filtergraphs */
|
||||||
ret = init_complex_filters();
|
ret = init_complex_filters();
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
av_log(NULL, AV_LOG_FATAL, "Error initializing complex filters.\n");
|
errmsg = "initializing complex filters";
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* open output files */
|
/* open output files */
|
||||||
ret = open_files(&octx.groups[GROUP_OUTFILE], "output", of_open);
|
ret = open_files(&octx.groups[GROUP_OUTFILE], "output", of_open);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
av_log(NULL, AV_LOG_FATAL, "Error opening output files: ");
|
errmsg = "opening output files";
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1345,7 +1346,8 @@ int ffmpeg_parse_options(int argc, char **argv)
|
|||||||
fail:
|
fail:
|
||||||
uninit_parse_context(&octx);
|
uninit_parse_context(&octx);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
av_log(NULL, AV_LOG_FATAL, "%s\n", av_err2str(ret));
|
av_log(NULL, AV_LOG_FATAL, "Error %s: %s\n",
|
||||||
|
errmsg ? errmsg : "", av_err2str(ret));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user