Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/libogg-1.1.3/doc/oggstream.html @ 58

Last change on this file since 58 was 15, checked in by landauf, 17 years ago

added libogg

File size: 8.4 KB
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2<html>
3<head>
4
5<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
6<title>Ogg Documentation</title>
7
8<style type="text/css">
9body {
10  margin: 0 18px 0 18px;
11  padding-bottom: 30px;
12  font-family: Verdana, Arial, Helvetica, sans-serif;
13  color: #333333;
14  font-size: .8em;
15}
16
17a {
18  color: #3366cc;
19}
20
21img {
22  border: 0;
23}
24
25#xiphlogo {
26  margin: 30px 0 16px 0;
27}
28
29#content p {
30  line-height: 1.4;
31}
32
33h1, h1 a, h2, h2 a, h3, h3 a {
34  font-weight: bold;
35  color: #ff9900;
36  margin: 1.3em 0 8px 0;
37}
38
39h1 {
40  font-size: 1.3em;
41}
42
43h2 {
44  font-size: 1.2em;
45}
46
47h3 {
48  font-size: 1.1em;
49}
50
51li {
52  line-height: 1.4;
53}
54
55#copyright {
56  margin-top: 30px;
57  line-height: 1.5em;
58  text-align: center;
59  font-size: .8em;
60  color: #888888;
61  clear: both;
62}
63</style>
64
65</head>
66
67<body>
68
69<div id="xiphlogo">
70  <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
71</div>
72
73<h1>Ogg logical and physical bitstream overview</h1>
74
75<h2>Ogg bitstreams</h2>
76
77<p>Ogg codecs use octet vectors of raw, compressed data
78(<em>packets</em>). These compressed packets do not have any
79high-level structure or boundary information; strung together, they
80appear to be streams of random bytes with no landmarks.</p>
81
82<p>Raw packets may be used directly by transport mechanisms that provide
83their own framing and packet-separation mechanisms (such as UDP
84datagrams). For stream based storage (such as files) and transport
85(such as TCP streams or pipes), Vorbis and other future Ogg codecs use
86the Ogg bitstream format to provide framing/sync, sync recapture
87after error, landmarks during seeking, and enough information to
88properly separate data back into packets at the original packet
89boundaries without relying on decoding to find packet boundaries.</p>
90
91<h2>Logical and physical bitstreams</h2>
92
93<p>Raw packets are grouped and encoded into contiguous pages of
94structured bitstream data called <em>logical bitstreams</em>. A
95logical bitstream consists of pages, in order, belonging to a single
96codec instance. Each page is a self contained entity (although it is
97possible that a packet may be split and encoded across one or more
98pages); that is, the page decode mechanism is designed to recognize,
99verify and handle single pages at a time from the overall bitstream.</p>
100
101<p>Multiple logical bitstreams can be combined (with restrictions) into a
102single <em>physical bitstream</em>. A physical bitstream consists of
103multiple logical bitstreams multiplexed at the page level and may
104include a 'meta-header' at the beginning of the multiplexed logical
105stream that serves as identification magic. Whole pages are taken in
106order from multiple logical bitstreams and combined into a single
107physical stream of pages. The decoder reconstructs the original
108logical bitstreams from the physical bitstream by taking the pages in
109order from the physical bitstream and redirecting them into the
110appropriate logical decoding entity. The simplest physical bitstream
111is a single, unmultiplexed logical bitstream with no meta-header; this
112is referred to as a 'degenerate stream'.</p>
113
114<p><a href="framing.html">Ogg Logical Bitstream Framing</a> discusses
115the page format of an Ogg bitstream, the packet coding process
116and logical bitstreams in detail. The remainder of this document
117specifies requirements for constructing finished, physical Ogg
118bitstreams.</p>
119
120<h2>Mapping Restrictions</h2>
121
122<p>Logical bitstreams may not be mapped/multiplexed into physical
123bitstreams without restriction. Here we discuss design restrictions
124on Ogg physical bitstreams in general, mostly to introduce
125design rationale. Each 'media' format defines its own (generally more
126restrictive) mapping. An 'Ogg Vorbis Audio Bitstream', for example, has a
127specific physical bitstream structure.
128An 'Ogg A/V' bitstream (not currently specified) will also mandate a
129specific, restricted physical bitstream format.</p>
130
131<h3>additional end-to-end structure</h3>
132
133<p>The <a href="framing.html">framing specification</a> defines
134'beginning of stream' and 'end of stream' page markers via a header
135flag (it is possible for a stream to consist of a single page). A
136stream always consists of an integer number of pages, an easy
137requirement given the variable size nature of pages.</p>
138
139<p>In addition to the header flag marking the first and last pages of a
140logical bitstream, the first page of an Ogg bitstream obeys
141additional restrictions. Each individual media mapping specifies its
142own implementation details regarding these restrictions.</p>
143
144<p>The first page of a logical Ogg bitstream consists of a single,
145small 'initial header' packet that includes sufficient information to
146identify the exact CODEC type and media requirements of the logical
147bitstream. The intent of this restriction is to simplify identifying
148the bitstream type and content; for a given media type (or across all
149Ogg media types) we can know that we only need a small, fixed
150amount of data to uniquely identify the bitstream type.</p>
151
152<p>As an example, Ogg Vorbis places the name and revision of the Vorbis
153CODEC, the audio rate and the audio quality into this initial header,
154thus simplifying vastly the certain identification of an Ogg Vorbis
155audio bitstream.</p>
156
157<h3>sequential multiplexing (chaining)</h3>
158
159<p>The simplest form of logical bitstream multiplexing is concatenation
160(<em>chaining</em>). Complete logical bitstreams are strung
161one-after-another in order. The bitstreams do not overlap; the final
162page of a given logical bitstream is immediately followed by the
163initial page of the next. Chaining is the only logical->physical
164mapping allowed by Ogg Vorbis.</p>
165
166<p>Each chained logical bitstream must have a unique serial number within
167the scope of the physical bitstream.</p>
168
169<h3>concurrent multiplexing (grouping)</h3>
170
171<p>Logical bitstreams may also be multiplexed 'in parallel'
172(<em>grouped</em>). An example of grouping would be to allow
173streaming of separate audio and video streams, using different codecs
174and different logical bitstreams, in the same physical bitstream.
175Whole pages from multiple logical bitstreams are mixed together.</p>
176
177<p>The initial pages of each logical bitstream must appear first; the
178media mapping specifies the order of the initial pages. For example,
179Ogg A/V will eventually specify an Ogg video bitstream with
180audio. The mapping may specify that the physical bitstream must begin
181with the initial page of a logical video bitstream, followed by the
182initial page of an audio stream. Unlike initial pages, terminal pages
183for the logical bitstreams need not all occur contiguously (although a
184specific media mapping may require this; it is not mandated by the
185generic Ogg stream spec). Terminal pages may be 'nil' pages,
186that is, pages containing no content but simply a page header with
187position information and the 'last page of bitstream' flag set in the
188page header.</p>
189
190<p>Each grouped bitstream must have a unique serial number within the
191scope of the physical bitstream.</p>
192
193<h3>sequential and concurrent multiplexing</h3>
194
195<p>Groups of concurrently multiplexed bitstreams may be chained
196consecutively. Such a physical bitstream obeys all the rules of both
197grouped and chained multiplexed streams; the groups, when unchained ,
198must stand on their own as a valid concurrently multiplexed
199bitstream.</p>
200
201<h3>multiplexing example</h3>
202
203<p>Below, we present an example of a grouped and chained bitstream:</p>
204
205<p><img src="stream.png" alt="stream"/></p>
206
207<p>In this example, we see pages from five total logical bitstreams
208multiplexed into a physical bitstream. Note the following
209characteristics:</p>
210
211<ol>
212<li>Grouped bitstreams begin together; all of the initial pages
213must appear before any data pages. When concurrently multiplexed
214groups are chained, the new group does not begin until all the
215bitstreams in the previous group have terminated.</li>
216
217<li>The pages of concurrently multiplexed bitstreams need not conform
218to a regular order; the only requirement is that page <tt>n</tt> of a
219logical bitstream follow page <tt>n-1</tt> in the physical bitstream.
220There are no restrictions on intervening pages belonging to other
221logical bitstreams. (Tying page appearance to bitrate demands is one
222logical strategy, ie, the page appears at the chronological point
223where decode requires more information).</li>
224</ol>
225
226<div id="copyright">
227  The Xiph Fish Logo is a
228  trademark (&trade;) of Xiph.Org.<br/>
229
230  These pages &copy; 1994 - 2005 Xiph.Org. All rights reserved.
231</div>
232
233</body>
234</html>
Note: See TracBrowser for help on using the repository browser.