[FFmpeg-devel] [PATCH] avfilter/af_volume: add support for command
Michael Niedermayer
michaelni at gmx.at
Fri Sep 27 16:07:50 CEST 2013
On Fri, Sep 27, 2013 at 09:24:33AM +0200, Stefano Sabatini wrote:
> On date Tuesday 2013-09-24 19:27:49 +0200, Stefano Sabatini encoded:
> > On date Tuesday 2013-09-24 15:50:09 +0000, Paul B Mahol encoded:
> > > Signed-off-by: Paul B Mahol <onemda at gmail.com>
> > > ---
> > >
> > > I would prefer that there is much simpler way to do same.
> > >
> > > ---
> > >
> > > libavfilter/af_volume.c | 17 +++++++++++++++++
> > > 1 file changed, 17 insertions(+)
> >
> > Reminder: add missing docs, bump micro
> >
> > > diff --git a/libavfilter/af_volume.c b/libavfilter/af_volume.c
> > > index a777249..fc9afb7 100644
> > > --- a/libavfilter/af_volume.c
> > > +++ b/libavfilter/af_volume.c
> > > @@ -269,6 +269,22 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
> > > return ff_filter_frame(outlink, out_buf);
> > > }
> > >
> > > +static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
> > > + char *res, int res_len, int flags)
> > > +{
> > > + VolumeContext *vol = ctx->priv;
> > > + int ret;
> > > +
> > > + if (!strcmp(cmd, "volume")) {
> > > + scanf("%lf", &vol->volume);
> > > + init(ctx);
> > > + ret = 0;
> >
> > I know that it sucks, but sscanf is not the equivalent of
> > av_opt_set(). Ideally we should have an expression and use some common
> > code for init and process.
>
> Possible solution: call av_opt_get(), store the value, and call
> av_opt_set(), and re-set the old value in case of error (since IIRC
> av_opt_set() is destructive).
maybe av_opt_eval_int() could be used
>
> Adding this feature at the framework level (non-destructive flag in
> av_opt_set) would be probably a good idea.
> --
> FFmpeg = Frightening Fierce Multimedia Problematic Enlightened God
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130927/87d02a67/attachment.asc>
More information about the ffmpeg-devel
mailing list