[Libav-user] Sample format questions
Paul B Mahol
onemda at gmail.com
Tue Mar 26 18:29:22 CET 2013
On 3/26/13, Brad O'Hearne <brado at bighillsoftware.com> wrote:
> 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?
sample format is set by decoder to what sample format decoder outputs its data,
similar apply for encoder input.
>
> 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]
any planar sample format with more than 1 channel is not interleaved.
>
> 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?
Yes, it is required that data be in native endian order.
>
> 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.
As already mentioned data is always in native endian, its decoder
responsibility....
>
> Thanks,
>
> Brad
>
>
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
More information about the Libav-user
mailing list