| 1 |
/* Copyright (C) 2008 Vincent Penquerc'h. |
| 2 |
This file is part of the Kate codec library. |
| 3 |
Written by Vincent Penquerc'h. |
| 4 |
|
| 5 |
Use, distribution and reproduction of this library is governed |
| 6 |
by a BSD style source license included with this source in the |
| 7 |
file 'COPYING'. Please read these terms before distributing. */ |
| 8 |
|
| 9 |
|
| 10 |
/** |
| 11 |
|
| 12 |
\page Format |
| 13 |
|
| 14 |
This page documents the Kate bitstream format. |
| 15 |
|
| 16 |
\section format-overview Overview |
| 17 |
|
| 18 |
The Kate bitstream format consists of a number of sequential packets. |
| 19 |
Packets can be either header packets or data packets. All header packets |
| 20 |
must appear before any data packet. |
| 21 |
|
| 22 |
Header packets must appear in order. Decoding of a data packet is not |
| 23 |
possible until all header packets have been decoded. |
| 24 |
|
| 25 |
Each Kate packet starts with a one byte type. A type with the MSB set |
| 26 |
(eg, between 0x80 and 0xff) indicates a header packet, while a type with |
| 27 |
the MSB cleared (eg, between 0x00 and 0x7f) indicates a data packet. |
| 28 |
All header packets then have the Kate magic, from byte offset 1 to byte |
| 29 |
offset 7 ("kate\0\0\0"). |
| 30 |
|
| 31 |
Since the ID header must appear first, a Kate stream can be recognized |
| 32 |
by comparing the first eight bytes of the first packet with the signature |
| 33 |
string "\200kate\0\0\0". |
| 34 |
|
| 35 |
\section format-ogg-mapping Ogg mapping |
| 36 |
|
| 37 |
The first packet in a Kate stream (always packet type 0x80, the id header |
| 38 |
packet) must be placed on a separate page. The corresponding Ogg packet |
| 39 |
must be marked as beginning of stream (BOS). No other packet may be |
| 40 |
marked as BOS. |
| 41 |
|
| 42 |
All subsequent header packets must be on one or more pages. Each data |
| 43 |
packet must be on a separate page. |
| 44 |
|
| 45 |
The last data packet must be the end of stream packet (packet type 0x7f). |
| 46 |
The corresponding Ogg packet must be marked as end of stream (EOS). There |
| 47 |
can be only one end of stream packet in a Kate stream. No other packet |
| 48 |
may be marked as EOS. |
| 49 |
|
| 50 |
As per the Ogg specification, granule positions must be non decreasing |
| 51 |
within the stream. Header packets have granule position 0. |
| 52 |
|
| 53 |
\section format-detailed Detailed description |
| 54 |
|
| 55 |
Following is a detailed description of the format of each packet type. |
| 56 |
|
| 57 |
Header packets: |
| 58 |
|
| 59 |
\li \ref format_0x80 "0x80 (ID header)" |
| 60 |
\li \ref format_0x81 "0x81 (Vorbis comments)" |
| 61 |
\li \ref format_0x82 "0x82 (regions)" |
| 62 |
\li \ref format_0x83 "0x83 (styles)" |
| 63 |
\li \ref format_0x84 "0x84 (curves)" |
| 64 |
\li \ref format_0x85 "0x85 (motions)" |
| 65 |
\li \ref format_0x86 "0x86 (palettes)" |
| 66 |
\li \ref format_0x87 "0x87 (bitmaps)" |
| 67 |
\li \ref format_0x88 "0x88 (font ranges)" |
| 68 |
|
| 69 |
Data packets: |
| 70 |
|
| 71 |
\li \ref format_0x00 "0x00 (text packet)" |
| 72 |
\li \ref format_0x01 "0x01 (keepalive packet)" |
| 73 |
\li \ref format_0x7f "0x7f (end packet)" |
| 74 |
|
| 75 |
|
| 76 |
*/ |