[FFmpeg-devel] [PATCH] Implement options parsing for avfilter filters
Vitor Sessak
vitor1001
Sun Apr 19 13:11:36 CEST 2009
Stefano Sabatini wrote:
> Hi,
> as recently discussed, plus application to the libavfilter-soc scale
> filter.
>
> I'm not very happy with the parse_options.[hc] name, suggestions are
> welcome.
> static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
> {
> ScaleContext *scale = ctx->priv;
> char sws_opts[256];
> - char *p;
>
> /* default to no scaling */
> + scale->av_class = &vf_scale_class;
> + av_opt_set_defaults2(scale, 0, 0);
> +
> scale->w =
> scale->h = 0;
>
> @@ -55,11 +69,11 @@
> if(args)
> sscanf(args, "%d:%d:%255s", &scale->w, &scale->h, sws_opts);
>
> - if ((p = strstr(sws_opts, "sws_flags="))) {
> - char sws_flags[256];
> - sscanf(p, "sws_flags=%255[^:]", sws_flags);
> + if (avfilter_parse_options(scale, sws_opts) < 0)
Why not simply pass ctx to avfilter_parse_options()? It would avoid the
need of the CREATE_FILTER_CLASS macro...
-Vitor
More information about the ffmpeg-devel
mailing list