1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Remove "Error parsing options string [...]" messages.

This reduces from 3 to 2 messages for the same syntax error in ffprobe,
and from 4 to 3 in filters.
This commit is contained in:
Clément Bœsch 2012-08-09 00:49:27 +02:00
parent 5d8e54fe1d
commit cc650cf029
23 changed files with 29 additions and 87 deletions

View File

@ -457,10 +457,8 @@ static av_cold int default_init(WriterContext *wctx, const char *args, void *opa
av_opt_set_defaults(def);
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 0;
}
@ -650,10 +648,8 @@ static av_cold int compact_init(WriterContext *wctx, const char *args, void *opa
av_opt_set_defaults(compact);
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;
}
if (strlen(compact->item_sep_str) != 1) {
av_log(wctx, AV_LOG_ERROR, "Item separator '%s' specified, but must contain a single character\n",
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);
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;
}
if (strlen(flat->sep_str) != 1) {
av_log(wctx, AV_LOG_ERROR, "Item separator '%s' specified, but must contain a single character\n",
flat->sep_str);
@ -966,10 +960,8 @@ static av_cold int ini_init(WriterContext *wctx, const char *args, void *opaque)
ini->class = &ini_class;
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 0;
}
@ -1125,10 +1117,8 @@ static av_cold int json_init(WriterContext *wctx, const char *args, void *opaque
av_opt_set_defaults(json);
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;
}
json->item_sep = 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);
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;
}
if (xml->xsd_strict) {
xml->fully_qualified = 1;

View File

@ -94,10 +94,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
s->class = &aformat_class;
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;
}
PARSE_FORMATS(s->formats_str, enum AVSampleFormat, s->formats,
ff_add_format, av_get_sample_fmt, AV_SAMPLE_FMT_NONE, "sample format");

View File

@ -487,10 +487,8 @@ static int init(AVFilterContext *ctx, const char *args)
s->class = &amix_class;
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;
}
av_opt_free(s);
for (i = 0; i < s->nb_inputs; i++) {

View File

@ -62,10 +62,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
asns->class = &asetnsamples_class;
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;
}
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);

View File

@ -63,10 +63,8 @@ static int init(AVFilterContext *ctx, const char *args)
s->class = &asyncts_class;
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;
}
av_opt_free(s);
return 0;

View File

@ -138,10 +138,8 @@ static av_cold int channelmap_init(AVFilterContext *ctx, const char *args)
s->class = &channelmap_class;
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;
}
mapping = s->mapping_str;

View File

@ -55,10 +55,8 @@ static int init(AVFilterContext *ctx, const char *arg)
s->class = &channelsplit_class;
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;
}
if (!(s->channel_layout = av_get_channel_layout(s->channel_layout_str))) {
av_log(ctx, AV_LOG_ERROR, "Error parsing channel layout '%s'.\n",
s->channel_layout_str);

View File

@ -193,10 +193,8 @@ static int join_init(AVFilterContext *ctx, const char *args)
s->class = &join_class;
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;
}
if (!(s->channel_layout = av_get_channel_layout(s->channel_layout_str))) {
av_log(ctx, AV_LOG_ERROR, "Error parsing channel layout '%s'.\n",

View File

@ -61,10 +61,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
silence->class = &silencedetect_class;
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;
}
silence->noise = strtod(silence->noise_str, &tail);
if (!strcmp(tail, "dB")) {

View File

@ -64,10 +64,8 @@ static int init(AVFilterContext *ctx, const char *args)
null->class = &anullsrc_class;
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;
}
if ((ret = ff_parse_sample_rate(&null->sample_rate,
null->sample_rate_str, ctx)) < 0)

View File

@ -138,10 +138,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
flite->class = &flite_class;
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;
}
if (flite->list_voices) {
list_voices(ctx, "\n");

View File

@ -66,10 +66,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
av_opt_set_defaults(showwaves);
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 0;
}

View File

@ -194,10 +194,8 @@ static av_cold int init_video(AVFilterContext *ctx, const char *args)
if (equal && (!colon || equal < colon)) {
av_opt_set_defaults(c);
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;
}
} else {
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,
@ -253,10 +251,8 @@ static av_cold int init_audio(AVFilterContext *ctx, const char *args)
s->class = &abuffer_class;
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;
}
s->sample_fmt = av_get_sample_fmt(s->sample_fmt_str);
if (s->sample_fmt == AV_SAMPLE_FMT_NONE) {

View File

@ -205,10 +205,8 @@ static av_cold int movie_init(AVFilterContext *ctx, const char *args)
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;
}
movie->seek_point = movie->seek_point_d * 1000000 + 0.5;

View File

@ -94,10 +94,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
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;
}
ass->library = ass_library_init();
if (!ass->library) {

View File

@ -88,10 +88,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
blackdetect->class = &blackdetect_class;
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 0;
}

View File

@ -180,10 +180,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
if (ret == 5) {
if (delogo->band < 0)
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;
}
#define CHECK_UNSET_OPT(opt) \
if (delogo->opt == -1) { \

View File

@ -388,10 +388,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
dtext->class = &drawtext_class;
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;
}
if (!dtext->fontfile && !CONFIG_FONTCONFIG) {
av_log(ctx, AV_LOG_ERROR, "No font filename provided\n");

View File

@ -167,10 +167,8 @@ static int init(AVFilterContext *ctx, const char *args)
cellauto->class = &cellauto_class;
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;
}
if ((ret = av_parse_video_rate(&frame_rate, cellauto->rate)) < 0) {
av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: %s\n", cellauto->rate);

View File

@ -228,10 +228,8 @@ static int init(AVFilterContext *ctx, const char *args)
life->class = &life_class;
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;
}
if ((ret = av_parse_video_rate(&frame_rate, life->rate)) < 0) {
av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: %s\n", life->rate);

View File

@ -117,10 +117,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
mb->class = &mandelbrot_class;
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;
}
mb->bailout *= mb->bailout;
mb->start_scale /=mb->h;

View File

@ -266,10 +266,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
test->class = &mptestsrc_class;
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;
}
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);

View File

@ -100,10 +100,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
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;
}
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);