[FFmpeg-cvslog] Merge commit '0456e684394dc5a7b98ab9ebb48396d743bf3730'
Clément Bœsch
git at videolan.org
Fri Mar 24 14:18:13 EET 2017
ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Fri Mar 24 13:17:55 2017 +0100| [2a69724fd5e0d380d201a955269622239288e6d5] | committer: Clément Bœsch
Merge commit '0456e684394dc5a7b98ab9ebb48396d743bf3730'
* commit '0456e684394dc5a7b98ab9ebb48396d743bf3730':
audio_fifo: Drop write-only variable
Merged-by: Clément Bœsch <u at pkh.me>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2a69724fd5e0d380d201a955269622239288e6d5
---
libavutil/audio_fifo.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavutil/audio_fifo.c b/libavutil/audio_fifo.c
index de18710..1bf75ce 100644
--- a/libavutil/audio_fifo.c
+++ b/libavutil/audio_fifo.c
@@ -180,7 +180,7 @@ int av_audio_fifo_peek_at(AVAudioFifo *af, void **data, int nb_samples, int offs
int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples)
{
- int i, ret, size;
+ int i, size;
if (nb_samples < 0)
return AVERROR(EINVAL);
@@ -190,7 +190,7 @@ int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples)
size = nb_samples * af->sample_size;
for (i = 0; i < af->nb_buffers; i++) {
- if ((ret = av_fifo_generic_read(af->buf[i], data[i], size, NULL)) < 0)
+ if (av_fifo_generic_read(af->buf[i], data[i], size, NULL) < 0)
return AVERROR_BUG;
}
af->nb_samples -= nb_samples;
======================================================================
diff --cc libavutil/audio_fifo.c
index de18710,e9244be..1bf75ce
--- a/libavutil/audio_fifo.c
+++ b/libavutil/audio_fifo.c
@@@ -135,52 -136,9 +135,52 @@@ int av_audio_fifo_write(AVAudioFifo *af
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_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);
+
+ offset *= af->sample_size;
+ size = nb_samples * af->sample_size;
+ for (i = 0; i < af->nb_buffers; i++) {
+ if ((ret = av_fifo_generic_peek_at(af->buf[i], data[i], offset, 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;
+ int i, size;
if (nb_samples < 0)
return AVERROR(EINVAL);
More information about the ffmpeg-cvslog
mailing list