diff --git a/libavutil/avutil.h b/libavutil/avutil.h index 8a144a4668d9149250b8301a9358f861aa58df2b..7319c22bfa0c0aaa0cd0c493184c6b8bc095617d 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -153,7 +153,7 @@ #define LIBAVUTIL_VERSION_MAJOR 51 #define LIBAVUTIL_VERSION_MINOR 27 -#define LIBAVUTIL_VERSION_MICRO 1 +#define LIBAVUTIL_VERSION_MICRO 2 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c index 761009f2e2ca2c7619eb844deb2fe189a442591f..2e0aa98f582e3a26b4256d714e15503680ff948c 100644 --- a/libavutil/samplefmt.c +++ b/libavutil/samplefmt.c @@ -123,6 +123,10 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, if (!sample_size || nb_samples <= 0 || nb_channels <= 0) return AVERROR(EINVAL); + /* auto-select alignment if not specified */ + if (!align) + align = 32; + /* check for integer overflow */ if (nb_channels > INT_MAX / align || (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size) diff --git a/libavutil/samplefmt.h b/libavutil/samplefmt.h index 0d6bde2732fb94e7de34a5007c3a41d37578353b..29a26f0b41efb3e2c32a908280625b7743711681 100644 --- a/libavutil/samplefmt.h +++ b/libavutil/samplefmt.h @@ -121,6 +121,7 @@ int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt); * @param nb_channels the number of channels * @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 required buffer size, or negative error code on failure */ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, @@ -144,7 +145,7 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, * @param nb_channels the number of channels * @param nb_samples the number of samples in a single channel * @param sample_fmt the sample format - * @param align buffer size alignment (1 = no alignment required) + * @param align buffer size alignment (0 = default, 1 = no alignment) * @return 0 on success or a negative error code on failure */ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, uint8_t *buf, @@ -160,7 +161,7 @@ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, uint8_t *buf, * @param[out] linesize aligned size for audio buffer(s), may be NULL * @param nb_channels number of audio channels * @param nb_samples number of samples per channel - * @param align buffer size alignment (1 = no alignment required) + * @param align buffer size alignment (0 = default, 1 = no alignment) * @return 0 on success or a negative error code on failure * @see av_samples_fill_arrays() */