[FFmpeg-devel] [PATCH 4/4] lavfi/sendcmd: expose the options for both filters.

Clément Bœsch ubitux at gmail.com
Thu Nov 29 00:56:25 CET 2012


On Thu, Nov 29, 2012 at 12:39:32AM +0100, Stefano Sabatini wrote:
> On date Thursday 2012-11-29 00:14:55 +0100, Clément Bœsch encoded:
> > ---
> >  libavfilter/f_sendcmd.c | 29 ++++++++++++++++++++++++-----
> >  1 file changed, 24 insertions(+), 5 deletions(-)
> > 
> > diff --git a/libavfilter/f_sendcmd.c b/libavfilter/f_sendcmd.c
> > index 9b83935..f7b9b6d 100644
> > --- a/libavfilter/f_sendcmd.c
> > +++ b/libavfilter/f_sendcmd.c
> > @@ -89,8 +89,6 @@ static const AVOption options[] = {
> >      {NULL},
> >  };
> >  
> > -AVFILTER_DEFINE_CLASS(sendcmd);
> > -
> >  #define SPACES " \f\t\n\r"
> >  
> >  static void skip_comments(const char **buf)
> > @@ -375,7 +373,6 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
> >      SendCmdContext *sendcmd = ctx->priv;
> >      int ret, i, j;
> >  
> > -    sendcmd->class = &sendcmd_class;
> >      av_opt_set_defaults(sendcmd);
> >  
> >      if ((ret = av_set_options_string(sendcmd, args, "=", ":")) < 0)
> > @@ -518,6 +515,16 @@ end:
> >  
> >  #if CONFIG_SENDCMD_FILTER
> >  
> > +#define sendcmd_options options
> > +AVFILTER_DEFINE_CLASS(sendcmd);
> > +
> > +static av_cold int sendcmd_init(AVFilterContext *ctx, const char *args)
> > +{
> > +    SendCmdContext *sendcmd = ctx->priv;
> > +    sendcmd->class = &sendcmd_class;
> > +    return init(ctx, args);
> > +}
> > +
> >  static const AVFilterPad sendcmd_inputs[] = {
> >      {
> >          .name             = "default",
> > @@ -541,17 +548,28 @@ AVFilter avfilter_vf_sendcmd = {
> >      .name      = "sendcmd",
> >      .description = NULL_IF_CONFIG_SMALL("Send commands to filters."),
> >  
> > -    .init = init,
> > +    .init = sendcmd_init,
> >      .uninit = uninit,
> >      .priv_size = sizeof(SendCmdContext),
> >      .inputs    = sendcmd_inputs,
> >      .outputs   = sendcmd_outputs,
> > +    .priv_class = &sendcmd_class,
> >  };
> >  
> >  #endif
> >  
> >  #if CONFIG_ASENDCMD_FILTER
> >  
> > +#define asendcmd_options options
> > +AVFILTER_DEFINE_CLASS(asendcmd);
> > +
> > +static av_cold int asendcmd_init(AVFilterContext *ctx, const char *args)
> > +{
> > +    SendCmdContext *asendcmd = ctx->priv;
> > +    asendcmd->class = &asendcmd_class;
> > +    return init(ctx, args);
> > +}
> > +
> >  static const AVFilterPad asendcmd_inputs[] = {
> >      {
> >          .name             = "default",
> > @@ -574,11 +592,12 @@ AVFilter avfilter_af_asendcmd = {
> >      .name      = "asendcmd",
> >      .description = NULL_IF_CONFIG_SMALL("Send commands to filters."),
> >  
> > -    .init = init,
> > +    .init = asendcmd_init,
> >      .uninit = uninit,
> >      .priv_size = sizeof(SendCmdContext),
> >      .inputs    = asendcmd_inputs,
> >      .outputs   = asendcmd_outputs,
> > +    .priv_class = &asendcmd_class,
> >  };
> >  
> 
> This, either you add a class parameter to init, whatever you prefer.
> 

Good point, it simplifies a little.

> LGTM.

Applied, with along with the rest of the patchset.

Thanks for the fast review :)

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121129/97ebf0cd/attachment.asc>


More information about the ffmpeg-devel mailing list