]> git.sesse.net Git - ffmpeg/commitdiff
lavr: make avresample_read() with NULL output discard samples.
authorAnton Khirnov <anton@khirnov.net>
Wed, 9 May 2012 04:35:13 +0000 (06:35 +0200)
committerAnton Khirnov <anton@khirnov.net>
Wed, 9 May 2012 15:37:47 +0000 (17:37 +0200)
libavresample/avresample.h
libavresample/utils.c
libavresample/version.h

index 7350805e41773281962326d9fbc2d124f90c921b..65d4d2d6e2286d781a39c3f36c3b5d94d722b086 100644 (file)
@@ -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
  */
index f54dcc6ae651f9e8e676170928ab773fcd3f50e4..e533760abc3b97073634d3d642f8563aeef23758 100644 (file)
@@ -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);
 }
 
index 47504c938073ed926e0515baf1bf5d648f59a220..6211a56352fc8e13e93c5973c75bf6a0750d2445 100644 (file)
@@ -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, \