From cc650cf029d8a2aa3c245b014363db673fd2d722 Mon Sep 17 00:00:00 2001 From: Clément Bœsch Date: Thu, 9 Aug 2012 00:49:27 +0200 Subject: 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. --- ffprobe.c | 24 ++++++------------------ libavfilter/af_aformat.c | 4 +--- libavfilter/af_amix.c | 4 +--- libavfilter/af_asetnsamples.c | 4 +--- libavfilter/af_asyncts.c | 4 +--- libavfilter/af_channelmap.c | 4 +--- libavfilter/af_channelsplit.c | 4 +--- libavfilter/af_join.c | 4 +--- libavfilter/af_silencedetect.c | 4 +--- libavfilter/asrc_anullsrc.c | 4 +--- libavfilter/asrc_flite.c | 4 +--- libavfilter/avf_showwaves.c | 4 +--- libavfilter/buffersrc.c | 8 ++------ libavfilter/src_movie.c | 4 +--- libavfilter/vf_ass.c | 4 +--- libavfilter/vf_blackdetect.c | 4 +--- libavfilter/vf_delogo.c | 4 +--- libavfilter/vf_drawtext.c | 4 +--- libavfilter/vsrc_cellauto.c | 4 +--- libavfilter/vsrc_life.c | 4 +--- libavfilter/vsrc_mandelbrot.c | 4 +--- libavfilter/vsrc_mptestsrc.c | 4 +--- libavfilter/vsrc_testsrc.c | 4 +--- 23 files changed, 29 insertions(+), 87 deletions(-) diff --git a/ffprobe.c b/ffprobe.c index e1ad6a7beb..6de9eb3331 100644 --- a/ffprobe.c +++ b/ffprobe.c @@ -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; diff --git a/libavfilter/af_aformat.c b/libavfilter/af_aformat.c index 4e97942248..6cf89ace2a 100644 --- a/libavfilter/af_aformat.c +++ b/libavfilter/af_aformat.c @@ -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"); diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c index 7f83750fa1..dd5dfa91b3 100644 --- a/libavfilter/af_amix.c +++ b/libavfilter/af_amix.c @@ -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++) { diff --git a/libavfilter/af_asetnsamples.c b/libavfilter/af_asetnsamples.c index 8805d53a97..23bda8ca01 100644 --- a/libavfilter/af_asetnsamples.c +++ b/libavfilter/af_asetnsamples.c @@ -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); diff --git a/libavfilter/af_asyncts.c b/libavfilter/af_asyncts.c index 1737d6138d..0fe4570896 100644 --- a/libavfilter/af_asyncts.c +++ b/libavfilter/af_asyncts.c @@ -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; diff --git a/libavfilter/af_channelmap.c b/libavfilter/af_channelmap.c index 9e2509c30e..170fad68f6 100644 --- a/libavfilter/af_channelmap.c +++ b/libavfilter/af_channelmap.c @@ -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; diff --git a/libavfilter/af_channelsplit.c b/libavfilter/af_channelsplit.c index 3db08045c2..d15c781bf5 100644 --- a/libavfilter/af_channelsplit.c +++ b/libavfilter/af_channelsplit.c @@ -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); diff --git a/libavfilter/af_join.c b/libavfilter/af_join.c index f25ec921dc..37bad9c7ea 100644 --- a/libavfilter/af_join.c +++ b/libavfilter/af_join.c @@ -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", diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c index d3b125fc5b..bfda3e574d 100644 --- a/libavfilter/af_silencedetect.c +++ b/libavfilter/af_silencedetect.c @@ -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")) { diff --git a/libavfilter/asrc_anullsrc.c b/libavfilter/asrc_anullsrc.c index 3df542942b..008cb2a01b 100644 --- a/libavfilter/asrc_anullsrc.c +++ b/libavfilter/asrc_anullsrc.c @@ -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) diff --git a/libavfilter/asrc_flite.c b/libavfilter/asrc_flite.c index 71271be5e4..49f15da160 100644 --- a/libavfilter/asrc_flite.c +++ b/libavfilter/asrc_flite.c @@ -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"); diff --git a/libavfilter/avf_showwaves.c b/libavfilter/avf_showwaves.c index 96ed2c7ebc..e040d8ed2c 100644 --- a/libavfilter/avf_showwaves.c +++ b/libavfilter/avf_showwaves.c @@ -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; } diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c index 153ab6c0f7..6803b69500 100644 --- a/libavfilter/buffersrc.c +++ b/libavfilter/buffersrc.c @@ -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) { diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c index 56e7083869..09dfe5d214 100644 --- a/libavfilter/src_movie.c +++ b/libavfilter/src_movie.c @@ -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; diff --git a/libavfilter/vf_ass.c b/libavfilter/vf_ass.c index a40f93cc67..01adf5be5a 100644 --- a/libavfilter/vf_ass.c +++ b/libavfilter/vf_ass.c @@ -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) { diff --git a/libavfilter/vf_blackdetect.c b/libavfilter/vf_blackdetect.c index 96165d2fcd..29f6c079d5 100644 --- a/libavfilter/vf_blackdetect.c +++ b/libavfilter/vf_blackdetect.c @@ -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; } diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c index c52036228c..a80b1fe571 100644 --- a/libavfilter/vf_delogo.c +++ b/libavfilter/vf_delogo.c @@ -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) { \ diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c index ac619428ef..0f7564d383 100644 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@ -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"); diff --git a/libavfilter/vsrc_cellauto.c b/libavfilter/vsrc_cellauto.c index b2c9d5867b..971e1df64b 100644 --- a/libavfilter/vsrc_cellauto.c +++ b/libavfilter/vsrc_cellauto.c @@ -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); diff --git a/libavfilter/vsrc_life.c b/libavfilter/vsrc_life.c index c71291f271..b2b7c4a87d 100644 --- a/libavfilter/vsrc_life.c +++ b/libavfilter/vsrc_life.c @@ -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); diff --git a/libavfilter/vsrc_mandelbrot.c b/libavfilter/vsrc_mandelbrot.c index 2a8efa023d..46e037ef18 100644 --- a/libavfilter/vsrc_mandelbrot.c +++ b/libavfilter/vsrc_mandelbrot.c @@ -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; diff --git a/libavfilter/vsrc_mptestsrc.c b/libavfilter/vsrc_mptestsrc.c index 6a4df1efa4..4e312c5b8d 100644 --- a/libavfilter/vsrc_mptestsrc.c +++ b/libavfilter/vsrc_mptestsrc.c @@ -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); diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c index a7e41e0892..9640faeb88 100644 --- a/libavfilter/vsrc_testsrc.c +++ b/libavfilter/vsrc_testsrc.c @@ -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); -- cgit v1.2.3