[FFmpeg-devel] [PATCH] lavu/samplefmt: make av_samples_fill_arrays() return the required size of the buffer
Stefano Sabatini
stefasab at gmail.com
Sat Sep 8 01:20:48 CEST 2012
This is technically an API break, since documentation was stating that 0
was the return error code. In practice, users will just check on ret < 0,
so it *might* be a non-issue.
The value is already computed in the function, so returning it comes at
no cost, and provides more information than just returning 0.
---
libavutil/samplefmt.c | 2 +-
libavutil/samplefmt.h | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c
index a03648e..9da04bd 100644
--- a/libavutil/samplefmt.c
+++ b/libavutil/samplefmt.c
@@ -171,7 +171,7 @@ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
if (linesize)
*linesize = line_size;
- return 0;
+ return buf_size;
}
int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
diff --git a/libavutil/samplefmt.h b/libavutil/samplefmt.h
index 681e521..299200d 100644
--- a/libavutil/samplefmt.h
+++ b/libavutil/samplefmt.h
@@ -179,7 +179,8 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
* @param nb_samples the number of samples in a single channel
* @param sample_fmt the sample format
* @param align buffer size alignment (0 = default, 1 = no alignment)
- * @return 0 on success or a negative error code on failure
+ * @return the size in bytes required for buf, a negative error code
+ * in case of failure
*/
int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
const uint8_t *buf,
--
1.7.5.4
More information about the ffmpeg-devel
mailing list