[Libav-user] libswresample, packed samples and alignment
Brad O'Hearne
brado at bighillsoftware.com
Tue Mar 26 20:14:20 CET 2013
Hello,
I've noticed that several functions in samplefmt.h take an "align" parameter, such as the function calls:
int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
int nb_samples, enum AVSampleFormat sample_fmt, int align);
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
enum AVSampleFormat sample_fmt, int align);
int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
const uint8_t *buf,
int nb_channels, int nb_samples,
enum AVSampleFormat sample_fmt, int align);
This align parameter has the following description:
* @param align buffer size alignment (0 = default, 1 = no alignment)
I want to make sure that I'm properly understanding the purpose and setting of this parameter. As I understand it, a sample is "packed" if its sample bits occupy the entire available bits for the channel. If a sample's bits do not occupy the entire available bits for the channel it is not packed, and then the data is either high or low-aligned within the channel.
In the case of my app, my sample format of captured audio is:
Linear PCM, 32 bit little-endian floating point, 2 channels, 44100 Hz
and this data IS indeed packed, meaning that there is neither high nor low alignment. In setting the appropriate align value for the aforementioned functions, I have two questions:
1. What is "default" alignment according to the documentation? Is that high or low, or something else?
2. Based on my captured sample data being packed, shouldn't this mean that there is NO alignment, and therefore the value for these method invocations be 1?
Thanks,
Brad
More information about the Libav-user
mailing list