[FFmpeg-devel] [PATCH] lavfi: add compand filter

Stefano Sabatini stefasab at gmail.com
Sat Jul 27 17:12:56 CEST 2013


On date Saturday 2013-07-27 14:29:32 +0000, Paul B Mahol encoded:
> On 7/27/13, Stefano Sabatini <stefasab at gmail.com> wrote:
[...]
> >> +static int request_frame(AVFilterLink *outlink)
> >> +{
> >> +    AVFilterContext *ctx = outlink->src;
> >> +    CompandContext *s = ctx->priv;
> >> +    int ret;
> >> +
> >> +    ret = ff_request_frame(ctx->inputs[0]);
> >> +
> >> +    if (ret == AVERROR_EOF && !ctx->is_disabled && s->delay_count)
> >> +        ret = compand_drain(outlink);
> >> +
> >> +    return ret;
> >> +}
> >> +
> >> +static const AVFilterPad compand_inputs[] = {
> >> +    {
> >> +        .name         = "default",
> >> +        .type         = AVMEDIA_TYPE_AUDIO,
> >> +        .filter_frame = filter_frame,
> >> +    },
> >> +    { NULL },
> >> +};
> >> +
> >> +static const AVFilterPad compand_outputs[] = {
> >> +    {
> >> +        .name          = "default",
> >> +        .request_frame = request_frame,
> >> +        .config_props  = config_output,
> >> +        .type          = AVMEDIA_TYPE_AUDIO,
> >> +    },
> >> +    { NULL },
> >> +};
> >> +
> >> +AVFilter avfilter_af_compand = {
> >> +    .name          = "compand",
> >> +    .description   = NULL_IF_CONFIG_SMALL("Compress or expand the dynamic
> >> range of the audio."),
> >> +    .query_formats = query_formats,
> >> +    .priv_size     = sizeof(CompandContext),
> >> +    .priv_class    = &compand_class,
> >> +    .init          = init,
> >> +    .uninit        = uninit,
> >> +    .inputs        = compand_inputs,
> >> +    .outputs       = compand_outputs,
> >> +};
> >
> > No timeline?
> 
> How would you want to do it?

I see that you are using is_disabled above, feel free to leave it to a
further patch.

> 
> Possible implementation: if not enabled just feed samples to volume
> adjuster but do not actually modify samples.
-- 
FFmpeg = Frenzy Furious Mastodontic Portentous Eager Generator


More information about the ffmpeg-devel mailing list