[FFmpeg-devel] [PATCH] avfilter: add loop filters
Paul B Mahol
onemda at gmail.com
Sun Feb 14 12:44:13 CET 2016
On 2/13/16, Stefano Sabatini <stefasab at gmail.com> wrote:
> On date Friday 2016-02-12 15:28:15 +0100, Paul B Mahol encoded:
>> On 2/11/16, Paul B Mahol <onemda at gmail.com> wrote:
>> > Hi,
>> >
>> > patch attached.
>> >
>>
>> Better version attached.
>
>> From d953f78bffbf3db8f0209b41b189ece12b402afa Mon Sep 17 00:00:00 2001
>> From: Paul B Mahol <onemda at gmail.com>
>> Date: Thu, 11 Feb 2016 22:05:54 +0100
>> Subject: [PATCH] avfilter: add loop filters
>>
>> Signed-off-by: Paul B Mahol <onemda at gmail.com>
>> ---
>> libavfilter/Makefile | 2 +
>> libavfilter/allfilters.c | 2 +
>> libavfilter/f_loop.c | 339
>> +++++++++++++++++++++++++++++++++++++++++++++++
>> libavutil/audio_fifo.c | 24 ++++
>> libavutil/audio_fifo.h | 17 +++
> [...]
>> +int av_audio_fifo_peek_at(AVAudioFifo *af, void **data, int nb_samples,
>> int offset)
>> +{
>> + int i, ret, size;
>> +
>> + if (offset < 0 || offset >= af->nb_samples)
>> + return AVERROR(EINVAL);
>> + if (nb_samples < 0)
>> + return AVERROR(EINVAL);
>> + nb_samples = FFMIN(nb_samples, af->nb_samples);
>> + if (!nb_samples)
>> + return 0;
>
>> + if (offset > af->nb_samples - nb_samples)
>> + return AVERROR(EINVAL);
>
> is this check really required, or could you have something like:
> nb_samples = FFMIN(nb_samples, af->nb_samples - offset);
>
> ?
I prefer direct approach, if user supplied invalid values, notify him.
Do not try to silently guess what user wants.
More information about the ffmpeg-devel
mailing list