/* Copyright (C) 2008 Vincent Penquerc'h. This file is part of the Kate codec library. Written by Vincent Penquerc'h. Use, distribution and reproduction of this library is governed by a BSD style source license included with this source in the file 'COPYING'. Please read these terms before distributing. */ /** \page Format This page documents the Kate bitstream format. \section format-overview Overview The Kate bitstream format consists of a number of sequential packets. Packets can be either header packets or data packets. All header packets must appear before any data packet. Header packets must appear in order. Decoding of a data packet is not possible until all header packets have been decoded. Each Kate packet starts with a one byte type. A type with the MSB set (eg, between 0x80 and 0xff) indicates a header packet, while a type with the MSB cleared (eg, between 0x00 and 0x7f) indicates a data packet. All header packets then have the Kate magic, from byte offset 1 to byte offset 7 ("kate\0\0\0"). Since the ID header must appear first, a Kate stream can be recognized by comparing the first eight bytes of the first packet with the signature string "\200kate\0\0\0". \section format-ogg-mapping Ogg mapping The first packet in a Kate stream (always packet type 0x80, the id header packet) must be placed on a separate page. The corresponding Ogg packet must be marked as beginning of stream (BOS). No other packet may be marked as BOS. All subsequent header packets must be on one or more pages. Each data packet must be on a separate page. The last data packet must be the end of stream packet (packet type 0x7f). The corresponding Ogg packet must be marked as end of stream (EOS). There can be only one end of stream packet in a Kate stream. No other packet may be marked as EOS. As per the Ogg specification, granule positions must be non decreasing within the stream. Header packets have granule position 0. \section format-detailed Detailed description Following is a detailed description of the format of each packet type. Header packets: \li \ref format_0x80 "0x80 (ID header)" \li \ref format_0x81 "0x81 (Vorbis comments)" \li \ref format_0x82 "0x82 (regions)" \li \ref format_0x83 "0x83 (styles)" \li \ref format_0x84 "0x84 (curves)" \li \ref format_0x85 "0x85 (motions)" \li \ref format_0x86 "0x86 (palettes)" \li \ref format_0x87 "0x87 (bitmaps)" \li \ref format_0x88 "0x88 (font ranges)" Data packets: \li \ref format_0x00 "0x00 (text packet)" \li \ref format_0x01 "0x01 (keepalive packet)" \li \ref format_0x7f "0x7f (end packet)" */