[FFmpeg-devel] [PATCH] lavfi/aevalsrc: try to honor specified duration

Stefano Sabatini stefasab at gmail.com
Sat Jan 12 17:31:47 CET 2013


On date Saturday 2013-01-12 14:32:03 +0100, Matthieu Bouron encoded:
> If nb_samples divide sample_rate and if nb_samples allow it, aevalsrc
> should generate the exact amount of samples according to duration.
> 
> Example:
> aevalsrc=0::n=480:s=48000:d=5.21 should generate 250080 samples.
> ---
>  libavfilter/asrc_aevalsrc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavfilter/asrc_aevalsrc.c b/libavfilter/asrc_aevalsrc.c
> index 3315f1f..106b59a 100644
> --- a/libavfilter/asrc_aevalsrc.c
> +++ b/libavfilter/asrc_aevalsrc.c
> @@ -214,9 +214,9 @@ static int request_frame(AVFilterLink *outlink)
>      EvalContext *eval = outlink->src->priv;
>      AVFilterBufferRef *samplesref;
>      int i, j;
> -    double t = eval->var_values[VAR_N] * (double)1/eval->sample_rate;
> +    double t = (eval->var_values[VAR_N] + 1) * (double)1/eval->sample_rate;
>  
> -    if (eval->duration >= 0 && t > eval->duration)
> +    if (eval->duration >= 0 && t >= eval->duration)
>          return AVERROR_EOF;

Applied a variant of this, thanks.
-- 
FFmpeg = Fiendish and Free Mythic Patchable Enchanting Governor


More information about the ffmpeg-devel mailing list