annotate DOCS/tech/mpcf.txt @ 16511:3a24be1b0a60

remove info frame repeating its problematic and controversical
author michael
date Sat, 17 Sep 2005 22:32:35 +0000
parents 1e42b8be5b7f
children c80f6f322350
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
1 NUT Open Container Format DRAFT 20050909
10817
59ac254c2541 some updates
alex
parents: 10166
diff changeset
2 ----------------------------------------
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
3
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
4
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
5
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
6 Intro:
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
7
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
8 Features / goals:
16428
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
9 (supported by the format, not necessarily by a specific implementation)
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
10
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
11 Simple
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
12 use the same encoding for nearly all fields
16428
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
13 simple decoding, so slow CPUs (and embedded systems) can handle it
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
14 Extendible
16428
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
15 no limit for the possible values of all fields (using universal vlc)
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
16 allow adding of new headers in the future
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
17 allow adding more fields at the end of headers
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
18 Compact
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
19 ~0.2% overhead, for normal bitrates
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
20 index is <10kb per hour (1 keyframe every 3sec)
16428
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
21 a usual header for a file is about 100 bytes (audio + video headers together)
12082
f705b0777572 removing subpackets (everyone hates them ...)
michael
parents: 11975
diff changeset
22 a packet header is about ~1-8 bytes
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
23 Error resistant
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
24 seeking / playback without an index
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
25 headers & index can be repeated
16428
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
26 damaged files can be played back with minimal data loss and fast
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
27 resync times
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
28
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
29
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
30 Definitions:
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
31
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
32 MUST the specific part must be done to conform to this standard
16428
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
33 SHOULD it is recommended to be done that way, but not strictly required
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
34
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
35
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
36
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
37 Syntax:
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
38
16428
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
39 Since NUT heavily uses variable length fields, the simplest way to describe it
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
40 is using a pseudocode approach.
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
41
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
42 Conventions:
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
43
15008
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
44 The data types have a name, used in the bitstream syntax description, a short
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
45 text description and a pseudocode (functional) definition, optional notes may
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
46 follow:
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
47
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
48 name (text description)
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
49 functional definition
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
50 [Optional notes]
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
51
15008
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
52 The bitstream syntax elements have a tagname and a functional definition, they
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
53 are presented in a bottom up approach, again optional notes may follow and
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
54 are reproduced in the tag description:
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
55
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
56 name: (optional note)
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
57 functional definition
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
58 [Optional notes]
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
59
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
60 The in-depth tag description follows the bitstream syntax.
16428
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
61 The functional definition has a C-like syntax.
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
62
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
63
9295
michael
parents: 9294
diff changeset
64 Type definitions:
12209
3baef37d3b7c moving f() and u()
michael
parents: 12208
diff changeset
65
3baef37d3b7c moving f() and u()
michael
parents: 12208
diff changeset
66
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
67 f(n) (n fixed bits in big-endian order)
16428
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
68 u(n) (unsigned number encoded in n bits in MSB-first order)
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
69
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
70 v (variable length value, unsigned)
9295
michael
parents: 9294
diff changeset
71 value=0
michael
parents: 9294
diff changeset
72 do{
michael
parents: 9294
diff changeset
73 more_data u(1)
michael
parents: 9294
diff changeset
74 data u(7)
michael
parents: 9294
diff changeset
75 value= 128*value + data
michael
parents: 9294
diff changeset
76 }while(more_data)
9579
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
77
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
78 s (variable length value, signed)
9579
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
79 temp v
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
80 temp++
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
81 if(temp&1) value= -(temp>>1)
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
82 else value= (temp>>1)
9323
774afe44f17b some more info (copy & pasted from ML)
michael
parents: 9312
diff changeset
83
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
84 b (binary data or string, to be use in vb, see below)
9323
774afe44f17b some more info (copy & pasted from ML)
michael
parents: 9312
diff changeset
85 for(i=0; i<length; i++){
774afe44f17b some more info (copy & pasted from ML)
michael
parents: 9312
diff changeset
86 data[i] u(8)
9295
michael
parents: 9294
diff changeset
87 }
16428
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
88 [Note: strings MUST be encoded in UTF-8]
9295
michael
parents: 9294
diff changeset
89
15008
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
90 vb (variable length binary data or string)
12117
e1e5e2124dae minor changes
michael
parents: 12110
diff changeset
91 length v
e1e5e2124dae minor changes
michael
parents: 12110
diff changeset
92 value b
e1e5e2124dae minor changes
michael
parents: 12110
diff changeset
93
9295
michael
parents: 9294
diff changeset
94
michael
parents: 9294
diff changeset
95 Bitstream syntax:
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
96
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
97 Common elements:
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
98
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
99 packet header:
12084
68baf8877c07 reversing the change to the forw/backw pointers, its somewhat simpler to update it if the forward pointer is first
michael
parents: 12082
diff changeset
100 forward ptr v
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
101
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
102 align_byte:
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
103 while(not byte aligned)
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
104 one f(1)
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
105
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
106 reserved_bytes:
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
107 for(i=0; i<forward_ptr - length_of_non_reserved; i++)
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
108 reserved u(8)
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
109 [a demuxer MUST ignore any reserved bytes
12184
17667db616d3 (de)coder -> (de)muxer
michael
parents: 12162
diff changeset
110 a muxer MUST NOT write any reserved bytes, as this would make it
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
111 impossible to add new fields at the end of packets in the future in
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
112 a compatible way]
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
113
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
114 Headers:
10824
d163db068a12 reserved_bytes & byte order stuff
michael
parents: 10817
diff changeset
115
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
116 main header:
10831
3f716efeb27a moved packet header after startcodes
alex
parents: 10827
diff changeset
117 main_startcode f(64)
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
118 packet header
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
119 version v
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
120 stream_count v
12333
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
121 max_distance v
14919
1d4861b2ac4a returning to the old index at the end system, alternatives are too complex with questionable advantages
michael
parents: 14911
diff changeset
122 max_index_distance v
12413
87a6dc69b65a proposals by rich:
michael
parents: 12392
diff changeset
123 global_time_base_nom v
87a6dc69b65a proposals by rich:
michael
parents: 12392
diff changeset
124 global_time_base_denom v
12084
68baf8877c07 reversing the change to the forw/backw pointers, its somewhat simpler to update it if the forward pointer is first
michael
parents: 12082
diff changeset
125 for(i=0; i<256; ){
68baf8877c07 reversing the change to the forw/backw pointers, its somewhat simpler to update it if the forward pointer is first
michael
parents: 12082
diff changeset
126 tmp_flag v
12428
bfa269cec22b extendible frame_code table
michael
parents: 12413
diff changeset
127 tmp_fields v
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
128 if(tmp_fields>0) tmp_pts s
12428
bfa269cec22b extendible frame_code table
michael
parents: 12413
diff changeset
129 if(tmp_fields>1) tmp_mul v
bfa269cec22b extendible frame_code table
michael
parents: 12413
diff changeset
130 if(tmp_fields>2) tmp_stream v
bfa269cec22b extendible frame_code table
michael
parents: 12413
diff changeset
131 if(tmp_fields>3) tmp_size v
bfa269cec22b extendible frame_code table
michael
parents: 12413
diff changeset
132 else tmp_size=0
bfa269cec22b extendible frame_code table
michael
parents: 12413
diff changeset
133 if(tmp_fields>4) tmp_res v
bfa269cec22b extendible frame_code table
michael
parents: 12413
diff changeset
134 else tmp_res=0
bfa269cec22b extendible frame_code table
michael
parents: 12413
diff changeset
135 if(tmp_fields>5) count v
bfa269cec22b extendible frame_code table
michael
parents: 12413
diff changeset
136 else count= tmp_mul - tmp_size
bfa269cec22b extendible frame_code table
michael
parents: 12413
diff changeset
137 for(j=6; j<tmp_fields; j++){
bfa269cec22b extendible frame_code table
michael
parents: 12413
diff changeset
138 tmp_reserved[i] v
bfa269cec22b extendible frame_code table
michael
parents: 12413
diff changeset
139 }
bfa269cec22b extendible frame_code table
michael
parents: 12413
diff changeset
140 for(j=0; j<count && i<256; j++, i++){
12084
68baf8877c07 reversing the change to the forw/backw pointers, its somewhat simpler to update it if the forward pointer is first
michael
parents: 12082
diff changeset
141 flags[i]= tmp_flag;
68baf8877c07 reversing the change to the forw/backw pointers, its somewhat simpler to update it if the forward pointer is first
michael
parents: 12082
diff changeset
142 stream_id_plus1[i]= tmp_stream;
68baf8877c07 reversing the change to the forw/backw pointers, its somewhat simpler to update it if the forward pointer is first
michael
parents: 12082
diff changeset
143 data_size_mul[i]= tmp_mul;
12428
bfa269cec22b extendible frame_code table
michael
parents: 12413
diff changeset
144 data_size_lsb[i]= tmp_size + j;
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
145 pts_delta[i]= tmp_pts;
12501
cd0d9a99b730 remove index flag
michael
parents: 12428
diff changeset
146 reserved_count[i]= tmp_res;
12082
f705b0777572 removing subpackets (everyone hates them ...)
michael
parents: 11975
diff changeset
147 }
f705b0777572 removing subpackets (everyone hates them ...)
michael
parents: 11975
diff changeset
148 }
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
149 reserved_bytes
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
150 checksum u(32)
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
151
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
152 stream_header:
10831
3f716efeb27a moved packet header after startcodes
alex
parents: 10827
diff changeset
153 stream_startcode f(64)
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
154 packet_header
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
155 stream_id v
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
156 stream_class v
12150
2c9a2b1772bc language_code & fourcc vb->v reversal
michael
parents: 12118
diff changeset
157 fourcc vb
9297
8a19be9649e7 use fraction for time_base
michael
parents: 9296
diff changeset
158 time_base_nom v
8a19be9649e7 use fraction for time_base
michael
parents: 9296
diff changeset
159 time_base_denom v
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
160 msb_pts_shift v
12333
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
161 decode_delay v
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
162 fixed_fps u(1)
16503
b7fc08b7e1aa typo, probably..
ods15
parents: 16429
diff changeset
163 reserved u(7)
14471
6cdd5669e930 Here is an updated draft with the bits discussed previously merged:
michael
parents: 13308
diff changeset
164 codec_specific_data vb
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
165
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
166 video_stream_header:
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
167 stream_header
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
168 width v
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
169 height v
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
170 sample_width v
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
171 sample_height v
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
172 colorspace_type v
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
173 reserved_bytes
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
174 checksum u(32)
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
175
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
176 audio_stream_header:
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
177 stream_header
12333
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
178 samplerate_nom v
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
179 samplerate_denom v
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
180 channel_count v
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
181 reserved_bytes
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
182 checksum u(32)
9420
8a1a8f5e9c91 variable subpacket size support
michael
parents: 9373
diff changeset
183
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
184 other_stream_header:
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
185 stream_header
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
186 reserved_bytes
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
187 checksum u(32)
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
188
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
189 Basic Packets:
12082
f705b0777572 removing subpackets (everyone hates them ...)
michael
parents: 11975
diff changeset
190
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
191 frame:
12082
f705b0777572 removing subpackets (everyone hates them ...)
michael
parents: 11975
diff changeset
192 frame_code f(8)
12084
68baf8877c07 reversing the change to the forw/backw pointers, its somewhat simpler to update it if the forward pointer is first
michael
parents: 12082
diff changeset
193 if(stream_id_plus1[frame_code]==0){
12082
f705b0777572 removing subpackets (everyone hates them ...)
michael
parents: 11975
diff changeset
194 stream_id v
f705b0777572 removing subpackets (everyone hates them ...)
michael
parents: 11975
diff changeset
195 }
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
196 if(pts_delta[frame_code]==0){
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
197 coded_pts v
12261
d43f1c599701 remove data_size prediction
michael
parents: 12254
diff changeset
198 }
12413
87a6dc69b65a proposals by rich:
michael
parents: 12392
diff changeset
199 if(flags[frame_code]&1){
12082
f705b0777572 removing subpackets (everyone hates them ...)
michael
parents: 11975
diff changeset
200 data_size_msb v
f705b0777572 removing subpackets (everyone hates them ...)
michael
parents: 11975
diff changeset
201 }
12501
cd0d9a99b730 remove index flag
michael
parents: 12428
diff changeset
202 for(i=0; i<reserved_count[frame_code]; i++)
12413
87a6dc69b65a proposals by rich:
michael
parents: 12392
diff changeset
203 reserved v
12082
f705b0777572 removing subpackets (everyone hates them ...)
michael
parents: 11975
diff changeset
204 data
f705b0777572 removing subpackets (everyone hates them ...)
michael
parents: 11975
diff changeset
205
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
206 index:
10831
3f716efeb27a moved packet header after startcodes
alex
parents: 10827
diff changeset
207 index_startcode f(64)
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
208 packet header
14471
6cdd5669e930 Here is an updated draft with the bits discussed previously merged:
michael
parents: 13308
diff changeset
209 stream_id v
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
210 max_pts v
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
211 index_length v
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
212 for(i=0; i<index_length; i++){
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
213 index_pts v
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
214 index_position v
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
215 }
9310
b16480522be9 some typos
michael
parents: 9307
diff changeset
216 reserved_bytes
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
217 checksum u(32)
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
218
16506
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
219 info_frame: (optional)
9323
774afe44f17b some more info (copy & pasted from ML)
michael
parents: 9312
diff changeset
220 for(;;){
9579
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
221 id v
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
222 if(id==0) break
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
223 name= info_table[id][0]
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
224 type= info_table[id][1]
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
225 if(type==NULL)
12117
e1e5e2124dae minor changes
michael
parents: 12110
diff changeset
226 type vb
9579
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
227 if(name==NULL)
12117
e1e5e2124dae minor changes
michael
parents: 12110
diff changeset
228 name vb
9579
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
229 if(type=="v")
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
230 value v
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
231 else
12117
e1e5e2124dae minor changes
michael
parents: 12110
diff changeset
232 value vb
9323
774afe44f17b some more info (copy & pasted from ML)
michael
parents: 9312
diff changeset
233 }
9310
b16480522be9 some typos
michael
parents: 9307
diff changeset
234 reserved_bytes
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
235 checksum u(32)
16506
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
236
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
237 info_packet: (optional)
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
238 info_startcode f(64)
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
239 packet header
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
240 info_frame
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
241
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
242 sync_point:
12413
87a6dc69b65a proposals by rich:
michael
parents: 12392
diff changeset
243 frame_startcode f(64)
16506
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
244 global_timestamp v
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
245 back_ptr v
12413
87a6dc69b65a proposals by rich:
michael
parents: 12392
diff changeset
246
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
247 Complete definition:
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
248
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
249 file:
12242
f67bc1d216a1 file_id_string (idea by ivan)
michael
parents: 12238
diff changeset
250 file_id_string
14919
1d4861b2ac4a returning to the old index at the end system, alternatives are too complex with questionable advantages
michael
parents: 14911
diff changeset
251 while(!eof && next_code != index_startcode){
12242
f67bc1d216a1 file_id_string (idea by ivan)
michael
parents: 12238
diff changeset
252 main_header
f67bc1d216a1 file_id_string (idea by ivan)
michael
parents: 12238
diff changeset
253 for(i=0; i<stream_count; i++){
f67bc1d216a1 file_id_string (idea by ivan)
michael
parents: 12238
diff changeset
254 if(next_packet==video_stream_header)
f67bc1d216a1 file_id_string (idea by ivan)
michael
parents: 12238
diff changeset
255 video_stream_header
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
256 else if(next_packet==audio_stream_header)
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
257 audio_stream_header
12242
f67bc1d216a1 file_id_string (idea by ivan)
michael
parents: 12238
diff changeset
258 else
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
259 other_stream_header
12242
f67bc1d216a1 file_id_string (idea by ivan)
michael
parents: 12238
diff changeset
260 }
16506
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
261 while(next_code == info_startcode){
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
262 info_packet
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
263 }
12413
87a6dc69b65a proposals by rich:
michael
parents: 12392
diff changeset
264 while(next_code != main_startcode){
16506
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
265 if(next_code == frame_startcode)
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
266 sync_point
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
267 frame
12242
f67bc1d216a1 file_id_string (idea by ivan)
michael
parents: 12238
diff changeset
268 }
f67bc1d216a1 file_id_string (idea by ivan)
michael
parents: 12238
diff changeset
269 }
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
270 if (next_code == index_startcode){
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
271 while(!eof){
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
272 index
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
273 }
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
274 index_ptr u(64)
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
275 }
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
276
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
277
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
278 Tag description:
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
279
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
280 forward_ptr
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
281 size of the packet data (exactly the distance from the first byte
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
282 after the forward_ptr to the first byte of the next packet)
12242
f67bc1d216a1 file_id_string (idea by ivan)
michael
parents: 12238
diff changeset
283
16506
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
284 back_ptr
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
285 pointer to the latest syncpoint, for which there is at least one
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
286 keyframe prior to the global_timestamp in every stream
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
287
12242
f67bc1d216a1 file_id_string (idea by ivan)
michael
parents: 12238
diff changeset
288 file_id_string
f67bc1d216a1 file_id_string (idea by ivan)
michael
parents: 12238
diff changeset
289 "nut/multimedia container\0"
9323
774afe44f17b some more info (copy & pasted from ML)
michael
parents: 9312
diff changeset
290
774afe44f17b some more info (copy & pasted from ML)
michael
parents: 9312
diff changeset
291 *_startcode
12162
ab533510d598 remove old example stream
michael
parents: 12161
diff changeset
292 all startcodes start with 'N'
ab533510d598 remove old example stream
michael
parents: 12161
diff changeset
293
ab533510d598 remove old example stream
michael
parents: 12161
diff changeset
294 main_startcode
ab533510d598 remove old example stream
michael
parents: 12161
diff changeset
295 0x7A561F5F04ADULL + (((uint64_t)('N'<<8) + 'M')<<48)
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
296
12162
ab533510d598 remove old example stream
michael
parents: 12161
diff changeset
297 stream_starcode
ab533510d598 remove old example stream
michael
parents: 12161
diff changeset
298 0x11405BF2F9DBULL + (((uint64_t)('N'<<8) + 'S')<<48)
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
299
12333
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
300 frame_startcode
12162
ab533510d598 remove old example stream
michael
parents: 12161
diff changeset
301 0xE4ADEECA4569ULL + (((uint64_t)('N'<<8) + 'K')<<48)
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
302
15008
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
303 frame_startcodes SHOULD be placed immediately before a keyframe if the
12392
f4878bfe49c8 nicer startcode before keyframe rule
michael
parents: 12379
diff changeset
304 previous frame of the same stream was a non-keyframe, unless such
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
305 non-keyframe - keyframe transitions are very frequent
12365
dc05db3f172f additional start_code rule (implemenattion does this since a long time already)
michael
parents: 12333
diff changeset
306
12162
ab533510d598 remove old example stream
michael
parents: 12161
diff changeset
307 index_startcode
ab533510d598 remove old example stream
michael
parents: 12161
diff changeset
308 0xDD672F23E64EULL + (((uint64_t)('N'<<8) + 'X')<<48)
ab533510d598 remove old example stream
michael
parents: 12161
diff changeset
309 info_startcode
ab533510d598 remove old example stream
michael
parents: 12161
diff changeset
310 0xAB68B596BA78ULL + (((uint64_t)('N'<<8) + 'I')<<48)
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
311
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
312 version
15008
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
313 NUT version. The current value is 2.
12238
a0ddf85bdee0 removing backward pointers
michael
parents: 12209
diff changeset
314
12333
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
315 max_distance
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
316 max distance of frame_startcodes, the distance may only be larger if
16428
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
317 there is only a single frame between the two frame_startcodes this can
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
318 be used by the demuxer to detect damaged frame headers if the damage
15008
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
319 results in too long of a chain
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
320
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
321 SHOULD be set to <=32768 or at least <=65536 unless there is a very
15008
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
322 good reason to set it higher, otherwise reasonable error recovery will
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
323 be impossible
12501
cd0d9a99b730 remove index flag
michael
parents: 12428
diff changeset
324
14919
1d4861b2ac4a returning to the old index at the end system, alternatives are too complex with questionable advantages
michael
parents: 14911
diff changeset
325 max_index_distance
1d4861b2ac4a returning to the old index at the end system, alternatives are too complex with questionable advantages
michael
parents: 14911
diff changeset
326 max distance of keyframes which are represented in the index, the
1d4861b2ac4a returning to the old index at the end system, alternatives are too complex with questionable advantages
michael
parents: 14911
diff changeset
327 distance between consecutive entries A and B may only be larger if
1d4861b2ac4a returning to the old index at the end system, alternatives are too complex with questionable advantages
michael
parents: 14911
diff changeset
328 there are no keyframes within this stream between A and B
1d4861b2ac4a returning to the old index at the end system, alternatives are too complex with questionable advantages
michael
parents: 14911
diff changeset
329 SHOULD be set to <=32768 or at least <=65536 unless there is a very
1d4861b2ac4a returning to the old index at the end system, alternatives are too complex with questionable advantages
michael
parents: 14911
diff changeset
330 good reason to set it higher
12501
cd0d9a99b730 remove index flag
michael
parents: 12428
diff changeset
331
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
332 stream_id
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
333 Stream identifier
12150
2c9a2b1772bc language_code & fourcc vb->v reversal
michael
parents: 12118
diff changeset
334 stream_id MUST be < stream_count
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
335
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
336 stream_class
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
337 0 video
14471
6cdd5669e930 Here is an updated draft with the bits discussed previously merged:
michael
parents: 13308
diff changeset
338 1 audio
6cdd5669e930 Here is an updated draft with the bits discussed previously merged:
michael
parents: 13308
diff changeset
339 2 subtiles
6cdd5669e930 Here is an updated draft with the bits discussed previously merged:
michael
parents: 13308
diff changeset
340 3 metadata
16506
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
341 4 userdata
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
342 in metadata streams each frame contains exactly one info frame
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
343 Note: the remaining values are reserved and MUST NOT be used
12184
17667db616d3 (de)coder -> (de)muxer
michael
parents: 12162
diff changeset
344 a demuxer MUST ignore streams with reserved classes
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
345
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
346 fourcc
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
347 identification for the codec
9323
774afe44f17b some more info (copy & pasted from ML)
michael
parents: 9312
diff changeset
348 example: "H264"
10817
59ac254c2541 some updates
alex
parents: 10166
diff changeset
349 MUST contain 2 or 4 bytes, note, this might be increased in the future
59ac254c2541 some updates
alex
parents: 10166
diff changeset
350 if needed
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
351
9297
8a19be9649e7 use fraction for time_base
michael
parents: 9296
diff changeset
352 time_base_nom / time_base_denom = time_base
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
353 the length of a timer tick in seconds, this MUST be equal to the 1/fps
16428
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
354 if fixed_fps is 1
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
355 time_base_nom and time_base_denom MUST NOT be 0
15008
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
356 time_base_nom and time_base_denom MUST be relatively prime
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
357 time_base_denom MUST be < 2^31
9297
8a19be9649e7 use fraction for time_base
michael
parents: 9296
diff changeset
358 examples:
8a19be9649e7 use fraction for time_base
michael
parents: 9296
diff changeset
359 fps time_base_nom time_base_denom
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
360 30 1 30
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
361 29.97 1001 30000
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
362 23.976 1001 24000
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
363
12413
87a6dc69b65a proposals by rich:
michael
parents: 12392
diff changeset
364 global_time_base_nom / global_time_base_denom = global_time_base
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
365 the length of a timer tick in seconds
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
366 global_time_base_nom and global_time_base_denom MUST NOT be 0
15008
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
367 global_time_base_nom and global_time_base_denom MUST be relatively prime
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
368 global_time_base_denom MUST be < 2^31
12413
87a6dc69b65a proposals by rich:
michael
parents: 12392
diff changeset
369
87a6dc69b65a proposals by rich:
michael
parents: 12392
diff changeset
370 global_timestamp
87a6dc69b65a proposals by rich:
michael
parents: 12392
diff changeset
371 timestamp in global_time_base units
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
372 when a global_timestamp is encountered the last_pts of all
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
373 streams is set to the following:
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
374
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
375 ln= global_time_base_nom*time_base_denom
12413
87a6dc69b65a proposals by rich:
michael
parents: 12392
diff changeset
376 sn= global_timestamp
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
377 d1= global_time_base_denom
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
378 d2= time_base_nom
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
379 last_pts= (ln/d1*sn + ln%d1*sn/d1)/d2
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
380 Note: this calculation MUST be done with unsigned 64 bit integers, and
12413
87a6dc69b65a proposals by rich:
michael
parents: 12392
diff changeset
381 is equivalent to (ln*sn)/(d1*d2) but this would require a 96bit integer
87a6dc69b65a proposals by rich:
michael
parents: 12392
diff changeset
382
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
383 msb_pts_shift
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
384 amount of bits in lsb_pts
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
385 MUST be <16
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
386
12333
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
387 decode_delay
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
388 maximum time between input and output for a codec, used to generate
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
389 dts from pts
16428
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
390 is set to 0 for streams without B-frames, and set to 1 for streams with
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
391 B-frames, may be larger for future codecs
12333
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
392
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
393 fixed_fps
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
394 1 indicates that the fps is fixed
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
395
9356
025a25987ac0 simplification
michael
parents: 9350
diff changeset
396 codec_specific_data
025a25987ac0 simplification
michael
parents: 9350
diff changeset
397 private global data for a codec (could be huffman tables or ...)
12082
f705b0777572 removing subpackets (everyone hates them ...)
michael
parents: 11975
diff changeset
398
f705b0777572 removing subpackets (everyone hates them ...)
michael
parents: 11975
diff changeset
399 frame_code
f705b0777572 removing subpackets (everyone hates them ...)
michael
parents: 11975
diff changeset
400 the meaning of this byte is stored in the main header
f705b0777572 removing subpackets (everyone hates them ...)
michael
parents: 11975
diff changeset
401 the value 78 ('N') is forbidden to ensure that the byte is always
f705b0777572 removing subpackets (everyone hates them ...)
michael
parents: 11975
diff changeset
402 different from the first byte of any startcode
9420
8a1a8f5e9c91 variable subpacket size support
michael
parents: 9373
diff changeset
403
12082
f705b0777572 removing subpackets (everyone hates them ...)
michael
parents: 11975
diff changeset
404 flags[frame_code]
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
405 first of the flags from MSB to LSB are called KD
12261
d43f1c599701 remove data_size prediction
michael
parents: 12254
diff changeset
406 if D is 1 then data_size_msb is coded, otherwise data_size_msb is 0
12238
a0ddf85bdee0 removing backward pointers
michael
parents: 12209
diff changeset
407 K is the keyframe_type
a0ddf85bdee0 removing backward pointers
michael
parents: 12209
diff changeset
408 0-> no keyframe,
a0ddf85bdee0 removing backward pointers
michael
parents: 12209
diff changeset
409 1-> keyframe,
12413
87a6dc69b65a proposals by rich:
michael
parents: 12392
diff changeset
410 flags=4 can be used to mark illegal frame_code bytes
87a6dc69b65a proposals by rich:
michael
parents: 12392
diff changeset
411 frame_code=78 must have flags=4
15008
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
412 Note: frames MUST NOT depend(1) upon frames prior to the last
12333
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
413 frame_startcode
15008
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
414 Important: depend(1) means dependency on the container level (NUT) not
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
415 dependency on the codec level
12110
a34dc5a369ca restrictions to ensure that O(log n) seeking and error recovery is possible
michael
parents: 12084
diff changeset
416
12084
68baf8877c07 reversing the change to the forw/backw pointers, its somewhat simpler to update it if the forward pointer is first
michael
parents: 12082
diff changeset
417 stream_id_plus1[frame_code]
12082
f705b0777572 removing subpackets (everyone hates them ...)
michael
parents: 11975
diff changeset
418 must be <250
15008
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
419 if it is 0, then the stream_id is coded in the frame
9579
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
420
12082
f705b0777572 removing subpackets (everyone hates them ...)
michael
parents: 11975
diff changeset
421 data_size_mul[frame_code]
12379
4100528fadf1 limits too small, my CBR mp3 samples have 2x overhead after removial of size prediction
michael
parents: 12368
diff changeset
422 must be <16384
9579
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
423
12082
f705b0777572 removing subpackets (everyone hates them ...)
michael
parents: 11975
diff changeset
424 data_size_lsb[frame_code]
12379
4100528fadf1 limits too small, my CBR mp3 samples have 2x overhead after removial of size prediction
michael
parents: 12368
diff changeset
425 must be <16384
12082
f705b0777572 removing subpackets (everyone hates them ...)
michael
parents: 11975
diff changeset
426
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
427 pts_delta[frame_code]
12413
87a6dc69b65a proposals by rich:
michael
parents: 12392
diff changeset
428 must be <16384 and >-16384
87a6dc69b65a proposals by rich:
michael
parents: 12392
diff changeset
429
12084
68baf8877c07 reversing the change to the forw/backw pointers, its somewhat simpler to update it if the forward pointer is first
michael
parents: 12082
diff changeset
430 data_size
12261
d43f1c599701 remove data_size prediction
michael
parents: 12254
diff changeset
431 data_size= data_size_lsb + data_size_msb*data_size_mul;
12082
f705b0777572 removing subpackets (everyone hates them ...)
michael
parents: 11975
diff changeset
432
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
433 coded_pts
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
434 if coded_pts < (1<<msb_pts_shift) then it is an lsb
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
435 pts, otherwise it is a full pts + (1<<msb_pts_shift)
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
436 lsb pts is converted to a full pts by:
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
437 mask = (1<<msb_pts_shift)-1;
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
438 delta= last_pts - mask/2
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
439 pts= ((pts_lsb-delta)&mask) + delta
12261
d43f1c599701 remove data_size prediction
michael
parents: 12254
diff changeset
440
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
441 lsb_pts
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
442 least significant bits of the pts in time_base precision
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
443 Example: IBBP display order
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
444 keyframe pts=0 -> pts=0
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
445 frame lsb_pts=3 -> pts=3
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
446 frame lsb_pts=1 -> pts=1
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
447 frame lsb_pts=2 -> pts=2
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
448 ...
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
449 keyframe msb_pts=257 -> pts=257
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
450 frame lsb_pts=255->pts=255
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
451 frame lsb_pts=0 -> pts=256
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
452 frame lsb_pts=4 -> pts=260
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
453 frame lsb_pts=2 -> pts=258
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
454 frame lsb_pts=3 -> pts=259
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
455 all pts's of keyframes of a single stream MUST be monotone
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
456
12333
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
457 dts
15008
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
458 dts is calculated by using a decode_delay+1 sized buffer for each
12333
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
459 stream, into which the current pts is inserted and the element with
15008
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
460 the smallest value is removed, this is then the current dts
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
461 this buffer is initalized with decode_delay -1 elements
16511
3a24be1b0a60 remove info frame repeating its problematic and controversical
michael
parents: 16506
diff changeset
462 all frames must be monotone, that means a frame
16428
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
463 which occurs later in the stream must have a larger or equal dts
15008
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
464 than an earlier frame
12333
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
465
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
466 width/height
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
467 MUST be set to the coded width/height
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
468
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
469 sample_width/sample_height (aspect ratio)
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
470 sample_width is the horizontal distance between samples
15008
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
471 sample_width and sample_height MUST be relatively prime if not zero
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
472 MUST be 0 if unknown
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
473
10158
93e5428d0b3e some changes (michael: is the colorspace_type field needed?)
alex
parents: 10061
diff changeset
474 colorspace_type
10166
e860465ef46e colorspace_type
michael
parents: 10158
diff changeset
475 0 unknown
e860465ef46e colorspace_type
michael
parents: 10158
diff changeset
476 1 ITU Rec 624 / ITU Rec 601 Y range: 16..235 Cb/Cr range: 16..240
e860465ef46e colorspace_type
michael
parents: 10158
diff changeset
477 2 ITU Rec 709 Y range: 16..235 Cb/Cr range: 16..240
e860465ef46e colorspace_type
michael
parents: 10158
diff changeset
478 17 ITU Rec 624 / ITU Rec 601 Y range: 0..255 Cb/Cr range: 0..255
e860465ef46e colorspace_type
michael
parents: 10158
diff changeset
479 18 ITU Rec 709 Y range: 0..255 Cb/Cr range: 0..255
e860465ef46e colorspace_type
michael
parents: 10158
diff changeset
480
12333
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
481 samplerate_nom / samplerate_denom = samplerate
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
482 the number of samples per second
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
483
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
484 checksum
12118
b8fea9441d02 switching from crc32 to adler32 checksums, cuz they are faster and simpler
michael
parents: 12117
diff changeset
485 adler32 checksum
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
486 checksum is calculated for the area pointed to by forward_ptr not
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
487 including the checksum itself (from first byte after the
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
488 forward_ptr until last byte before the checksum).
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
489
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
490 max_pts
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
491 The highest pts in the stream.
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
492
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
493 index_pts
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
494 value of the pts of a keyframe relative to the last keyframe
14471
6cdd5669e930 Here is an updated draft with the bits discussed previously merged:
michael
parents: 13308
diff changeset
495 stored in this index
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
496
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
497 index_position
14471
6cdd5669e930 Here is an updated draft with the bits discussed previously merged:
michael
parents: 13308
diff changeset
498 position in bytes of the first byte of a keyframe, relative to the
6cdd5669e930 Here is an updated draft with the bits discussed previously merged:
michael
parents: 13308
diff changeset
499 last keyframe stored in this index
14919
1d4861b2ac4a returning to the old index at the end system, alternatives are too complex with questionable advantages
michael
parents: 14911
diff changeset
500 there MUST be no keyframe with the same stream_id as this index between
16428
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
501 two consecutive index entries if they are more than max_index_distance
15008
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
502 apart
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
503
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
504 index_ptr
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
505 Length in bytes from the first byte of the first index startcode
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
506 to the first byte of the index_ptr. If there is no index, index_ptr
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
507 MUST NOT be written.
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
508
9579
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
509 id
16428
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
510 the ID of the type/name pair, so it is more compact
9579
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
511 0 means end
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
512
9323
774afe44f17b some more info (copy & pasted from ML)
michael
parents: 9312
diff changeset
513 type
16428
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
514 for example: "UTF8" -> string or "JPEG" -> JPEG image
9579
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
515 Note: nonstandard fields should be prefixed by "X-"
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
516 Note: MUST be less than 6 byte long (might be increased to 64 later)
9323
774afe44f17b some more info (copy & pasted from ML)
michael
parents: 9312
diff changeset
517
13308
8ff17d153414 info packet is now file global, while meta pakcet is stream specific, as discussed with Rich
alex
parents: 13047
diff changeset
518 info packet types
9295
michael
parents: 9294
diff changeset
519 the name of the info entry, valid names are
14471
6cdd5669e930 Here is an updated draft with the bits discussed previously merged:
michael
parents: 13308
diff changeset
520 "StreamId" the stream(s) to which the info packet applies
13308
8ff17d153414 info packet is now file global, while meta pakcet is stream specific, as discussed with Rich
alex
parents: 13047
diff changeset
521
9347
97888c25ae60 changing name to "nut" for now, we can change it again if we agree on something else
michael
parents: 9335
diff changeset
522 "Author"
97888c25ae60 changing name to "nut" for now, we can change it again if we agree on something else
michael
parents: 9335
diff changeset
523 "Description"
97888c25ae60 changing name to "nut" for now, we can change it again if we agree on something else
michael
parents: 9335
diff changeset
524 "Copyright"
9369
f7fc442571f7 added (PAL),(NTSC),..
alex
parents: 9361
diff changeset
525 "Encoder" the name & version of the software used for encoding
9347
97888c25ae60 changing name to "nut" for now, we can change it again if we agree on something else
michael
parents: 9335
diff changeset
526 "Title"
16428
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
527 "Cover" an image of the (CD, DVD, VHS, ..) cover (preferably PNG or JPEG)
9350
12391e52c2f7 -typo, +time, -ntsc/pal (idea by alex)
michael
parents: 9347
diff changeset
528 "Source" "DVD", "VCD", "CD", "MD", "FM radio", "VHS", "TV",
12391e52c2f7 -typo, +time, -ntsc/pal (idea by alex)
michael
parents: 9347
diff changeset
529 "LD"
16428
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
530 Optional: appended PAL, NTSC, SECAM, ... in parentheses
9350
12391e52c2f7 -typo, +time, -ntsc/pal (idea by alex)
michael
parents: 9347
diff changeset
531 "CaptureDevice" "BT878", "BT848", "webcam", ... (more exact names are fine too)
12391e52c2f7 -typo, +time, -ntsc/pal (idea by alex)
michael
parents: 9347
diff changeset
532 "CreationTime" "2003-01-20 20:13:15Z", ...
12391e52c2f7 -typo, +time, -ntsc/pal (idea by alex)
michael
parents: 9347
diff changeset
533 (ISO 8601 format, see http://www.cl.cam.ac.uk/~mgk25/iso-time.html)
16428
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
534 Note: do not forget the timezone
13308
8ff17d153414 info packet is now file global, while meta pakcet is stream specific, as discussed with Rich
alex
parents: 13047
diff changeset
535 "Keywords"
8ff17d153414 info packet is now file global, while meta pakcet is stream specific, as discussed with Rich
alex
parents: 13047
diff changeset
536 "TotalTime" total length of the stream in msecs
14471
6cdd5669e930 Here is an updated draft with the bits discussed previously merged:
michael
parents: 13308
diff changeset
537 "Language" ISO 639 and ISO 3166 for language/country code
6cdd5669e930 Here is an updated draft with the bits discussed previously merged:
michael
parents: 13308
diff changeset
538 something like "eng" (US english), can be 0 if unknown
6cdd5669e930 Here is an updated draft with the bits discussed previously merged:
michael
parents: 13308
diff changeset
539 and "multi" if several languages
6cdd5669e930 Here is an updated draft with the bits discussed previously merged:
michael
parents: 13308
diff changeset
540 see http://www.loc.gov/standards/iso639-2/englangn.html
15008
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
541 and http://www.din.de/gremien/nas/nabd/iso3166ma/codlstp1/en_listp1.html the language code
12503
a160a68209ac disposition
michael
parents: 12502
diff changeset
542 "Disposition" "original", "dub" (translated), "comment", "lyrics", "karaoke"
9295
michael
parents: 9294
diff changeset
543 Note: if someone needs some others, please tell us about them, so we can
michael
parents: 9294
diff changeset
544 add them to the official standard (if they are sane)
9360
add934b25d6d "X-" prefix for nonstd fields & "keywords" idea by (Andreas Hess <jaska at gmx dot net>)
michael
parents: 9357
diff changeset
545 Note: nonstandard fields should be prefixed by "X-"
9579
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
546 Note: MUST be less than 64 bytes long
9295
michael
parents: 9294
diff changeset
547
michael
parents: 9294
diff changeset
548 value
9579
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
549 value of this name/type pair
9295
michael
parents: 9294
diff changeset
550
9310
b16480522be9 some typos
michael
parents: 9307
diff changeset
551 stuffing
14854
ebc5136f2a56 some comments and whitespace changes by (Luca Barbato <lu_zero gentoo org>)
michael
parents: 14471
diff changeset
552 0x80 can be placed in front of any type v entry for stuffing purposes
9579
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
553
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
554 info_table[][2]={
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
555 {NULL , NULL }, // end
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
556 {NULL , NULL },
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
557 {NULL , "UTF8"},
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
558 {NULL , "v"},
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
559 {NULL , "s"},
14471
6cdd5669e930 Here is an updated draft with the bits discussed previously merged:
michael
parents: 13308
diff changeset
560 {"StreamId" , "v"},
9579
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
561 {"Author" , "UTF8"},
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
562 {"Titel" , "UTF8"},
14471
6cdd5669e930 Here is an updated draft with the bits discussed previously merged:
michael
parents: 13308
diff changeset
563 {"Language" , "UTF8"},
9579
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
564 {"Description" , "UTF8"},
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
565 {"Copyright" , "UTF8"},
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
566 {"Encoder" , "UTF8"},
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
567 {"Keyword" , "UTF8"},
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
568 {"Cover" , "JPEG"},
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
569 {"Cover" , "PNG"},
14471
6cdd5669e930 Here is an updated draft with the bits discussed previously merged:
michael
parents: 13308
diff changeset
570 {"Disposition" , "UTF8"},
9579
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
571 };
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
572
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
573 Structure:
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
574
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
575 the headers MUST be in exactly the following order (to simplify demuxer design)
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
576 main header
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
577 stream_header (id=0)
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
578 stream_header (id=1)
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
579 ...
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
580 stream_header (id=n)
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
581
15008
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
582 headers may be repeated, but if they are, then they MUST all be repeated
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
583 together and repeated headers MUST be identical
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
584 headers MAY only repeat at the closest possible positions after 2^x where x is
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
585 an integer and the file end, so the headers may be repeated at 4102 if that is
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
586 the closest position after 2^12=4096 at which the headers can be placed
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
587
15008
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
588 headers MUST be placed at least at the start of the file and immediately before
12501
cd0d9a99b730 remove index flag
michael
parents: 12428
diff changeset
589 the index or at the file end if there is no index
16428
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
590 headers MUST be repeated at least twice (so they exist three times in a file)
9295
michael
parents: 9294
diff changeset
591
16506
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
592 there MUST be a sync point immedeatly before the first frame after any headers
12503
a160a68209ac disposition
michael
parents: 12502
diff changeset
593
9310
b16480522be9 some typos
michael
parents: 9307
diff changeset
594 Index
15008
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
595 Note: with realtime streaming, there is no end, so no index there either
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
596 An index SHOULD be written for every stream. Indices MUST be placed at end
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
597 of file. Indices MAY be repeated for a stream.
9310
b16480522be9 some typos
michael
parents: 9307
diff changeset
598
16506
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
599 Info frames
1e42b8be5b7f add back_ptr
michael
parents: 16503
diff changeset
600 Info frames can be used to describe the file or some part of it (chapters)
9310
b16480522be9 some typos
michael
parents: 9307
diff changeset
601
b16480522be9 some typos
michael
parents: 9307
diff changeset
602 Unknown packets
12184
17667db616d3 (de)coder -> (de)muxer
michael
parents: 12162
diff changeset
603 MUST be ignored by the demuxer
9310
b16480522be9 some typos
michael
parents: 9307
diff changeset
604
12501
cd0d9a99b730 remove index flag
michael
parents: 12428
diff changeset
605 demuxer (non-normative)
cd0d9a99b730 remove index flag
michael
parents: 12428
diff changeset
606
16428
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
607 in the absence of a valid header at the beginning, players SHOULD search for
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
608 backup headers starting at offset 2^x; for each x players SHOULD end their
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
609 search at a particular offset when any startcode is found (including syncpoint)
12501
cd0d9a99b730 remove index flag
michael
parents: 12428
diff changeset
610
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
611 Semantic requirements
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
612
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
613 If more than one stream of a given stream class is present, each one MUST
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
614 have info tags specifying disposition, and if applicable, language.
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
615
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
616 A demuxer MUST NOT demux a stream which contains more than one stream, or which
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
617 is wrapped in a structure to facilitate more than one stream or otherwise
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
618 duplicate the role of a container. any such file is to be considered invalid.
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
619
12501
cd0d9a99b730 remove index flag
michael
parents: 12428
diff changeset
620
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
621 Sample code (GPL, & untested)
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
622
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
623 typedef BufferContext{
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
624 uint8_t *buf;
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
625 uint8_t *buf_ptr;
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
626 }BufferContext;
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
627
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
628 static inline uint64_t get_bytes(BufferContext *bc, int count){
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
629 uint64_t val=0;
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
630
15008
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
631 assert(count>0 && count<9);
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
632
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
633 for(i=0; i<count; i++){
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
634 val <<=8;
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
635 val += *(bc->buf_ptr++);
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
636 }
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
637
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
638 return val;
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
639 }
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
640
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
641 static inline void put_bytes(BufferContext *bc, int count, uint64_t val){
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
642 uint64_t val=0;
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
643
15008
0a43341c8bfd less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)
michael
parents: 14919
diff changeset
644 assert(count>0 && count<9);
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
645
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
646 for(i=count-1; i>=0; i--){
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
647 *(bc->buf_ptr++)= val >> (8*i);
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
648 }
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
649
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
650 return val;
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
651 }
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
652
10061
76b1c7d20da8 corrected the sample code
alex
parents: 9580
diff changeset
653 static inline uint64_t get_v(BufferContext *bc){
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
654 uint64_t val= 0;
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
655
10158
93e5428d0b3e some changes (michael: is the colorspace_type field needed?)
alex
parents: 10061
diff changeset
656 for(; space_left(bc) > 0; ){
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
657 int tmp= *(bc->buf_ptr++);
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
658 if(tmp&0x80)
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
659 val= (val<<7) + tmp - 0x80;
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
660 else
9299
aa26f77e7aae remove non byte sized stuff
michael
parents: 9297
diff changeset
661 return (val<<7) + tmp;
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
662 }
9579
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
663
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
664 return -1;
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
665 }
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
666
10061
76b1c7d20da8 corrected the sample code
alex
parents: 9580
diff changeset
667 static inline int put_v(BufferContext *bc, uint64_t val){
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
668 int i;
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
669
10158
93e5428d0b3e some changes (michael: is the colorspace_type field needed?)
alex
parents: 10061
diff changeset
670 if(space_left(bc) < 9) return -1;
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
671
9579
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
672 val &= 0x7FFFFFFFFFFFFFFFULL; // FIXME can only encode upto 63 bits currently
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
673 for(i=7; ; i+=7){
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
674 if(val>>i == 0) break;
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
675 }
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
676
10827
michael
parents: 10824
diff changeset
677 for(i-=7; i>0; i-=7){
9294
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
678 *(bc->buf_ptr++)= 0x80 | (val>>i);
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
679 }
7159ed6a4d0b nonsense (MPlayer container format draft 0.01)
michael
parents:
diff changeset
680 *(bc->buf_ptr++)= val&0x7F;
9579
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
681
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
682 return 0;
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
683 }
89d27a306886 *signed int vlc (needs only 5 lines of code so its no increase of complexity)
michael
parents: 9422
diff changeset
684
12333
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
685 static int64_t get_dts(int64_t pts, int64_t *pts_cache, int delay, int reset){
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
686 if(reset) memset(pts_cache, -1, delay*sizeof(int64_t));
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
687
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
688 while(delay--){
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
689 int64_t t= pts_cache[delay];
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
690 if(t < pts){
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
691 pts_cache[delay]= pts;
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
692 pts= t;
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
693 }
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
694 }
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
695
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
696 return pts;
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
697 }
80036bf4a9f5 remove frame types
michael
parents: 12297
diff changeset
698
10158
93e5428d0b3e some changes (michael: is the colorspace_type field needed?)
alex
parents: 10061
diff changeset
699 Authors
93e5428d0b3e some changes (michael: is the colorspace_type field needed?)
alex
parents: 10061
diff changeset
700
16428
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
701 Folks from the MPlayer developers mailing list (http://www.mplayerhq.hu/).
5f4317692b7c spelling/grammar/wording
diego
parents: 15755
diff changeset
702 Authors in alphabetical order: (FIXME! Tell us if we left you out)
10158
93e5428d0b3e some changes (michael: is the colorspace_type field needed?)
alex
parents: 10061
diff changeset
703 Beregszaszi, Alex (alex@fsn.hu)
93e5428d0b3e some changes (michael: is the colorspace_type field needed?)
alex
parents: 10061
diff changeset
704 Bunkus, Moritz (moritz@bunkus.org)
15755
b1b06adc5cd3 Fix email address
ranma
parents: 15008
diff changeset
705 Diedrich, Tobias (ranma+mplayer@tdiedrich.de)
12297
a6b64a263ca2 imo i'm one of the nut spec authors :)
rfelker
parents: 12261
diff changeset
706 Felker, Rich (dalias@aerifal.cx)
10158
93e5428d0b3e some changes (michael: is the colorspace_type field needed?)
alex
parents: 10061
diff changeset
707 Franz, Fabian (FabianFranz@gmx.de)
93e5428d0b3e some changes (michael: is the colorspace_type field needed?)
alex
parents: 10061
diff changeset
708 Gereoffy, Arpad (arpi@thot.banki.hu)
93e5428d0b3e some changes (michael: is the colorspace_type field needed?)
alex
parents: 10061
diff changeset
709 Hess, Andreas (jaska@gmx.net)
93e5428d0b3e some changes (michael: is the colorspace_type field needed?)
alex
parents: 10061
diff changeset
710 Niedermayer, Michael (michaelni@gmx.at)
16429
84174804804b Updates to NUT spec:
ods15
parents: 16428
diff changeset
711 Shimon, Oded (ods15@ods15.dyndns.org)