[FFmpeg-cvslog] lavr: make avresample_read() with NULL output discard samples.

Anton Khirnov git at videolan.org
Thu May 10 02:33:20 CEST 2012


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed May  9 06:35:13 2012 +0200| [0982b0a431060039517b35af7eae14dbf1c2ce10] | committer: Anton Khirnov

lavr: make avresample_read() with NULL output discard samples.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0982b0a431060039517b35af7eae14dbf1c2ce10
---

 libavresample/avresample.h |    3 ++-
 libavresample/utils.c      |    2 ++
 libavresample/version.h    |    2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavresample/avresample.h b/libavresample/avresample.h
index 7350805..65d4d2d 100644
--- a/libavresample/avresample.h
+++ b/libavresample/avresample.h
@@ -274,7 +274,8 @@ int avresample_available(AVAudioResampleContext *avr);
  * @see avresample_convert()
  *
  * @param avr         audio resample context
- * @param output      output data pointers
+ * @param output      output data pointers. May be NULL, in which case
+ *                    nb_samples of data is discarded from output FIFO.
  * @param nb_samples  number of samples to read from the FIFO
  * @return            the number of samples written to output
  */
diff --git a/libavresample/utils.c b/libavresample/utils.c
index f54dcc6..e533760 100644
--- a/libavresample/utils.c
+++ b/libavresample/utils.c
@@ -385,6 +385,8 @@ int avresample_available(AVAudioResampleContext *avr)
 
 int avresample_read(AVAudioResampleContext *avr, void **output, int nb_samples)
 {
+    if (!output)
+        return av_audio_fifo_drain(avr->out_fifo, nb_samples);
     return av_audio_fifo_read(avr->out_fifo, output, nb_samples);
 }
 
diff --git a/libavresample/version.h b/libavresample/version.h
index 47504c9..6211a56 100644
--- a/libavresample/version.h
+++ b/libavresample/version.h
@@ -21,7 +21,7 @@
 
 #define LIBAVRESAMPLE_VERSION_MAJOR  0
 #define LIBAVRESAMPLE_VERSION_MINOR  0
-#define LIBAVRESAMPLE_VERSION_MICRO  1
+#define LIBAVRESAMPLE_VERSION_MICRO  2
 
 #define LIBAVRESAMPLE_VERSION_INT  AV_VERSION_INT(LIBAVRESAMPLE_VERSION_MAJOR, \
                                                   LIBAVRESAMPLE_VERSION_MINOR, \



More information about the ffmpeg-cvslog mailing list