Re: Ogg encapsulation

"Glenn Randers-Pehrson <glennrp>" <[email protected]> Thu, 01 Apr 2004 13:06:34 -0500
Newsgroups gmane.comp.graphics.mng.general
Message-ID <[email protected]>
Gerard Juyn wrote:

> 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:


/* set the libpng method of handling chunk CRC errors */
extern PNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr,
   int crit_action, int ancil_action));
   
/* Values for png_set_crc_action() to say how to handle CRC errors in
 * ancillary and critical chunks, and whether to use the data contained
 * therein.  Note that it is impossible to "discard" data in a critical
 * chunk.  For versions prior to 0.90, the action was always error/quit,
 * whereas in version 0.90 and later, the action for CRC errors in
ancillary
 * chunks is warn/discard.  These values should NOT be changed.
 * 
 *      value                       action:critical     action:ancillary
 */
#define PNG_CRC_DEFAULT       0  /* error/quit          warn/discard
data */
#define PNG_CRC_ERROR_QUIT    1  /* error/quit         
error/quit        */
#define PNG_CRC_WARN_DISCARD  2  /* (INVALID)           warn/discard
data */
#define PNG_CRC_WARN_USE      3  /* warn/use data       warn/use
data     */
#define PNG_CRC_QUIET_USE     4  /* quiet/use data      quiet/use
data    */
#define PNG_CRC_NO_CHANGE     5  /* use current value   use current
value */

Incidentally, even with all these choices there is no way to avoid
computing the CRC over the data being read.  The flag simply tells
libpng whether to compare the result with the stored CRC or not.

Glenn

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