static int reconfigure_filter(BufferSourceContext *abuffer, AVFilterContext *filt_ctx)
{
    int ret;
    AVFilterLink * const inlink  = filt_ctx->inputs[0];
    AVFilterLink * const outlink = filt_ctx->outputs[0];

    inlink->format         = abuffer->sample_format;
    inlink->channel_layout = abuffer->channel_layout;
    inlink->planar         = abuffer->packing_format;
    inlink->sample_rate    = abuffer->sample_rate;

    filt_ctx->filter->uninit(filt_ctx);
    memset(filt_ctx->priv, 0, filt_ctx->filter->priv_size);
    if ((ret = filt_ctx->filter->init(filt_ctx, NULL , NULL)) < 0)
        return ret;
    if ((ret = inlink->srcpad->config_props(inlink)) < 0)
        return ret;
    return outlink->srcpad->config_props(outlink);
}