static int compand_drain(AVFilterLink *outlink)

{

    AVFilterContext *ctx = outlink->src;

    CompandContext *s    = ctx->priv;

    const int channels   = outlink->channels;

    AVFrame *frame       = NULL;

    int chan, i, dindex;



    /* 2048 is to limit output frame size during drain */

    frame = ff_get_audio_buffer(outlink, FFMIN(2048, s->delay_count));

    if (!frame)

        return AVERROR(ENOMEM);

    frame->pts = s->pts;

    s->pts += av_rescale_q(frame->nb_samples,

            (AVRational){ 1, outlink->sample_rate }, outlink->time_base);




    for (chan = 0; chan < channels; chan++) {

        AVFrame *delay_frame = s->delay_frame;

        double *dbuf = (double *)delay_frame->extended_data[chan];

        double *dst = (double *)frame->extended_data[chan];

        ChanParam *cp = &s->channels[chan];



        dindex = s->delay_index;

        for (i = 0; i < frame->nb_samples; i++) {

            dst[i] = av_clipd(dbuf[dindex] * get_volume(s, cp->volume),

                    -1, 1);

            dindex = MOD(dindex + 1, s->delay_samples);

        }

    }

    s->delay_count -= frame->nb_samples;

    s->delay_index = dindex;



    return ff_filter_frame(outlink, frame);

}
static int compand_drain(AVFilterLink *outlink)

{

    AVFilterContext *ctx = outlink->src;

    CompandContext *s    = ctx->priv;

    const int channels   = outlink->channels;

    AVFrame *frame       = NULL;

    int chan, i, dindex;



    

    frame = ff_get_audio_buffer(outlink, FFMIN(2048, s->delay_count));

    if (!frame)

        return AVERROR(ENOMEM);

    frame->pts = s->pts;

    s->pts += av_rescale_q(frame->nb_samples,

            (AVRational){ 1, outlink->sample_rate }, outlink->time_base);




    for (chan = 0; chan < channels; chan++) {

        AVFrame *delay_frame = s->delay_frame;

        double *dbuf = (double *)delay_frame->extended_data[chan];

        double *dst = (double *)frame->extended_data[chan];

        ChanParam *cp = &s->channels[chan];



        dindex = s->delay_index;

        for (i = 0; i < frame->nb_samples; i++) {

            dst[i] = av_clipd(dbuf[dindex] * get_volume(s, cp->volume),

                    -1, 1);

            dindex = MOD(dindex + 1, s->delay_samples);

        }

    }

    s->delay_count -= frame->nb_samples;

    s->delay_index = dindex;



    return ff_filter_frame(outlink, frame);

}
static int FUNC_0(AVFilterLink *VAR_0)

{

    AVFilterContext *ctx = VAR_0->src;

    CompandContext *s    = ctx->priv;

    const int VAR_1   = VAR_0->VAR_1;

    AVFrame *frame       = NULL;

    int VAR_2, VAR_3, VAR_4;



    

    frame = ff_get_audio_buffer(VAR_0, FFMIN(2048, s->delay_count));

    if (!frame)

        return AVERROR(ENOMEM);

    frame->pts = s->pts;

    s->pts += av_rescale_q(frame->nb_samples,

            (AVRational){ 1, VAR_0->sample_rate }, VAR_0->time_base);




    for (VAR_2 = 0; VAR_2 < VAR_1; VAR_2++) {

        AVFrame *delay_frame = s->delay_frame;

        double *VAR_5 = (double *)delay_frame->extended_data[VAR_2];

        double *VAR_6 = (double *)frame->extended_data[VAR_2];

        ChanParam *cp = &s->VAR_1[VAR_2];



        VAR_4 = s->delay_index;

        for (VAR_3 = 0; VAR_3 < frame->nb_samples; VAR_3++) {

            VAR_6[VAR_3] = av_clipd(VAR_5[VAR_4] * get_volume(s, cp->volume),

                    -1, 1);

            VAR_4 = MOD(VAR_4 + 1, s->delay_samples);

        }

    }

    s->delay_count -= frame->nb_samples;

    s->delay_index = VAR_4;



    return ff_filter_frame(VAR_0, frame);

}
static int FUNC_0(AVFilterLink *VAR_0)
{ AVFilterContext *ctx = VAR_0->src; CompandContext *s    = ctx->priv; const int VAR_1   = VAR_0->VAR_1; AVFrame *frame       = NULL; int VAR_2, VAR_3, VAR_4; frame = ff_get_audio_buffer(VAR_0, FFMIN(2048, s->delay_count)); if (!frame)
return AVERROR(ENOMEM); frame->pts = s->pts; s->pts += av_rescale_q(frame->nb_samples,
(AVRational){ 1, VAR_0->sample_rate }, VAR_0->time_base); for (VAR_2 = 0; VAR_2 < VAR_1; VAR_2++) { AVFrame *delay_frame = s->delay_frame; double *VAR_5 = (double *)delay_frame->extended_data[VAR_2]; double *VAR_6 = (double *)frame->extended_data[VAR_2]; ChanParam *cp = &s->VAR_1[VAR_2]; VAR_4 = s->delay_index; for (VAR_3 = 0; VAR_3 < frame->nb_samples; VAR_3++) { VAR_6[VAR_3] = av_clipd(VAR_5[VAR_4] * get_volume(s, cp->volume),
-1, 1); VAR_4 = MOD(VAR_4 + 1, s->delay_samples); } } s->delay_count -= frame->nb_samples; s->delay_index = VAR_4; return ff_filter_frame(VAR_0, frame); }