This reduces from 3 to 2 messages for the same syntax error in ffprobe, and from 4 to 3 in filters.tags/n1.0
@@ -457,10 +457,8 @@ static av_cold int default_init(WriterContext *wctx, const char *args, void *opa | |||||
av_opt_set_defaults(def); | av_opt_set_defaults(def); | ||||
if (args && | if (args && | ||||
(err = (av_set_options_string(def, args, "=", ":"))) < 0) { | |||||
av_log(wctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); | |||||
(err = (av_set_options_string(def, args, "=", ":"))) < 0) | |||||
return err; | return err; | ||||
} | |||||
return 0; | return 0; | ||||
} | } | ||||
@@ -650,10 +648,8 @@ static av_cold int compact_init(WriterContext *wctx, const char *args, void *opa | |||||
av_opt_set_defaults(compact); | av_opt_set_defaults(compact); | ||||
if (args && | if (args && | ||||
(err = (av_set_options_string(compact, args, "=", ":"))) < 0) { | |||||
av_log(wctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); | |||||
(err = (av_set_options_string(compact, args, "=", ":"))) < 0) | |||||
return err; | return err; | ||||
} | |||||
if (strlen(compact->item_sep_str) != 1) { | if (strlen(compact->item_sep_str) != 1) { | ||||
av_log(wctx, AV_LOG_ERROR, "Item separator '%s' specified, but must contain a single character\n", | av_log(wctx, AV_LOG_ERROR, "Item separator '%s' specified, but must contain a single character\n", | ||||
compact->item_sep_str); | compact->item_sep_str); | ||||
@@ -808,10 +804,8 @@ static av_cold int flat_init(WriterContext *wctx, const char *args, void *opaque | |||||
av_opt_set_defaults(flat); | av_opt_set_defaults(flat); | ||||
if (args && | if (args && | ||||
(err = (av_set_options_string(flat, args, "=", ":"))) < 0) { | |||||
av_log(wctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); | |||||
(err = (av_set_options_string(flat, args, "=", ":"))) < 0) | |||||
return err; | return err; | ||||
} | |||||
if (strlen(flat->sep_str) != 1) { | if (strlen(flat->sep_str) != 1) { | ||||
av_log(wctx, AV_LOG_ERROR, "Item separator '%s' specified, but must contain a single character\n", | av_log(wctx, AV_LOG_ERROR, "Item separator '%s' specified, but must contain a single character\n", | ||||
flat->sep_str); | flat->sep_str); | ||||
@@ -966,10 +960,8 @@ static av_cold int ini_init(WriterContext *wctx, const char *args, void *opaque) | |||||
ini->class = &ini_class; | ini->class = &ini_class; | ||||
av_opt_set_defaults(ini); | av_opt_set_defaults(ini); | ||||
if (args && (err = av_set_options_string(ini, args, "=", ":")) < 0) { | |||||
av_log(wctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); | |||||
if (args && (err = av_set_options_string(ini, args, "=", ":")) < 0) | |||||
return err; | return err; | ||||
} | |||||
return 0; | return 0; | ||||
} | } | ||||
@@ -1125,10 +1117,8 @@ static av_cold int json_init(WriterContext *wctx, const char *args, void *opaque | |||||
av_opt_set_defaults(json); | av_opt_set_defaults(json); | ||||
if (args && | if (args && | ||||
(err = (av_set_options_string(json, args, "=", ":"))) < 0) { | |||||
av_log(wctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); | |||||
(err = (av_set_options_string(json, args, "=", ":"))) < 0) | |||||
return err; | return err; | ||||
} | |||||
json->item_sep = json->compact ? ", " : ",\n"; | json->item_sep = json->compact ? ", " : ",\n"; | ||||
json->item_start_end = json->compact ? " " : "\n"; | json->item_start_end = json->compact ? " " : "\n"; | ||||
@@ -1350,10 +1340,8 @@ static av_cold int xml_init(WriterContext *wctx, const char *args, void *opaque) | |||||
av_opt_set_defaults(xml); | av_opt_set_defaults(xml); | ||||
if (args && | if (args && | ||||
(err = (av_set_options_string(xml, args, "=", ":"))) < 0) { | |||||
av_log(wctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); | |||||
(err = (av_set_options_string(xml, args, "=", ":"))) < 0) | |||||
return err; | return err; | ||||
} | |||||
if (xml->xsd_strict) { | if (xml->xsd_strict) { | ||||
xml->fully_qualified = 1; | xml->fully_qualified = 1; | ||||
@@ -94,10 +94,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args) | |||||
s->class = &aformat_class; | s->class = &aformat_class; | ||||
av_opt_set_defaults(s); | av_opt_set_defaults(s); | ||||
if ((ret = av_set_options_string(s, args, "=", ":")) < 0) { | |||||
av_log(ctx, AV_LOG_ERROR, "Error parsing options string '%s'.\n", args); | |||||
if ((ret = av_set_options_string(s, args, "=", ":")) < 0) | |||||
return ret; | return ret; | ||||
} | |||||
PARSE_FORMATS(s->formats_str, enum AVSampleFormat, s->formats, | PARSE_FORMATS(s->formats_str, enum AVSampleFormat, s->formats, | ||||
ff_add_format, av_get_sample_fmt, AV_SAMPLE_FMT_NONE, "sample format"); | ff_add_format, av_get_sample_fmt, AV_SAMPLE_FMT_NONE, "sample format"); | ||||
@@ -487,10 +487,8 @@ static int init(AVFilterContext *ctx, const char *args) | |||||
s->class = &amix_class; | s->class = &amix_class; | ||||
av_opt_set_defaults(s); | av_opt_set_defaults(s); | ||||
if ((ret = av_set_options_string(s, args, "=", ":")) < 0) { | |||||
av_log(ctx, AV_LOG_ERROR, "Error parsing options string '%s'.\n", args); | |||||
if ((ret = av_set_options_string(s, args, "=", ":")) < 0) | |||||
return ret; | return ret; | ||||
} | |||||
av_opt_free(s); | av_opt_free(s); | ||||
for (i = 0; i < s->nb_inputs; i++) { | for (i = 0; i < s->nb_inputs; i++) { | ||||
@@ -62,10 +62,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args) | |||||
asns->class = &asetnsamples_class; | asns->class = &asetnsamples_class; | ||||
av_opt_set_defaults(asns); | av_opt_set_defaults(asns); | ||||
if ((err = av_set_options_string(asns, args, "=", ":")) < 0) { | |||||
av_log(ctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); | |||||
if ((err = av_set_options_string(asns, args, "=", ":")) < 0) | |||||
return err; | return err; | ||||
} | |||||
asns->next_out_pts = AV_NOPTS_VALUE; | asns->next_out_pts = AV_NOPTS_VALUE; | ||||
av_log(ctx, AV_LOG_VERBOSE, "nb_out_samples:%d pad:%d\n", asns->nb_out_samples, asns->pad); | av_log(ctx, AV_LOG_VERBOSE, "nb_out_samples:%d pad:%d\n", asns->nb_out_samples, asns->pad); | ||||
@@ -63,10 +63,8 @@ static int init(AVFilterContext *ctx, const char *args) | |||||
s->class = &asyncts_class; | s->class = &asyncts_class; | ||||
av_opt_set_defaults(s); | av_opt_set_defaults(s); | ||||
if ((ret = av_set_options_string(s, args, "=", ":")) < 0) { | |||||
av_log(ctx, AV_LOG_ERROR, "Error parsing options string '%s'.\n", args); | |||||
if ((ret = av_set_options_string(s, args, "=", ":")) < 0) | |||||
return ret; | return ret; | ||||
} | |||||
av_opt_free(s); | av_opt_free(s); | ||||
return 0; | return 0; | ||||
@@ -138,10 +138,8 @@ static av_cold int channelmap_init(AVFilterContext *ctx, const char *args) | |||||
s->class = &channelmap_class; | s->class = &channelmap_class; | ||||
av_opt_set_defaults(s); | av_opt_set_defaults(s); | ||||
if ((ret = av_set_options_string(s, args, "=", ":")) < 0) { | |||||
av_log(ctx, AV_LOG_ERROR, "Error parsing options string '%s'.\n", args); | |||||
if ((ret = av_set_options_string(s, args, "=", ":")) < 0) | |||||
return ret; | return ret; | ||||
} | |||||
mapping = s->mapping_str; | mapping = s->mapping_str; | ||||
@@ -55,10 +55,8 @@ static int init(AVFilterContext *ctx, const char *arg) | |||||
s->class = &channelsplit_class; | s->class = &channelsplit_class; | ||||
av_opt_set_defaults(s); | av_opt_set_defaults(s); | ||||
if ((ret = av_set_options_string(s, arg, "=", ":")) < 0) { | |||||
av_log(ctx, AV_LOG_ERROR, "Error parsing options string '%s'.\n", arg); | |||||
if ((ret = av_set_options_string(s, arg, "=", ":")) < 0) | |||||
return ret; | return ret; | ||||
} | |||||
if (!(s->channel_layout = av_get_channel_layout(s->channel_layout_str))) { | if (!(s->channel_layout = av_get_channel_layout(s->channel_layout_str))) { | ||||
av_log(ctx, AV_LOG_ERROR, "Error parsing channel layout '%s'.\n", | av_log(ctx, AV_LOG_ERROR, "Error parsing channel layout '%s'.\n", | ||||
s->channel_layout_str); | s->channel_layout_str); | ||||
@@ -193,10 +193,8 @@ static int join_init(AVFilterContext *ctx, const char *args) | |||||
s->class = &join_class; | s->class = &join_class; | ||||
av_opt_set_defaults(s); | av_opt_set_defaults(s); | ||||
if ((ret = av_set_options_string(s, args, "=", ":")) < 0) { | |||||
av_log(ctx, AV_LOG_ERROR, "Error parsing options string '%s'.\n", args); | |||||
if ((ret = av_set_options_string(s, args, "=", ":")) < 0) | |||||
return ret; | return ret; | ||||
} | |||||
if (!(s->channel_layout = av_get_channel_layout(s->channel_layout_str))) { | if (!(s->channel_layout = av_get_channel_layout(s->channel_layout_str))) { | ||||
av_log(ctx, AV_LOG_ERROR, "Error parsing channel layout '%s'.\n", | av_log(ctx, AV_LOG_ERROR, "Error parsing channel layout '%s'.\n", | ||||
@@ -61,10 +61,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args) | |||||
silence->class = &silencedetect_class; | silence->class = &silencedetect_class; | ||||
av_opt_set_defaults(silence); | av_opt_set_defaults(silence); | ||||
if ((ret = av_set_options_string(silence, args, "=", ":")) < 0) { | |||||
av_log(ctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); | |||||
if ((ret = av_set_options_string(silence, args, "=", ":")) < 0) | |||||
return ret; | return ret; | ||||
} | |||||
silence->noise = strtod(silence->noise_str, &tail); | silence->noise = strtod(silence->noise_str, &tail); | ||||
if (!strcmp(tail, "dB")) { | if (!strcmp(tail, "dB")) { | ||||
@@ -64,10 +64,8 @@ static int init(AVFilterContext *ctx, const char *args) | |||||
null->class = &anullsrc_class; | null->class = &anullsrc_class; | ||||
av_opt_set_defaults(null); | av_opt_set_defaults(null); | ||||
if ((ret = (av_set_options_string(null, args, "=", ":"))) < 0) { | |||||
av_log(ctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); | |||||
if ((ret = (av_set_options_string(null, args, "=", ":"))) < 0) | |||||
return ret; | return ret; | ||||
} | |||||
if ((ret = ff_parse_sample_rate(&null->sample_rate, | if ((ret = ff_parse_sample_rate(&null->sample_rate, | ||||
null->sample_rate_str, ctx)) < 0) | null->sample_rate_str, ctx)) < 0) | ||||
@@ -138,10 +138,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args) | |||||
flite->class = &flite_class; | flite->class = &flite_class; | ||||
av_opt_set_defaults(flite); | av_opt_set_defaults(flite); | ||||
if ((ret = av_set_options_string(flite, args, "=", ":")) < 0) { | |||||
av_log(ctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); | |||||
if ((ret = av_set_options_string(flite, args, "=", ":")) < 0) | |||||
return ret; | return ret; | ||||
} | |||||
if (flite->list_voices) { | if (flite->list_voices) { | ||||
list_voices(ctx, "\n"); | list_voices(ctx, "\n"); | ||||
@@ -66,10 +66,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args) | |||||
av_opt_set_defaults(showwaves); | av_opt_set_defaults(showwaves); | ||||
showwaves->buf_idx = 0; | showwaves->buf_idx = 0; | ||||
if ((err = av_set_options_string(showwaves, args, "=", ":")) < 0) { | |||||
av_log(ctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); | |||||
if ((err = av_set_options_string(showwaves, args, "=", ":")) < 0) | |||||
return err; | return err; | ||||
} | |||||
return 0; | return 0; | ||||
} | } | ||||
@@ -194,10 +194,8 @@ static av_cold int init_video(AVFilterContext *ctx, const char *args) | |||||
if (equal && (!colon || equal < colon)) { | if (equal && (!colon || equal < colon)) { | ||||
av_opt_set_defaults(c); | av_opt_set_defaults(c); | ||||
ret = av_set_options_string(c, args, "=", ":"); | ret = av_set_options_string(c, args, "=", ":"); | ||||
if (ret < 0) { | |||||
av_log(ctx, AV_LOG_ERROR, "Error parsing options string: %s\n", args); | |||||
if (ret < 0) | |||||
goto fail; | goto fail; | ||||
} | |||||
} else { | } else { | ||||
if ((n = sscanf(args, "%d:%d:%127[^:]:%d:%d:%d:%d:%255c", &c->w, &c->h, pix_fmt_str, | if ((n = sscanf(args, "%d:%d:%127[^:]:%d:%d:%d:%d:%255c", &c->w, &c->h, pix_fmt_str, | ||||
&c->time_base.num, &c->time_base.den, | &c->time_base.num, &c->time_base.den, | ||||
@@ -253,10 +251,8 @@ static av_cold int init_audio(AVFilterContext *ctx, const char *args) | |||||
s->class = &abuffer_class; | s->class = &abuffer_class; | ||||
av_opt_set_defaults(s); | av_opt_set_defaults(s); | ||||
if ((ret = av_set_options_string(s, args, "=", ":")) < 0) { | |||||
av_log(ctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); | |||||
if ((ret = av_set_options_string(s, args, "=", ":")) < 0) | |||||
goto fail; | goto fail; | ||||
} | |||||
s->sample_fmt = av_get_sample_fmt(s->sample_fmt_str); | s->sample_fmt = av_get_sample_fmt(s->sample_fmt_str); | ||||
if (s->sample_fmt == AV_SAMPLE_FMT_NONE) { | if (s->sample_fmt == AV_SAMPLE_FMT_NONE) { | ||||
@@ -205,10 +205,8 @@ static av_cold int movie_init(AVFilterContext *ctx, const char *args) | |||||
return AVERROR(EINVAL); | return AVERROR(EINVAL); | ||||
} | } | ||||
if (*args++ == ':' && (ret = av_set_options_string(movie, args, "=", ":")) < 0) { | |||||
av_log(ctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); | |||||
if (*args++ == ':' && (ret = av_set_options_string(movie, args, "=", ":")) < 0) | |||||
return ret; | return ret; | ||||
} | |||||
movie->seek_point = movie->seek_point_d * 1000000 + 0.5; | movie->seek_point = movie->seek_point_d * 1000000 + 0.5; | ||||
@@ -94,10 +94,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args) | |||||
return AVERROR(EINVAL); | return AVERROR(EINVAL); | ||||
} | } | ||||
if (*args++ == ':' && (ret = av_set_options_string(ass, args, "=", ":")) < 0) { | |||||
av_log(ctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); | |||||
if (*args++ == ':' && (ret = av_set_options_string(ass, args, "=", ":")) < 0) | |||||
return ret; | return ret; | ||||
} | |||||
ass->library = ass_library_init(); | ass->library = ass_library_init(); | ||||
if (!ass->library) { | if (!ass->library) { | ||||
@@ -88,10 +88,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args) | |||||
blackdetect->class = &blackdetect_class; | blackdetect->class = &blackdetect_class; | ||||
av_opt_set_defaults(blackdetect); | av_opt_set_defaults(blackdetect); | ||||
if ((ret = av_set_options_string(blackdetect, args, "=", ":")) < 0) { | |||||
av_log(ctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); | |||||
if ((ret = av_set_options_string(blackdetect, args, "=", ":")) < 0) | |||||
return ret; | return ret; | ||||
} | |||||
return 0; | return 0; | ||||
} | } | ||||
@@ -180,10 +180,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args) | |||||
if (ret == 5) { | if (ret == 5) { | ||||
if (delogo->band < 0) | if (delogo->band < 0) | ||||
delogo->show = 1; | delogo->show = 1; | ||||
} else if ((ret = (av_set_options_string(delogo, args, "=", ":"))) < 0) { | |||||
av_log(ctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); | |||||
} else if ((ret = (av_set_options_string(delogo, args, "=", ":"))) < 0) | |||||
return ret; | return ret; | ||||
} | |||||
#define CHECK_UNSET_OPT(opt) \ | #define CHECK_UNSET_OPT(opt) \ | ||||
if (delogo->opt == -1) { \ | if (delogo->opt == -1) { \ | ||||
@@ -388,10 +388,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args) | |||||
dtext->class = &drawtext_class; | dtext->class = &drawtext_class; | ||||
av_opt_set_defaults(dtext); | av_opt_set_defaults(dtext); | ||||
if ((err = av_set_options_string(dtext, args, "=", ":")) < 0) { | |||||
av_log(ctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); | |||||
if ((err = av_set_options_string(dtext, args, "=", ":")) < 0) | |||||
return err; | return err; | ||||
} | |||||
if (!dtext->fontfile && !CONFIG_FONTCONFIG) { | if (!dtext->fontfile && !CONFIG_FONTCONFIG) { | ||||
av_log(ctx, AV_LOG_ERROR, "No font filename provided\n"); | av_log(ctx, AV_LOG_ERROR, "No font filename provided\n"); | ||||
@@ -167,10 +167,8 @@ static int init(AVFilterContext *ctx, const char *args) | |||||
cellauto->class = &cellauto_class; | cellauto->class = &cellauto_class; | ||||
av_opt_set_defaults(cellauto); | av_opt_set_defaults(cellauto); | ||||
if ((ret = av_set_options_string(cellauto, args, "=", ":")) < 0) { | |||||
av_log(ctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); | |||||
if ((ret = av_set_options_string(cellauto, args, "=", ":")) < 0) | |||||
return ret; | return ret; | ||||
} | |||||
if ((ret = av_parse_video_rate(&frame_rate, cellauto->rate)) < 0) { | if ((ret = av_parse_video_rate(&frame_rate, cellauto->rate)) < 0) { | ||||
av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: %s\n", cellauto->rate); | av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: %s\n", cellauto->rate); | ||||
@@ -228,10 +228,8 @@ static int init(AVFilterContext *ctx, const char *args) | |||||
life->class = &life_class; | life->class = &life_class; | ||||
av_opt_set_defaults(life); | av_opt_set_defaults(life); | ||||
if ((ret = av_set_options_string(life, args, "=", ":")) < 0) { | |||||
av_log(ctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); | |||||
if ((ret = av_set_options_string(life, args, "=", ":")) < 0) | |||||
return ret; | return ret; | ||||
} | |||||
if ((ret = av_parse_video_rate(&frame_rate, life->rate)) < 0) { | if ((ret = av_parse_video_rate(&frame_rate, life->rate)) < 0) { | ||||
av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: %s\n", life->rate); | av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: %s\n", life->rate); | ||||
@@ -117,10 +117,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args) | |||||
mb->class = &mandelbrot_class; | mb->class = &mandelbrot_class; | ||||
av_opt_set_defaults(mb); | av_opt_set_defaults(mb); | ||||
if ((err = (av_set_options_string(mb, args, "=", ":"))) < 0) { | |||||
av_log(ctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); | |||||
if ((err = (av_set_options_string(mb, args, "=", ":"))) < 0) | |||||
return err; | return err; | ||||
} | |||||
mb->bailout *= mb->bailout; | mb->bailout *= mb->bailout; | ||||
mb->start_scale /=mb->h; | mb->start_scale /=mb->h; | ||||
@@ -266,10 +266,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args) | |||||
test->class = &mptestsrc_class; | test->class = &mptestsrc_class; | ||||
av_opt_set_defaults(test); | av_opt_set_defaults(test); | ||||
if ((ret = (av_set_options_string(test, args, "=", ":"))) < 0) { | |||||
av_log(ctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); | |||||
if ((ret = (av_set_options_string(test, args, "=", ":"))) < 0) | |||||
return ret; | return ret; | ||||
} | |||||
if ((ret = av_parse_video_rate(&frame_rate_q, test->rate)) < 0) { | if ((ret = av_parse_video_rate(&frame_rate_q, test->rate)) < 0) { | ||||
av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: '%s'\n", test->rate); | av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: '%s'\n", test->rate); | ||||
@@ -100,10 +100,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args) | |||||
av_opt_set_defaults(test); | av_opt_set_defaults(test); | ||||
if ((ret = (av_set_options_string(test, args, "=", ":"))) < 0) { | |||||
av_log(ctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); | |||||
if ((ret = (av_set_options_string(test, args, "=", ":"))) < 0) | |||||
return ret; | return ret; | ||||
} | |||||
if ((ret = av_parse_video_rate(&frame_rate_q, test->rate)) < 0) { | if ((ret = av_parse_video_rate(&frame_rate_q, test->rate)) < 0) { | ||||
av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: '%s'\n", test->rate); | av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: '%s'\n", test->rate); | ||||