[FFmpeg-cvslog] samplefmt: make av_samples_alloc() initialize the data to silence.
Anton Khirnov
git at videolan.org
Thu Oct 4 13:18:04 CEST 2012
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed Oct 3 07:54:45 2012 +0200| [cd15b7c03d8df29d4c69b0620cf27d4a8c9dfb65] | committer: Anton Khirnov
samplefmt: make av_samples_alloc() initialize the data to silence.
Right now the buffer is zeroed, which does not represent silence for U8(P).
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cd15b7c03d8df29d4c69b0620cf27d4a8c9dfb65
---
libavutil/samplefmt.c | 5 ++++-
libavutil/samplefmt.h | 1 +
libavutil/version.h | 2 +-
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c
index 102376a..4f6dfd7 100644
--- a/libavutil/samplefmt.c
+++ b/libavutil/samplefmt.c
@@ -174,7 +174,7 @@ int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
if (size < 0)
return size;
- buf = av_mallocz(size);
+ buf = av_malloc(size);
if (!buf)
return AVERROR(ENOMEM);
@@ -184,6 +184,9 @@ int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
av_free(buf);
return size;
}
+
+ av_samples_set_silence(audio_data, 0, nb_samples, nb_channels, sample_fmt);
+
return 0;
}
diff --git a/libavutil/samplefmt.h b/libavutil/samplefmt.h
index 445856d..0641c56 100644
--- a/libavutil/samplefmt.h
+++ b/libavutil/samplefmt.h
@@ -182,6 +182,7 @@ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
* Allocate a samples buffer for nb_samples samples, and fill data pointers and
* linesize accordingly.
* The allocated samples buffer can be freed by using av_freep(&audio_data[0])
+ * Allocated data will be initialized to silence.
*
* @see enum AVSampleFormat
* The documentation for AVSampleFormat describes the data layout.
diff --git a/libavutil/version.h b/libavutil/version.h
index 6342bae..b77ab1a 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -38,7 +38,7 @@
#define LIBAVUTIL_VERSION_MAJOR 51
#define LIBAVUTIL_VERSION_MINOR 41
-#define LIBAVUTIL_VERSION_MICRO 0
+#define LIBAVUTIL_VERSION_MICRO 1
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \
More information about the ffmpeg-cvslog
mailing list