| 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_0x80 Format - header packet type 0x80 - ID header |
| 13 |
|
| 14 |
The ID header must be the first packet in a Kate stream. |
| 15 |
It carries information about the stream. |
| 16 |
|
| 17 |
Here is a table description of the format of the ID header: |
| 18 |
|
| 19 |
\verbatim |
| 20 |
|
| 21 |
* Kate bitstream version 0.3 |
| 22 |
* |
| 23 |
* Default field type: LITTLE ENDIAN unsigned integer |
| 24 |
|
| 25 |
0 1 2 3 | |
| 26 |
0 1 2 3 | |
| 27 |
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1| Byte |
| 28 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 29 |
| packtype | Identifier char[7]: 'kate\0\0\0' | 0-3 |
| 30 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 31 |
| kate magic continued | 4-7 |
| 32 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 33 |
| reserved - 0 | version major | version minor | num headers | 8-11 |
| 34 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 35 |
| text encoding | directionality| reserved - 0 | granule shift | 12-15 |
| 36 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 37 |
| cw sh | canvas width | ch sh | canvas height | 16-19 |
| 38 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 39 |
| reserved - 0 | 20-23 |
| 40 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 41 |
| granule rate numerator | 24-27 |
| 42 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 43 |
| granule rate denominator | 28-31 |
| 44 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 45 |
| language (NUL terminated) | 32-35 |
| 46 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 47 |
| language (continued) | 36-39 |
| 48 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 49 |
| language (continued) | 40-43 |
| 50 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 51 |
| language (continued) | 44-47 |
| 52 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 53 |
| category (NUL terminated) | 48-51 |
| 54 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 55 |
| category (continued) | 52-55 |
| 56 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 57 |
| category (continued) | 56-59 |
| 58 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 59 |
| category (continued) | 60-63 |
| 60 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 61 |
|
| 62 |
\endverbatim |
| 63 |
|
| 64 |
|
| 65 |
and for a description of those fields: |
| 66 |
|
| 67 |
\li \c packtype the packet type for this header - always 0x80 |
| 68 |
|
| 69 |
\li \c kate \c magic the 7 byte string "kate\0\0\0", as all other Kate headers |
| 70 |
|
| 71 |
\li \c version \c major the major version number of the bitstream |
| 72 |
|
| 73 |
\li \c version \c minor the minor version number of the bitstream |
| 74 |
|
| 75 |
\li \c num \c headers the number of header packets present in this stream |
| 76 |
|
| 77 |
\li \c text \c encoding the default encoding used by text (usually 0, UTF-8) |
| 78 |
|
| 79 |
\li \c directionality the default directionality of the text |
| 80 |
|
| 81 |
\li \c granule \c shift the number of bits in the granule positions reserved for storing the offset part |
| 82 |
|
| 83 |
\li \c cw \c sh (from bitstream 0.2) the number of bits to left shift the \c canvas \c width field to compute the original canvas width |
| 84 |
\li \c canvas width (from bitstream 0.2) the number to shift left by \c cw \c sh to compute the original canvas width |
| 85 |
|
| 86 |
zero is a valid width, and represents an unset width |
| 87 |
|
| 88 |
\li \c ch \c sh (from bitstream 0.2) the number of bits to left shift the \c canvas \c height field to compute the original canvas height |
| 89 |
\li \c canvas height (from bitstream 0.2) the number to shift left by \c ch \c sh to compute the original canvas height |
| 90 |
|
| 91 |
zero is a valid height, and represents an unset height |
| 92 |
|
| 93 |
\li \c granule \c rate \c numerator the numerator of the fraction representing how many granule units represent a second (from bitstream 0.2) |
| 94 |
|
| 95 |
\li \c granule \c rate \c denominator the denominator of the fraction representing how many granule units represent a second |
| 96 |
|
| 97 |
\li \c language the default language of the text in this stream (will be NUL terminated) |
| 98 |
|
| 99 |
an empty string is a valid language, and represents an unset language |
| 100 |
|
| 101 |
\li \c category the category of the text in this stream (will be NUL terminated) |
| 102 |
|
| 103 |
an empty string is a valid category, and represents an unset category |
| 104 |
|
| 105 |
All fields marked as "reserved - 0" should be set to zero when encoding a stream with |
| 106 |
this version of the bitstream format. However, if decoding a stream encoded with a |
| 107 |
version of the bitstream format with the same bitstream major version but a higher |
| 108 |
bitstream minor version, those fields may be non zero, if they were subsequently |
| 109 |
allocated to carry additional information. |
| 110 |
|
| 111 |
*/ |
| 112 |
|