It appears Solaris's cc is ignoring the signedness of bitfield types.
[xiph/unicode.git] / theora / doc / draft-kerr-avt-theora-rtp-00.xml
blobdff7a265733c20677a7a881cc128903ecece636a
1 <?xml version='1.0'?>
2 <!DOCTYPE rfc SYSTEM 'rfc2629.dtd'>
3 <?rfc toc="yes" ?>
4 <?rfc compact='yes'?>
6 <rfc ipr="full3667" docName="RTP Payload Format for Theora Encoded Video">
8 <front>
9 <title>draft-kerr-avt-theora-rtp-00</title>
11 <author initials="P" surname="Kerr" fullname="Phil Kerr">
12 <organization>Xiph.Org</organization>
13 <address>
14 <email>phil@plus24.com</email>
15 <uri>http://www.xiph.org/</uri>
16 </address>
17 </author>
19 <date day="31" month="January" year="2005" />
21 <area>General</area>
22 <workgroup>AVT Working Group</workgroup>
23 <keyword>I-D</keyword>
25 <keyword>Internet-Draft</keyword>
26 <keyword>Theora</keyword>
27 <keyword>RTP</keyword>
29 <abstract>
30 <t>
31 This document describes a RTP payload format for transporting Theora encoded video.  It details the RTP encapsulation mechanism 
32 for raw Theora data and configuration headers consisting of the quantization matrices and the Huffman codebooks for the DCT 
33 coefficients, and a table of limit values for the deblocking filter.
34 </t>
36 <t>
37 Also included within the document are the necessary details for the use of Theora with MIME and Session Description Protocol 
38 (SDP).
39 </t>
41 </abstract>
43 <note title="Editors Note">
44 <t>
45 All references to RFC XXXX are to be replaced by references to the RFC number of this memo, when published.
46 </t>
47 </note>
49 </front>
51 <middle>
53 <section anchor="Introduction" title="Introduction">
54 <t>
55 Theora is a general purpose, lossy video codec. It is based on the VP3.1 video codec produced by On2 Technologies and has been donated to the Xiph.org Foundation.  
56 </t>
58 <t>
59 Theora I is a block-based lossy transform codec that utilizes an 8 x 8 Type-II Discrete Cosine Transform and block-based motion 
60 compensation.  This places it in the same class of codecs as MPEG-1, MPEG-2, MPEG-4, and H.263. The details of how individual 
61 blocks are organized and how DCT coefficients are stored in the bitstream differ substantially from these codecs, however.  Theora 
62 supports only intra frames (I frames in MPEG) and inter frames (P frames in MPEG). 
63 </t>
65 <t>
66 Theora provides none of its own framing, synchronization, or protection against transmission errors.  Theora is a free-form 
67 variable bit rate (VBR) codec, and packets have no minimum size, maximum size, or fixed/expected size.  Theora packets are thus 
68 intended to be used with a transport mechanism that provides free-form framing, synchronization, positioning, and error correction 
69 in accordance with these design assumptions, such as Ogg <xref target="rfc3533"></xref>. or RTP/AVP <xref target="rfc3550"></xref>. 
70 </t>
72 <t>
73 Theora I currently supports progressive video data of arbitrary dimensions at a constant frame rate in one of several YCbCr color 
74 spaces. 
75 Three different chroma subsampling formats are supported: 4:2:0, 4:2:2, and 4:4:4.  The Theora I format does not support interlaced 
76 material, variable frame rates, bit-depths larger than 8 bits per component, nor alternate color spaces such as RGB or arbitrary 
77 multi-channel spaces.  Black and white content can be efficiently encoded, however, because the uniform chroma planes compress well.
78 </t>
80 <t>
81 Theora is similar to Vorbis audio <xref target="vorbisrtp"></xref> in that it requires the inclusion of the entire probability 
82 model for the DCT coefficients and all the quantization parameters in the bitstream headers to be sent ahead of the video data.  It 
83 is therefore impossible to decode any frame in the stream without having previously fetched the codec info and codec setup headers, 
84 although Theora can initiate decode at an arbitrary intra-frame packet within a bitstream so long as the codec has been initialized 
85 with the setup headers.
86 </t>
88 <section anchor="Terminology" title="Terminology">
90 <t>
91 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", 
92 and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 <xref target="rfc2119"></xref>.
93 </t>
95 </section>
96 </section>
98 <section anchor="Payload Format" title="Payload Format">
101 Each frame of digital video is packetized into one or more RTP packets.  If the data for a complete frame exceeds the network
102 MTU, it SHOULD be fragmented into multiple RTP packets, each smaller than the MTU.   A single RTP packet MAY contain 
103 data for more than one Theora frame. 
104 </t>
107 For RTP based transportation of Theora encoded video the standard RTP header is followed by a 5 octet payload header, then the 
108 payload data.  
109 </t>
111 <section anchor="RTP Header" title="RTP Header">
114 The format of the RTP header is specified in <xref target="rfc3550"></xref> and shown in Figure 1.  This payload format uses 
115 the fields of the header in a manner consistent with that specification. 
116 </t>
118 <figure anchor="RTP Header Figure" title="RTP Header">
119 <artwork><![CDATA[
120     0                   1                   2                   3
121     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
122    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
123    |V=2|P|X|  CC   |M|     PT      |       sequence number         |
124    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
125    |                           timestamp                           |
126    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
127    |           synchronization source (SSRC) identifier            |
128    +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
129    |            contributing source (CSRC) identifiers             |
130    |                              ...                              |
131    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
132 ]]></artwork>
133 </figure>
136 The RTP header begins with an octet of fields (V, P, X, and CC) to support specialized RTP uses (see <xref target="rfc3550">
137 </xref> and <xref target="rfc3551"></xref> for details). For Theora RTP, the following values are used.
138 </t>
141 Version (V): 2 bits</t><t>
142 This field identifies the version of RTP. The version used by this specification is two (2).
143 </t>
146 Padding (P): 1 bit</t><t>
147 Padding MAY be used with this payload format according to section 5.1 of <xref target="rfc3550"></xref>.  
148 </t>
151 Extension (X): 1 bit</t><t>
152 The Extension bit is used in accordance with <xref target="rfc3550"></xref>. 
153 </t>
156 CSRC count (CC): 4 bits</t><t>
157 The CSRC count is used in accordance with <xref target="rfc3550"></xref>.
158 </t>
161 Marker (M): 1 bit</t><t>
162 The Marker bit is used in accordance with <xref target="rfc3550"></xref>.
163 </t>
166 Payload Type (PT): 7 bits</t><t>
167 An RTP profile for a class of applications is expected to assign a payload type for this format, or a dynamically allocated 
168 payload type SHOULD be chosen which designates the payload as Theora.
169 </t>
172 Sequence number: 16 bits</t><t>
173 The sequence number increments by one for each RTP data packet sent, and may be used by the receiver to detect packet loss and
174 to restore packet sequence. This field is detailed further in <xref target="rfc3550"></xref>.
175 </t>
178 Timestamp: 32 bits</t><t>
179 A timestamp representing the sampling time of the first sample of the first Theora packet in the RTP packet.  The clock frequency 
180 MUST be set to the sample rate of the encoded video data and is conveyed out-of-band as an SDP attribute.
181 </t>
184 SSRC/CSRC identifiers: </t><t>
185 These two fields, 32 bits each with one SSRC field and a maximum of 16 CSRC fields, are as defined in 
186 <xref target="rfc3550"></xref>.  
187 </t>
189 </section>
191 <section anchor="Payload Header" title="Payload Header">
194 After the RTP Header section the following five octets are the Payload Header.  
195 This header is split into a number of bitfields detailing the format of the following Payload Data packets.
196 </t>
198 <figure anchor="Payload Header Figure" title="Payload Header">
199 <artwork><![CDATA[
200     0                   1                   2                   3
201     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
202    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
203    |                       Setup Header Ident                      |
204    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
205    |C|F|0|0|# pkts.|
206    +-+-+-+-+-+-+-+-+
207 ]]></artwork>
208 </figure>
211 Setup Header Ident: 32 bits</t>
213 This 32 bit field is used to associate the Theora data to a decoding Setup Header. It is created by making a CRC32 checksum 
214 of the Setup Header required to decode the particular Theora video stream.
215 </t>
218 Continuation (C): 1 bit</t>
220 Set to one if this is a continuation of a fragmented packet.
221 </t>
224 Fragmented (F): 1 bit</t>
226 Set to one if the payload contains complete packets or if it contains the last fragment of a fragmented packet. 
227 </t>
230 The next two bits are currently reserved and MUST be set to 0.
231 </t>
234 The last 4 bits are the number of complete packets in this payload.  This provides for a maximum number of 15 Theora 
235 packets in the payload.  If the packet contains fragmented data the number of packets MUST be set to 0.
236 </t>
238 </section>
240 <section anchor="Payload Data" title="Payload Data">
243 Each Theora payload section starts with a three octet header.  The first octet is used to denote what kind of Theora data follows.  
244 Then a two octet length header is used to represent the size of the following data payload, followed by the raw Theora data.
245 </t>
247 <figure anchor="Payload Data Figure" title="Payload Data">
248 <artwork><![CDATA[
249     0                   1                   2                   3
250     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
251    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
252    |   Data type   |        Payload Length         | Theora Data  ..
253    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
254 ]]></artwork>
255 </figure>
258 The data type octet is used to signify the payload data type.  If the first bit is set to 0, this indicates the payload is 
259 Theora video data.
260 </t>
263 The following values for the Theora payload type are valid:
264 </t>
265 <vspace blankLines="1" />
266 <list style="empty">
267 <t>      0 = Raw Theora data</t>
268 <t>      0x80 = Theora Identification header</t>
269 <t>      0x81 = Theora Comment header</t>
270 <t>      0x82 = Theora Setup header</t>
271 </list>
272 <vspace blankLines="1" />
275 The Theora packet length header is the length of the Theora data block only and does not count the length octets and payload 
276 data type octet.
277 </t>
280 The Theora codec uses relatively unstructured raw packets containing binary integer fields of arbitrary width that often do not fall on an octet boundary.  When this happens the bitstream is packed to an octet boundary.  When a Theora encoder produces packets unused space in the last byte of a packet is always zeroed during the encoding process.  Thus, should this unused space be read, it will return binary zeros.
281 </t>
284 For payloads which consist of multiple Theora packets the payload data consists of the data type field, the payload length field 
285 followed by the payload data for each of the Theora packets in the payload.
286 </t>
288 </section>
290 <section anchor="Example RTP Packet" title="Example RTP Packet">
293 Here is an example RTP packet containing two Theora packets.
294 </t>
296 RTP Packet Header:
297 </t>
299 <figure anchor="Example RTP Packet Figure" title="Example RTP Packet">
300 <artwork><![CDATA[
301     0                   1                   2                   3
302     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
303    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
304    | 2 |0|0|  0    |0|      PT     |       sequence number         |
305    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
306    |                 timestamp (in sample rate units)              |
307    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
308    |          synchronisation source (SSRC) identifier             |
309    +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
310    |            contributing source (CSRC) identifiers             |
311    |                              ...                              |
312    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
313 ]]></artwork>
314 </figure>
318 Payload Data:
319 </t>
321 <figure anchor="Example Theora Payload Figure" title="Example Theora Payload Packet">
322 <artwork><![CDATA[
323     0                   1                   2                   3
324     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
325    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
326    |                       Setup Header Ident                      |
327    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
328    |0|1|0|0| 2 pks |      0x80     |        Payload Length         |
329    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
330    |                         Theora data                          ..
331    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
332    ..    data      |        0      |        Payload Length        ..
333    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
334    ..                        Theora data                           |
335    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
336 ]]></artwork>
337 </figure>
340 The payload portion of the packet starts with the 32 bit Setup Header ident field followed by the 8 bit fragment/count fields.  The F 
341 bit is set to 1, indicating that this packet contains whole Theora frame data.  The number of whole Theora data packets is set to 
342 2.  
343 </t>
346 Each of the payload blocks starts with a Data type field, for the first payload this is set to 0x80 indicating it is an 
347 Identification header and the second payload is set to 0 indicating it is raw Theora data.  Then the two octet length field is 
348 followed by the variable length Theora data.
349 </t>
351 </section>
352 </section>
355 <section anchor="Frame Packetizing" title="Frame Packetizing">
358 Each RTP packet contains either one complete Theora packet, one Theora packet fragment, or an integer number of complete Theora 
359 packets (up to a max of 15 packets, since the number of packets is defined by a 4 bit value).
360 </t>
363 Any Theora data packet that is less than path MTU SHOULD be bundled in the RTP packet with as many Theora packets as will 
364 fit, up to a maximum of 15.  Path MTU is detailed in <xref target="rfc1063"></xref> and <xref target="rfc1981"></xref>.
365 </t>
368 If a Theora packet is larger than 65535 octets it MUST be fragmented.  A fragmented packet has a zero in the last four bits 
369 of the payload header.  Each fragment after the first will also set the Continued (C) bit to one in the payload header.  The 
370 RTP packet containing the last fragment of the Theora packet will have the Fragmented (F) bit set to one.  To maintain the 
371 correct sequence for fragmented packet reception the timestamp field of fragmented packets MUST be the same as the first 
372 packet sent, with the sequence number incremented as normal for the subsequent RTP packets.
373 </t>
375 <section anchor="Example Fragmented Theora Packet" title="Example Fragmented Theora Packet">
378 Here is an example fragmented Theora packet split over three RTP packets.  Each packet contains the standard RTP headers as 
379 well as the 5 octet Theora headers.
380 </t>
382 <figure anchor="Example Fragmented Packet (Packet 1)" title="Example Fragmented Packet (Packet 1)">
383 <artwork><![CDATA[
384    Packet 1:
386     0                   1                   2                   3
387     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
388    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
389    |V=2|P|X|  CC   |M|     PT      |           1000                |
390    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
391    |                             xxxxx                             |
392    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
393    |           synchronization source (SSRC) identifier            |
394    +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
395    |            contributing source (CSRC) identifiers             |
396    |                              ...                              |
397    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
398    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
399    |                       Setup Header Ident                      |
400    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
401    |0|0|0|0|      0|       0       |        Payload Length         |
402    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
403    |                         Theora data                          ..
404    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
405 ]]></artwork>
406 </figure>
409 In this packet the initial sequence number is 1000 and the timestamp is xxxxx.  The Continuation (C) bit is set to one, 
410 indicating it is not the continuation of a fragmented bit, and the Fragmentation (F) is set to 0 indicating it is a fragmented 
411 packet.  The number of packets field is set to 0, and as the payload is raw Theora data the Theora payload type field is set to 0.
412 </t>
414 <figure anchor="Example Fragmented Packet (Packet 2)" title="Example Fragmented Packet (Packet 2)">
415 <artwork><![CDATA[
416    Packet 2:
418     0                   1                   2                   3
419     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
420    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
421    |V=2|P|X|  CC   |M|     PT      |           1001                |
422    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
423    |                             xxxxx                             |
424    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
425    |           synchronization source (SSRC) identifier            |
426    +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
427    |            contributing source (CSRC) identifiers             |
428    |                              ...                              |
429    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
430    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
431    |                       Setup Header Ident                      |
432    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
433    |1|0|0|0|      0|       0       |        Payload Length         |
434    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
435    |                         Theora data                          ..
436    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
437 ]]></artwork>
438 </figure>
441 The C bit is set to 1 and the number of packets field is set to 0.  For large Theora fragments there can be several of these type 
442 of payload packets.  The maximum packet size SHOULD be no greater than the path MTU, including all RTP and payload headers.  The 
443 sequence number has been incremented by one but the timestamp field remains the same as the initial packet.
444 </t>
446 <figure anchor="Example Fragmented Packet (Packet 3)" title="Example Fragmented Packet (Packet 3)">
447 <artwork><![CDATA[
448    Packet 3:
450     0                   1                   2                   3
451     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
452    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
453    |V=2|P|X|  CC   |M|     PT      |           1002                |
454    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
455    |                             xxxxx                             |
456    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
457    |           synchronization source (SSRC) identifier            |
458    +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
459    |            contributing source (CSRC) identifiers             |
460    |                              ...                              |
461    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
462    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
463    |                       Setup Header Ident                      |
464    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
465    |1|1|0|0|      0|       0       |        Payload Length         |
466    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
467    |                         Theora data                          ..
468    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
469 ]]></artwork>
470 </figure>
473 This is the last Theora fragment packet.  The C and F bits are set and the packet count remains set to 0.  As in the previous 
474 packets the timestamp remains set to the first packet in the sequence and the sequence number has been incremented.
475 </t>
477 </section>
478 </section>
481 <section anchor="Packet Loss" title="Packet Loss">
484 As there is no error correction within the Theora stream, packet loss will result in a loss of signal.  Packet loss is more of an 
485 issue for fragmented Theora packets as the client will have to cope with the handling of the C and F flags.  If we use the 
486 fragmented Theora packet example above and the first packet is lost the client SHOULD detect that the next packet has the packet
487 count field set to 0 and the C bit is set and MUST drop it.  The next packet, which is the final fragmented packet, SHOULD 
488 be dropped in the same manner, or buffered.  Feedback reports on lost and dropped packets MUST be sent back via RTCP.
489 </t>
492 If a particular multicast session has a large number of participants care must be taken to prevent an RTCP feedback implosion, 
493 <xref target="rtcp-feedback"></xref>, in the event of packet loss from a large number of participants.
494 </t>
496 </section>
498 <section anchor="Configuration Headers" title="Configuration Headers">
501 To decode a Theora stream three configuration header blocks are needed.  The first header, the Identification Header, indicates 
502 the frame dimensions, quality, blocks used and the version of the Theora encoder used.  The second header, the Comment Header, contains stream metadata and the third header, the Setup Header, details which contains dequantization and Huffman tables.
503 </t>
506 As the RTP stream may change certain configuration data mid-session there are two different methods for delivering this 
507 configuration data to a client, in-band and SDP which is detailed below.  SDP delivery is used to set-up an initial
508 state for the client application and in-band is used to change state during the session.  The changes may be due to 
509 different metadata or Setup Header as well as different bitrates of the stream.
510 </t>
513 Out of the two delivery vectors the use of an SDP attribute to indicate an URI where the configuration and Setup Header data 
514 can be obtained is preferred as they can be fetched reliably using TCP.  The in-band Setup Header delivery SHOULD 
515 only be used in situations where the link between the client is unidirectional or if the SDP-based information is not available. 
516 </t>
519 Synchronizing the configuration and Setup Header to the RTP stream is critical.  The 32 bit Setup Header Ident field is used 
520 to indicate when a change in the stream has taken place.  The client application MUST have in advance the correct configuration 
521 and Setup Headers and if the client detects a change in the Ident value and does not have this information it MUST NOT 
522 decode the raw Theora data.
523 </t>
525 <section anchor="In-band Header Transmission" title="In-band Header Transmission">
528 The three header data blocks are sent in-band with the packet type bits set to match the payload type.  Normally the Setup Header 
529 and Identification Header are sent once per session if the stream is an encoding of live video, as typically 
530 the encoder state will not change, but the encoder state can change at the boundary of chained Theora video files.  Metadata 
531 can be sent at the start as well as any time during the life of the session.  Clients MUST be capable of dealing with periodic 
532 re-transmission of the configuration headers.
533 </t>
535 <section anchor="Identification Header" title="Identification Header">
538 The Identification Header is a short header with only a few fields used to declare the stream definitively as Theora and provide detailed information about the format of the fully decoded video data.</t>
540 <figure anchor="Identification Header Figure" title="Identification Header">
541 <artwork><![CDATA[
542     0                   1                   2                   3
543     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
544    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
545    |V=2|P|X|  CC   |M|     PT      |             xxxx              |
546    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
547    |                             xxxxx                             |
548    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
549    |           synchronization source (SSRC) identifier            |
550    +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
551    |            contributing source (CSRC) identifiers             |
552    |                              ...                              |
553    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
554    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
555    |                       Setup Header Ident                      |
556    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
557    |0|1|0|0|      1|     0x80      |        Payload Length         |
558    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
559    |     VMAJ      |     VMIN      |     VREV      |     FMBW      |
560    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
561    |     FMBW      |              FMBH             |     NSBS      |
562    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
563    |                     NSBS                      |               |
564    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
565    |                       NBS                             | NMBS  |
566    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
567    |                       NMBS                            | PICW  |
568    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
569    |              PICW             |             PICH              |
570    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
571    | PICH  |     PICX      |      PICY     |         FRN           |
572    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
573    |                FRN                    |         FRD           |
574    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
575    |                FRD                    |         PARN          |
576    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
577    |         PARN          |               PARD                    |
578    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
579    | PARD  |      CS       |PF |             NOMBR                 |
580    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
581    |   NOMBR   |   QUAL    | KFGSHIFT|
582    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
583 ]]></artwork>
584 </figure>
587 The fields listed above have the following meanings:
588 </t>
590 <vspace blankLines="1" />
591 <vspace blankLines="1" />
592 <list style="empty">
593 <t>      VMAJ     = The major version number.  8 bits.</t>
594 <t>      VMIN     = The minor version number.  8 bits.</t>
595 <t>      VREV     = The version revision number.  8 bits.</t>
596 <t>      FMBW     = The width of the frame in macro blocks.  16 bits.</t>
597 <t>      FMBH     = The height of the frame in macro blocks.  16 bits.</t>
598 <t>      NSBS     = The total number of super blocks in a frame.  32 bits.</t>
599 <t>      NBS      = The total number of blocks in a frame.  36 bits.</t>
600 <t>      NMBS     = The total number of macro blocks in a frame.  32 bits.</t>
601 <t>      PICW     = The width of the picture region in pixels.  20 bits.</t>
602 <t>      PICH     = The height of the picture region in pixels.  20 bits.</t>
603 <t>      PICX     = The X offset of the picture region in pixels.  8 bits.</t>
604 <t>      PICY     = The Y offset of the picture region in pixels.  8 bits.</t>
605 <t>      FRN      = The frame-rate numerator.  32 bits.</t>
606 <t>      FRD      = The frame-rate denominator.  32 bits.</t>
607 <t>      PARN     = The pixel aspect-ratio numerator.  24 bits.</t>
608 <t>      PARD     = The pixel aspect-ratio denominator.  24 bits.</t>
609 <t>      CS       = The color space.  8 bits.</t>
610 <t>      PF       = The pixel format.  2 bits.</t>
611 <t>      NOMBR    = The nominal bitrate of the stream, in bits per second.  24 bits.</t>
612 <t>      QUAL     = The quality hint.  6 bits.</t>
613 <t>      KFGSHIFT = The amount to shift the key frame number by in the granule position.  5 bits.</t>
614 </list>
615 <vspace blankLines="1" />
617 </section>
619 <section anchor="Comment Header" title="Comment Header">
622 The Theora Comment Header is the second of three header packets that begin a Theora stream. It is meant for short text comments, 
623 not arbitrary metadata; arbitrary metadata belongs in a separate logical stream that provides greater structure and machine 
624 parseability. The comment field is meant to be used much like someone jotting a quick note on the label of a video. It should be a 
625 little information to remember the disc or tape by and explain it to others; a short, to-the-point text note that can be more than 
626 a couple words, but isn't going to be more than a short paragraph.</t>
629 <figure anchor="Comment Header Figure" title="Comment Header">
630 <artwork><![CDATA[
631     0                   1                   2                   3
632     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
633    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
634    |V=2|P|X|  CC   |M|     PT      |             xxxx              |
635    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
636    |                             xxxxx                             |
637    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
638    |           synchronization source (SSRC) identifier            |
639    +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
640    |            contributing source (CSRC) identifiers             |
641    |                              ...                              |
642    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
643    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
644    |                       Setup Header Ident                      |
645    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
646    |0|1|0|0|      1|     0x81      |        Payload Length         |
647    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
648    |                    User comments list length                  |
649    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
650    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
651    |                       User comment length                     |
652    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
653    |                          User comment                        ..
654    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
655    ..                         User comment                         |
656    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
658 ]]></artwork>
659 </figure>
662 The format for the data takes the form of a 32 bit field denoting the number of user comments.  Each of the user comments is prefixed by a 32 bit length field followed by the comment text encoded in UTF-8.
663 </t>
665 </section>
667 <section anchor="Setup Header" title="Setup Header">
670 The Theora setup header contains the limit values used to drive the loop filter, the base matrices and scale values used to build the dequantization tables, and the Huffman tables used to unpack the DCT tokens. Because the contents of this header are specific to Theora, no concessions have been made to keep the fields octet-aligned for easy parsing.
671 </t>
673 <figure anchor="Setup Header Figure" title="Setup Header">
674 <artwork><![CDATA[
675     0                   1                   2                   3
676     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
677    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
678    |V=2|P|X|  CC   |M|     PT      |             xxxx              |
679    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
680    |                             xxxxx                             |
681    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
682    |           synchronization source (SSRC) identifier            |
683    +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
684    |            contributing source (CSRC) identifiers             |
685    |                              ...                              |
686    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
687    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
688    |                       Setup Header Ident                      |
689    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
690    |0|1|0|0|      1|     0x82      |        Payload Length         |
691    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
692    |                      Setup Header Length                      |
693    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
694    |                         Setup Header                         ..
695    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
696    ..                        Setup Header                          |
697    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
698 ]]></artwork>
699 </figure>
702 <section anchor="Setup Header CRC32 Generation" title="Setup Header CRC32 Generation">
705 In order for different implementations of Theora RTP clients and servers to interoperate with each other a common format 
706 for the production of the CRC32 hash is required.  The polynomial is X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0.
707 </t>
710 The following C code function SHOULD be used by implementations, if not then the code responsible for generating the CRC32 
711 value MUST use the polynomial function above.
712 </t>
714 <artwork><![CDATA[
715 unsigned int crc32 (int length, unsigned char *crcdata)
717     int index, loop;
718     unsigned int byte, crc, mask;
720     index = 0;
721     crc = 0xFFFFFFFF;
723     while (index < length) {
724         byte = crcdata [index];
725         crc = crc ^ byte;
727         for (loop = 7; loop >= 0; loop--) {
728             mask = -(crc & 1);
729             crc = (crc >> 1) ^ (0xEDB88320 & mask);
730         }
731         index++;
732     }
733     return ~crc;
735 ]]></artwork>
738 </section>
740 </section>
741 </section>
743 <section anchor="Packed Headers Delivery" title="Packed Headers Delivery"> 
746 As mentioned above the RECOMMENDED delivery vector for Theora configuration data is via an SDP attribute as this retrieval method 
747 can be performed using a reliable transport protocol.  
748 </t>
750 <figure anchor="Packed Headers Overview Figure" title="Packed Headers Overview">
751 <artwork><![CDATA[
752    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
753    |                     Number of packed headers                  |
754    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
755    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
756    |                          Packed header                        |
757    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
758    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
759    |                          Packed header                        |
760    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
761 ]]></artwork>
762 </figure>
765 As the RTP headers are not required for this method of delivery the 
766 structure of the configuration data is slightly different.  The packed header starts with a 32 bit count field which details the number of packed headers that are contained in the bundle.  Next is the packed header payload for each chained Theora file.
767 </t>
769 <figure anchor="Packed Headers Detail Figure" title="Packed Headers Detail">
770 <artwork><![CDATA[
771     0                   1                   2                   3
772     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
773    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
774    |                         Header Length                         |
775    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
776    |                       Setup Header Ident                      |
777    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
778    |                     Identification Header                    ..
779    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
780    ..                    Identification Header                     |
781    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
782    |                         Comment Header                       ..
783    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
784    ..                        Comment Header                        |
785    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
786    |                          Setup Header                        ..
787    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
788    ..                         Setup Header                         |
789    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
790 ]]></artwork>
791 </figure>
793 <t>The key difference between the in-band format is there is no need for the payload header octet and Setup Header Ident field.  
794 Below are examples of the packed headers format.
795 </t>
797 <figure anchor="Packed Identification Header Figure" title="Packed Identification Header">
798 <artwork><![CDATA[
799     0                   1                   2                   3
800     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
801    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
802    |     VMAJ      |     VMIN      |     VREV      |     FMBW      |
803    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
804    |     FMBW      |              FMBH             |     NSBS      |
805    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
806    |                     NSBS                      |               |
807    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
808    |                       NBS                             | NMBS  |
809    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
810    |                       NMBS                            | PICW  |
811    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
812    |              PICW             |             PICH              |
813    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
814    | PICH  |     PICX      |      PICY     |         FRN           |
815    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
816    |                FRN                    |         FRD           |
817    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
818    |                FRD                    |         PARN          |
819    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
820    |         PARN          |               PARD                    |
821    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
822    | PARD  |      CS       |PF |             NOMBR                 |
823    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
824    |   NOMBR   |   QUAL    | KFGSHIFT|
825    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
826 ]]></artwork>
827 </figure>
830 The alignment of the packed Identification Header is slightly different from the RTP payload type as the payload header is not 
831 used.
832 </t>
834 <figure anchor="Packed Comment Header Figure" title="Packed Comment Header">
835 <artwork><![CDATA[
836     0                   1                   2                   3
837     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
838    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
839    |                    User comments list length                  |
840    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
841    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
842    |                       User comment length                     |
843    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
844    |                          User comment                        ..
845    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
846    ..                         User comment                         |
847    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
848 ]]></artwork>
849 </figure>
852 The packed Comment Header also as a slightly different structure to that of the RTP payload type with the payload header not being 
853 used.
855 </t>
857 <figure anchor="Packed Setup Header Figure" title="Packed Setup Header">
858 <artwork><![CDATA[
859     0                   1                   2                   3
860     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
861    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
862    |                      Setup Header Length                      |
863    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
864    |                         Setup Header                         ..
865    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
866    ..                        Setup Header                          |
867    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
868 ]]></artwork>
869 </figure>
872 The packed Setup Header also has a slightly different structure to that of the RTP payload type.  The Setup Header Ident field 
873 that is normally part of this structure is moved to the second field of the overall packed structure.
874 </t>
876 <section anchor="Packed Headers IANA Considerations" title="Packed Headers IANA Considerations"> 
879 The following IANA considerations MUST only be applied to the packed headers.
880 </t>
883 MIME media type name: video
884 </t>
886 MIME subtype: theora-config
887 </t>
890 Required Parameters:</t><t>
891 None.
892 </t>
895 Optional Parameters: </t><t>
896 None.
897 </t>
900 Encoding considerations:</t><t>
901 This type is only defined for transfer via HTTP as specified in RFC XXXX.
902 </t>
905 Security Considerations:</t><t>
906 See Section 6 of RFC 3047.
907 </t>
910 Interoperability considerations: none
911 </t>
914 Published specification:</t>
915 <t>See RFC XXXX for details.</t>
918 Applications which use this media type:</t><t>
919 Theora encoded video, configuration data.
920 </t>
923 Additional information: none
924 </t>
927 Person &amp; email address to contact for further information:</t><t>
928 Phil Kerr: &lt;phil@plus24.com&gt;
929 </t>
932 Intended usage: COMMON
933 </t>
935 <t>Author/Change controller:</t>
936 <t>Author: Phil Kerr</t>
937 <t>Change controller: IETF AVT Working Group</t>
940 </section>
941 </section>
943 <section anchor="Setup Header Caching" title="Setup Header Caching"> 
946 Setup Header caching allows clients that have previously connected to a stream to re-use the associated Setup Header and 
947 configuration data.  When a client receives a Setup Header it may store it locally and can compare the CRC32 key with that of the 
948 new stream and begin decoding before it has received any of the headers.
949 </t>   
951 </section>
953 <section anchor="Loss of Configuration Headers" title="Loss of Configuration Headers"> 
956 Unlike the loss of raw Theora payload data, loss of a configuration header can lead to a situation where it will not be possible 
957 to successfully decode the stream.  
958 </t>
961 Out of the three headers, loss of either the Setup Header or Identification Headers MUST result in the halting of stream 
962 decoding.  Loss of the Comment header SHOULD NOT be regarded as fatal for decoding.  Loss of any of the headers SHOULD be reported 
963 to the client as well as a loss report sent via RTCP.
964 </t>
966 </section>
967 </section>
970 <section anchor="IANA Considerations" title="IANA Considerations"> 
972 <t>MIME media type name: video</t>
974 <t>MIME subtype: theora</t>
976 <t>Required Parameters:</t>
979 sampling: Determines the chroma subsampling format.
980 </t>
982 width: Determines the number of pixels per line. This is an integer between 1 and 1048561 and MUST be in multiples of 16.
983 </t>
985 height: Determines the number of lines per frame. This is an integer between 1 and 1048561 and MUST be in multiples of 16.
986 </t>
988 header: Indicates the URI of the decoding configuration headers.
989 </t>
992 Optional Parameters: </t><t>
993 None.
994 </t>
997 Encoding considerations:</t><t>
998 This type is only defined for transfer via RTP as specified in RFC XXXX.
999 </t>
1002 Security Considerations:</t><t>
1003 See Section 6 of RFC 3047.
1004 </t>
1007 Interoperability considerations: none
1008 </t>
1011 Published specification:</t>
1012 <t>See the Theora documentation <xref target="Theora-spec-ref"></xref> for details.</t>
1015 Applications which use this media type:</t><t>
1016 Video streaming and conferencing tools
1017 </t>
1020 Additional information: none
1021 </t>
1024 Person &amp; email address to contact for further information:</t><t>
1025 Phil Kerr: &lt;phil@plus24.com&gt;
1026 </t>
1029 Intended usage: COMMON
1030 </t>
1032 <t>Author/Change controller:</t>
1033 <t>Author: Phil Kerr</t>
1034 <t>Change controller: IETF AVT Working Group</t>
1036 <section anchor="Mapping MIME Parameters into SDP" title="Mapping MIME Parameters into SDP"> 
1039 The information carried in the MIME media type specification has a specific mapping to fields in the Session Description 
1040 Protocol (SDP) <xref target="rfc2327"></xref>, which is commonly used to describe RTP sessions.  When SDP is used to specify 
1041 sessions the mapping are as follows:
1042 </t>
1044 <vspace blankLines="1" />
1045 <list style="symbols">
1047 <t>The MIME type ("video") goes in SDP "m=" as the media name.</t>
1048 <vspace blankLines="1" />
1050 <t>The MIME subtype ("THEORA") goes in SDP "a=rtpmap" as the encoding name.</t>
1051 <vspace blankLines="1" />
1053 <t>The parameter "rate" also goes in "a=rtpmap" as clock rate.</t>
1054 <vspace blankLines="1" />
1056 <t>The parameter "channels" also goes in "a=rtpmap" as channel count.</t>
1057 <vspace blankLines="1" />
1059 <t>The parameter "header" goes in the SDP "a=fmpt" attribute.</t>
1060 </list>
1064 If the stream comprises chained Theora files the configuration and Setup Headers for each file SHOULD be packaged together 
1065 and passed to the client using the headers attribute if all the files to be played are known in advance.  
1066 </t>
1069 <t>Example:</t>
1071 <vspace blankLines="1" />
1073 <list style="empty">
1074 <t>c=IN IP4/6 </t>
1075 <t>m=video  RTP/AVP 98</t>
1076 <t>a=rtpmap:98 theora/90000</t>
1077 <t>a=fmtp:98 sampling=YCbCr-4:2:2; width=1280; height=720; header=&lt;URI of configuration header&gt;</t>
1078 </list>
1080 </section> 
1081 </section>
1084 <!--section anchor="IANA Considerations old" title="IANA Considerations old"> 
1086 <t>MIME media type name: video</t>
1088 <t>MIME subtype: theora</t>
1090 <t>Required Parameters:</t>
1093 sampling: Determines the chroma subsampling format.
1094 </t>
1096 width: Determines the number of pixels per line. This is an integer between 1 and 1048561 and MUST be in multiples of 16.
1097 </t>
1099 height: Determines the number of lines per frame. This is an integer between 1 and 1048561 and MUST be in multiples of 16.
1100 </t>
1102 header: Indicates the URI of the decoding configuration headers.
1103 </t>
1106 Optional Parameters: </t><t>
1107 None.
1108 </t>
1111 Encoding considerations:</t><t>
1112 This type is only defined for transfer via RTP as specified in RFC XXXX.
1113 </t>
1116 Security Considerations:</t><t>
1117 See Section 6 of RFC 3047.
1118 </t>
1121 Interoperability considerations: none
1122 </t>
1125 Published specification:</t>
1126 <t>See the Theora documentation <xref target="Theora-spec-ref"></xref> for details.</t>
1129 Applications which use this media type:</t><t>
1130 video streaming and conferencing tools
1131 </t>
1134 Additional information: none
1135 </t>
1138 Person &amp; email address to contact for further information:</t><t>
1139 Phil Kerr: &lt;phil@plus24.com&gt;
1140 </t>
1143 Intended usage: COMMON
1144 </t>
1146 <t>Author/Change controller:</t>
1147 <t>Author: Phil Kerr</t>
1148 <t>Change controller: IETF AVT Working Group</t>
1150 </section-->
1152 <section anchor="Security Considerations" title="Security Considerations"> 
1154 RTP packets using this payload format are subject to the security considerations discussed in the RTP specification 
1155 <xref target="rfc3550"></xref>.  This implies that the confidentiality of the media stream is achieved by using
1156 encryption.  Because the data compression used with this payload format is applied end-to-end, encryption may be performed on the 
1157 compressed data.  Where the size of a data block is set care MUST be taken to prevent buffer overflows in the client applications.
1158 </t>
1160 </section> 
1162 <section anchor="Acknowledgments" title="Acknowledgments"> 
1165 Thanks to the AVT, Ogg Theora Communities / Xiph.org, Fluendo, Ralph Giles.
1166 </t>
1168 </section> 
1170 </middle>
1172 <back>
1174 <references title="Normative References">
1176 <reference anchor="rfc3533">
1177 <front>
1178 <title>The Ogg Encapsulation Format Version 0</title>
1179 <author initials="S." surname="Pfeiffer" fullname="Silvia Pfeiffer"></author>
1180 </front>
1181 <seriesInfo name="RFC" value="3533" />
1182 </reference>
1184 <reference anchor="rfc2119">
1185 <front>
1186 <title>Key words for use in RFCs to Indicate Requirement Levels </title>
1187 <author initials="S." surname="Bradner" fullname="Scott Bradner"></author>
1188 </front>
1189 <seriesInfo name="RFC" value="2119" />
1190 </reference>   
1192 <reference anchor="rfc3550">
1193 <front>
1194 <title>RTP: A Transport Protocol for real-time applications</title>
1195 <author initials="H." surname="Schulzrinne" fullname=""></author>
1196 <author initials="S." surname="Casner" fullname=""></author>
1197 <author initials="R." surname="Frederick" fullname=""></author>
1198 <author initials="V." surname="Jacobson" fullname=""></author>
1199 </front>
1200 <seriesInfo name="RFC" value="3550" />
1201 </reference> 
1203 <reference anchor="rfc3551">
1204 <front>
1205 <title>RTP Profile for video and Video Conferences with Minimal Control.</title>
1206 <author initials="H." surname="Schulzrinne" fullname=""></author>
1207 <author initials="S." surname="Casner" fullname=""></author>
1208 </front>
1209 <date month="July" year="2003" />
1210 <seriesInfo name="RFC" value="3551" />
1211 </reference> 
1212   
1213 <reference anchor="rfc2327">
1214 <front>
1215 <title>SDP: Session Description Protocol</title>
1216 <author initials="M." surname="Handley" fullname="Mark Handley"></author>
1217 <author initials="V." surname="Jacobson" fullname="Van Jacobson"></author>
1218 </front>
1219 <seriesInfo name="RFC" value="2327" />
1220 </reference>   
1222 <reference anchor="rfc1063">
1223 <front>
1224 <title>Path MTU Discovery</title>
1225 <author initials="J." surname="Mogul et al." fullname="J. Mogul et al."></author>
1226 </front>
1227 <seriesInfo name="RFC" value="1063" />
1228 </reference>   
1230 <reference anchor="rfc1981">
1231 <front>
1232 <title>Path MTU Discovery for IP version 6</title>
1233 <author initials="J." surname="McCann et al." fullname="J. McCann et al."></author>
1234 </front>
1235 <seriesInfo name="RFC" value="1981" />
1236 </reference>   
1238 <reference anchor="rtcp-feedback">
1239 <front>
1240 <title>Extended RTP Profile for RTCP-based Feedback (RTP/AVPF)</title>
1241 <author initials="J." surname="Ott" fullname="Joerg Ott"></author>
1242 <author initials="S." surname="Wenger" fullname="Stephan Wenger"></author>
1243 <author initials="N." surname="Sato" fullname="Noriyuki Sato"></author>
1244 <author initials="C." surname="Burmeister" fullname="Carsten Burmeister"></author>
1245 <author initials="J." surname="Rey" fullname="Jose Rey"></author>
1246 </front>
1247 <seriesInfo name="Internet Draft" value="(draft-ietf-avt-rtcp-feedback-11: Work in progress)" />
1248 </reference>   
1250 <reference anchor="vorbisrtp">
1251 <front>
1252 <title>RTP Payload Format for Vorbis Encoded Audio - draft-ietf-avt-vorbis-rtp-00</title>
1253 <author initials="P." surname="Kerr" fullname="P. Kerr"></author>
1254 </front>
1255 <seriesInfo name="Internet Draft" value="(Work in progress)" />
1256 </reference>   
1257 </references>
1261 <references title="Informative References">
1262 <reference anchor="libTheora">
1263 <front>
1264 <title>libTheora: Available from the Xiph website, http://www.xiph.org</title>
1265 </front>
1266 </reference>   
1268 <reference anchor="Theora-spec-ref">
1269 <front>
1270 <title>Ogg Theora I spec:  Codec setup and packet decode.  http://www.xiph.org/ogg/Theora/doc/Theora-spec-ref.html</title>
1271 </front>
1272 </reference>   
1273   
1274   
1275 </references>
1276 </back>
1277 </rfc>