[FFmpeg-devel] [PATCH] lavfi/ass: extend syntax for ass filter

Stefano Sabatini stefasab at gmail.com
Mon Oct 15 22:47:40 CEST 2012


On date Monday 2012-10-15 21:59:13 +0200, Clément Bœsch encoded:
> On Mon, Oct 15, 2012 at 10:09:27AM +0200, Stefano Sabatini wrote:
[...]
> > @@ -83,21 +85,20 @@ static void ass_log(int ass_level, const char *fmt, va_list args, void *ctx)
> >  static av_cold int init(AVFilterContext *ctx, const char *args)
> >  {
> >      AssContext *ass = ctx->priv;
> > +    static const char *shorthand[] = { "filename", NULL };
> >      int ret;
> >  
> >      ass->class = &ass_class;
> >      av_opt_set_defaults(ass);
> >  
> > -    if (args)
> > -        ass->filename = av_get_token(&args, ":");
> > -    if (!ass->filename || !*ass->filename) {
> > +    if ((ret = av_opt_set_from_string(ass, args, shorthand, "=", ":")) < 0)
> > +        return ret;
> > +
> > +    if (!ass->filename) {
> >          av_log(ctx, AV_LOG_ERROR, "No filename provided!\n");
> >          return AVERROR(EINVAL);
> >      }
> >  
> > -    if (*args++ == ':' && (ret = av_set_options_string(ass, args, "=", ":")) < 0)
> > -        return ret;
> > -
> 
> BTW I was wondering, don't you need some av_opt_free()?

It was not necessary in this case (ass->filename was explicitly
freed), but changed anyway for extensibility reasons.

> 
> [...]
> 
> LGTM otherwise

Will push in a moment, thanks.
-- 
FFmpeg = Frenzy & Formidable Most Picky Enigmatic Guide


More information about the ffmpeg-devel mailing list