From 1e89f74902c60db08828dab980e408a4b65811c8 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Wed, 10 Jul 2013 19:08:16 +0000 Subject: [PATCH] lavfi/afade: use av_rescale() Should not make a difference, but its good idea. Signed-off-by: Paul B Mahol --- libavfilter/af_afade.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libavfilter/af_afade.c b/libavfilter/af_afade.c index baced60a32..92e41cc733 100644 --- a/libavfilter/af_afade.c +++ b/libavfilter/af_afade.c @@ -200,11 +200,10 @@ FADE(flt, float) FADE(s16, int16_t) FADE(s32, int32_t) -static int config_output(AVFilterLink *outlink) +static int config_input(AVFilterLink *inlink) { - AVFilterContext *ctx = outlink->src; + AVFilterContext *ctx = inlink->dst; AudioFadeContext *afade = ctx->priv; - AVFilterLink *inlink = ctx->inputs[0]; switch (inlink->format) { case AV_SAMPLE_FMT_DBL: afade->fade_samples = fade_samples_dbl; break; @@ -218,9 +217,9 @@ static int config_output(AVFilterLink *outlink) } if (afade->duration) - afade->nb_samples = afade->duration * inlink->sample_rate / AV_TIME_BASE; + afade->nb_samples = av_rescale(afade->duration, inlink->sample_rate, AV_TIME_BASE); if (afade->start_time) - afade->start_sample = afade->start_time * inlink->sample_rate / AV_TIME_BASE; + afade->start_sample = av_rescale(afade->start_time, inlink->sample_rate, AV_TIME_BASE); return 0; } @@ -275,6 +274,7 @@ static const AVFilterPad avfilter_af_afade_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, + .config_props = config_input, }, { NULL } }; @@ -283,7 +283,6 @@ static const AVFilterPad avfilter_af_afade_outputs[] = { { .name = "default", .type = AVMEDIA_TYPE_AUDIO, - .config_props = config_output, }, { NULL } };