diff options
Diffstat (limited to 'libavutil/samplefmt.h')
-rw-r--r-- | libavutil/samplefmt.h | 55 |
1 files changed, 50 insertions, 5 deletions
diff --git a/libavutil/samplefmt.h b/libavutil/samplefmt.h index e382149..b06755d 100644 --- a/libavutil/samplefmt.h +++ b/libavutil/samplefmt.h @@ -1,18 +1,18 @@ /* - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -77,4 +77,49 @@ int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt); */ int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt); -#endif /* AVUTIL_SAMPLEFMT_H */ +/** + * Fill channel data pointers and linesizes for samples with sample + * format sample_fmt. + * + * The pointers array is filled with the pointers to the samples data: + * for planar, set the start point of each plane's data within the buffer, + * for packed, set the start point of the entire buffer only. + * + * The linesize array is filled with the aligned size of each samples + * plane, that is linesize[i] will contain the linesize of the plane i, + * and will be zero for all the unused planes. All linesize values are + * equal. + * + * @param pointers array to be filled with the pointer for each plane, may be NULL + * @param linesizes array to be filled with the linesize, may be NULL + * @param buf the pointer to a buffer containing the samples + * @param nb_samples the number of samples in a single channel + * @param planar 1 if the samples layout is planar, 0 if it is packed + * @param nb_channels the number of channels + * @return the total size of the buffer, a negative + * error code in case of failure + */ +int av_samples_fill_arrays(uint8_t *pointers[8], int linesizes[8], + uint8_t *buf, int nb_channels, int nb_samples, + enum AVSampleFormat sample_fmt, int planar, int align); + +/** + * Allocate a samples buffer for nb_samples samples, and + * fill pointers and linesizes accordingly. + * The allocated samples buffer has to be freed by using + * av_freep(&pointers[0]). + * + * @param nb_channels number of audio channels + * @param nb_samples number of samples per channel + * @param planar 1 if the samples layout is planar, 0 if packed, + * @param align the value to use for buffer size alignment + * @return the size in bytes required for the samples buffer, a negative + * error code in case of failure + * @see av_samples_fill_arrays() + */ +int av_samples_alloc(uint8_t *pointers[8], int linesizes[8], + int nb_channels, int nb_samples, + enum AVSampleFormat sample_fmt, int planar, + int align); + +#endif /* AVCORE_SAMPLEFMT_H */ |