[Libav-user] Sample format questions

Brad O'Hearne brado at bighillsoftware.com
Tue Mar 26 18:17:59 CET 2013

I have four questions: 

1. Is there a function out there to return the proper sample format based upon whether a sample is linear / planar, signed/unsigned, and byte size? In samplefmt.h, it seems there are functions to retrieve the sample format by name, or switch between linear and planar formats, but no functions to determine which sample format should be used based upon sample buffer attributes. Does such a function exist elsewhere? 

2. To confirm, are all linear sample formats with more than one channel interleaved by default? In other words, must all linear sample format data be interleaved as such (pseudocode): 

ch1[0] -> ch2[0] -> ch1[1] -> ch2[2] -> ... -> ch1[n] -> ch2[n]

3. Is endianness in every sample format native endian, meaning, for example, that if I have a float in a captured sample buffer which is native endian it will require no conversion to a sample format endianness?

4. Is there a function that will output the endianness for a sample format at runtime? I read what the documentation says, but having been at a brick wall with processing captured audio, I need verification that the sample format I'm converting into is indeed apples:apples. 



More information about the Libav-user mailing list