diff options
author | Paul B Mahol <onemda@gmail.com> | 2015-08-04 14:41:35 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2015-08-19 16:15:13 +0000 |
commit | 2fa019958b4f8d1412f0e021c0c0aa0645ec6c7a (patch) | |
tree | f17f742e8043dfde6d6f39b066ac0bcac4e8920b /libavutil/audio_fifo.c | |
parent | e6b8797b827ce3c5eb0608725db7e7e85d78864b (diff) | |
download | ffmpeg-2fa019958b4f8d1412f0e021c0c0aa0645ec6c7a.tar.gz |
avfilter: add showfreqs filter
Diffstat (limited to 'libavutil/audio_fifo.c')
-rw-r--r-- | libavutil/audio_fifo.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libavutil/audio_fifo.c b/libavutil/audio_fifo.c index 574907aa32..d5298cce4d 100644 --- a/libavutil/audio_fifo.c +++ b/libavutil/audio_fifo.c @@ -136,6 +136,25 @@ int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples) return nb_samples; } +int av_audio_fifo_peek(AVAudioFifo *af, void **data, int nb_samples) +{ + int i, ret, size; + + if (nb_samples < 0) + return AVERROR(EINVAL); + nb_samples = FFMIN(nb_samples, af->nb_samples); + if (!nb_samples) + return 0; + + size = nb_samples * af->sample_size; + for (i = 0; i < af->nb_buffers; i++) { + if ((ret = av_fifo_generic_peek(af->buf[i], data[i], size, NULL)) < 0) + return AVERROR_BUG; + } + + return nb_samples; +} + int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples) { int i, ret, size; |