On Sunday, July 13, 2003, at 10:12 PM, Russell O'Connor wrote:
I want to incorporate xing.c into my project, so I was wondering if somone can explain that the ancillary bits pointer is?
"Ancillary data" is the data in an MPEG audio stream between the end of one frame and the beginning of the next. After a successful call to mad_frame_decode(), a pointer to this data is placed in stream->anc_ptr and the length in stream->anc_bitlen.
Since the data is neither necessarily byte-aligned nor an integral number of bytes, MAD uses a "bit pointer" structure that can be passed to mad_bit_read() to read the data as arbitrary-sized bit string words.
It happens that Xing VBR header information is stored in the ancillary data of the first frame of a VBR stream, so that's why the bit pointer is used.
Also, when is it valid to use it, after mad-decode-header? or must I do mad-decode.
The location and size of the ancillary data is not known until after the frame is fully decoded, so it's not sufficient to merely decode the header; you must decode the entire frame.