Re: Ogg encapsulation

"Gerard Juyn" <gjuyn-qWit8jRvyhVmR6Xm/[email protected]> Thu, 1 Apr 2004 21:05:54 +0200
Newsgroups gmane.comp.graphics.mng.general
Organization Triple-T
Message-ID <406C8432.938.33EC2BB7@localhost>
> > mng_retcode mng_set_checkcrc (mng_handle hHandle,
> >                                    mng_uint8 iMode);
> > iMode can be:
> > 0x00 = crc in datastream & must be checked (default)
> > 0x01 = crc in datastream, must not be checked
> > 0x02 = no crc in datastream, no checking
> > 
> > Later perhaps even
> > 0x03 = crc in datastream, external checking thru callback-routine
> 
> Look at the equivalent code in png.h.  It has separate controls for
> "critical" and "ancillary" chunks, and allows you to discard or use the
> bad chunk, and issue a warning or be silent.  There is no option for the
> CRC to be omitted:

Ok. I've always been under the (mistaken) impression that the CRC check 
was mandatory. Just re-reading the specs tells me I've got it wrong. So yes, 
let's implement something similar to libpng:

The bits in iMode (now a uint16) become flags:

0x0001 crc present (or not)
0x0010 crc must be checked for ancillary chunks (or not)
0x0020 faulty crc on ancillary chunks generate a warning (or not)
0x0040 faulty crc on ancillary chunks generate an error (or not)
0x0080 ancillary chunks with faulty crc get used (or discarded)
0x0100 crc must be checked for critical chunks (or not)
0x0200 faulty crc on critical chunks generate a warning (or not)
0x0400 faulty crc on critical chunks generate an error (or not)
0x0800 critical chunks with faulty crc get used (or discarded)

The default being 0x0531 (crc present, must be checked, warning for 
ancillary, error for critical). Errors mean abort in libmng. The handling of 
warnings depends whether or not a callback is assigned and what that 
callback returns. The default with no callback is to ignore.

Actually, errors can be ignored as well by #define MNG_SOFTERRORS
This will change the error-handling macros to work like a warning. Sure hope 
people know what they're doing if they start messing with that, as it means 
the default will then be to ignore errors!!!

Gerard


--
Send the message body "help" to [email protected]