On Sun, Feb 9, 2014 at 2:21 AM, Andrew Kelley <[email protected]> wrote: > This patch adds the `compand` audio filter from ffmpeg master branch > (currently at 7f0f47b3df9d92eea0d1de94df29971b49f10777) adapted to > work with libav. > > My downstream library is successfully using this filter to allow the > user to turn up the volume gain beyond 100%: > https://github.com/andrewrk/libgroove/commit/b67b17e091d17bc9eec70f89e61fde90bbee0830 > > Some things to consider about this filter: > > In ffmpeg, an AVFilterLink has the concept of FF_LINK_FLAG_REQUEST_LOOP. > "A filter must set this flag on an output link if it may return 0 in > request_frame() without filtering a frame". > > Libav does not have this concept, so I removed the flag. The change > appears to have no effect; however perhaps someone knows better than I do. >
Please shorten the commit log, the part above is fine for the discussion, but should not go in this space. > The filter makes use of `av_strtok` to parse the input parameters, and > it appears that libav has removed that function, so I inlined it into > the filter. Same goes for `av_clipd_c`. Same for > `av_samples_alloc_array_and_samples` except it looks like ffmpeg added > that function recently. This part instead is fine here. > --- > doc/filters.texi | 74 ++++++ > libavfilter/Makefile | 1 + > libavfilter/af_compand.c | 592 > +++++++++++++++++++++++++++++++++++++++++++++++ > libavfilter/allfilters.c | 1 + > 4 files changed, 668 insertions(+) > create mode 100644 libavfilter/af_compand.c Please do a MINOR version bump in libavfilter/version.h and edit Changelog too. > > diff --git a/libavfilter/af_compand.c b/libavfilter/af_compand.c > new file mode 100644 > index 0000000..55d75af > --- /dev/null > +++ b/libavfilter/af_compand.c > @@ -0,0 +1,592 @@ > +/* > + * Copyright (c) 1999 Chris Bagwell > + * Copyright (c) 1999 Nick Bailey > + * Copyright (c) 2007 Rob Sykes <[email protected]> > + * Copyright (c) 2013 Paul B Mahol > + * Copyright (c) 2014 Andrew Kelley > + * > + * This file is part of libav. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with FFmpeg; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 > USA Big typo in the project name. > +/** > + * Clip a double value into the amin-amax range. > + * @param a value to clip > + * @param amin minimum value of the clip range > + * @param amax maximum value of the clip range > + * @return clipped value > + */ > +static av_always_inline av_const double av_clipd_c(double a, double amin, > double amax) > +{ > + av_assert2(amin <= amax); > + if (a < amin) return amin; > + else if (a > amax) return amax; > + else return a; > +} weird alignment Vittorio _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
