Hi,
I have a question about mad_stream_skip.
If I call this function, would if be correct to call mad_stream_sync after?
Actually, mad_stream_skip does'nt care about the skip offset (well, I think...). I would expect that if I call sync after skip, It will try to sync starting from the new position (position + skip offset).
If I do that, it does'nt work since the "skip offset" will be consider only at the next decode_frame call.
I'me new to mad's API so I would appraciate if somebody could explain me the logic behind that please.
Thank you Francis
_________________________________________________________________ Take advantage of powerful junk e-mail filters built on patented Microsoft® SmartScreen Technology. http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI... Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*.
On Sep 21, 2004, at 1:33 PM, Francis Labonte wrote:
Probably not.
The purpose of mad_stream_skip() is to tell the decoder to skip a number of bytes in the stream because they do not contain audio data. The most common use for this is to skip embedded ID3 tag information. Bytes skipped may cross stream buffer boundaries; MAD_ERROR_BUFLEN is returned as appropriate, so your stream refilling code need not be aware that bytes are being skipped. After the indicated number of bytes have been skipped, the decoder assumes the next byte begins a sync word. If not, MAD_ERROR_LOSTSYNC is returned as usual and the sync word will be located automatically on the next call.
Since the decoder does it automatically, it's almost never necessary to call mad_stream_sync() yourself.
What actually happens is the skip is deferred until the next frame is decoded, but the sync happens immediately. The reason is that skips may cross stream buffer boundaries, but the sync search happens only within the current buffer.