Mercurial > mplayer.hg
comparison DOCS/tech/mpcf.txt @ 14471:6cdd5669e930
Here is an updated draft with the bits discussed previously merged:
- short startcode removed
- QT/Microsoft codec_specific_data removed, reverted to a neutral format
- meta packet removed, merged in the info packet.
- stream class simplified, added metadata stream
patch by (Luca Barbato <lu_zero gentoo org>)
author | michael |
---|---|
date | Wed, 12 Jan 2005 11:54:30 +0000 |
parents | 8ff17d153414 |
children | ebc5136f2a56 |
comparison
equal
deleted
inserted
replaced
14470:0db5d481d31b | 14471:6cdd5669e930 |
---|---|
1 NUT Open Container Format DRAFT 20040911 | 1 NUT Open Container Format DRAFT 20050111 |
2 ---------------------------------------- | 2 ---------------------------------------- |
3 | 3 |
4 | 4 |
5 | 5 |
6 Intro: | 6 Intro: |
87 main_startcode f(64) | 87 main_startcode f(64) |
88 packet header | 88 packet header |
89 version v | 89 version v |
90 stream_count v | 90 stream_count v |
91 max_distance v | 91 max_distance v |
92 max_short_distance v | 92 max_index_distance v |
93 global_time_base_nom v | 93 global_time_base_nom v |
94 global_time_base_denom v | 94 global_time_base_denom v |
95 short_startcode v | |
96 for(i=0; i<256; ){ | 95 for(i=0; i<256; ){ |
97 tmp_flag v | 96 tmp_flag v |
98 tmp_fields v | 97 tmp_fields v |
99 if(tmp_fields>0) tmp_timestamp s | 98 if(tmp_fields>0) tmp_timestamp s |
100 if(tmp_fields>1) tmp_mul v | 99 if(tmp_fields>1) tmp_mul v |
131 time_base_denom v | 130 time_base_denom v |
132 msb_timestamp_shift v | 131 msb_timestamp_shift v |
133 decode_delay v | 132 decode_delay v |
134 fixed_fps u(1) | 133 fixed_fps u(1) |
135 reserved u(6) | 134 reserved u(6) |
136 for(;;){ | 135 codec_specific_data vb |
137 codec_specific_data_type v | |
138 if(codec_specific_data_type==0) break; | |
139 codec_specific_data vb | |
140 } | |
141 | 136 |
142 video_stream_header: | 137 video_stream_header: |
143 stream_header | 138 stream_header |
144 width v | 139 width v |
145 height v | 140 height v |
174 data | 169 data |
175 | 170 |
176 Index: | 171 Index: |
177 index_startcode f(64) | 172 index_startcode f(64) |
178 packet header | 173 packet header |
174 stream_id v | |
179 index_length v | 175 index_length v |
180 for(i=0; i<index_length; i++){ | 176 for(i=0; i<index_length; i++){ |
181 index_timestamp v | 177 index_timestamp v |
182 index_position v | 178 index_position v |
183 } | 179 } |
184 reserved_bytes | 180 reserved_bytes |
185 checksum u(32) | 181 checksum u(32) |
186 | 182 |
187 info_packet: (optional) (file global) | 183 info_packet: (optional) |
188 info_startcode f(64) | 184 info_startcode f(64) |
189 packet header | 185 packet header |
190 for(;;){ | 186 for(;;){ |
191 id v | 187 id v |
192 if(id==0) break | 188 if(id==0) break |
201 else | 197 else |
202 value vb | 198 value vb |
203 } | 199 } |
204 reserved_bytes | 200 reserved_bytes |
205 checksum u(32) | 201 checksum u(32) |
206 | |
207 meta_packet: (optional) (stream specific) | |
208 meta_startcode f(64) | |
209 packet header | |
210 stream_id v | |
211 for(;;){ | |
212 id v | |
213 if(id==0) break | |
214 name= meta_table[id][0] | |
215 type= meta_table[id][1] | |
216 if(type==NULL) | |
217 type vb | |
218 if(name==NULL) | |
219 name vb | |
220 if(type=="v") | |
221 value v | |
222 else | |
223 value vb | |
224 } | |
225 reserved_bytes | |
226 checksum u(32) | |
227 | 202 |
228 sync_point | 203 sync_point |
229 frame_startcode f(64) | 204 frame_startcode f(64) |
230 global_timestamp v | 205 global_timestamp v |
231 | 206 |
241 } | 216 } |
242 while(next_code != main_startcode){ | 217 while(next_code != main_startcode){ |
243 if(next_code == info_startcode) | 218 if(next_code == info_startcode) |
244 info_packet | 219 info_packet |
245 else{ | 220 else{ |
246 if(next_code == short_startcode) | 221 if(next_code == frame_startcode) |
247 short_startcode u(24) | |
248 else if(next_code == frame_startcode) | |
249 sync_point | 222 sync_point |
250 frame | 223 frame |
251 } | 224 } |
252 } | 225 } |
253 } | 226 } |
275 | 248 |
276 index_startcode | 249 index_startcode |
277 0xDD672F23E64EULL + (((uint64_t)('N'<<8) + 'X')<<48) | 250 0xDD672F23E64EULL + (((uint64_t)('N'<<8) + 'X')<<48) |
278 info_startcode | 251 info_startcode |
279 0xAB68B596BA78ULL + (((uint64_t)('N'<<8) + 'I')<<48) | 252 0xAB68B596BA78ULL + (((uint64_t)('N'<<8) + 'I')<<48) |
280 meta_startcode | |
281 FIXME | |
282 | 253 |
283 version | 254 version |
284 2 for now | 255 2 for now |
285 | 256 |
286 max_distance | 257 max_distance |
290 damage results in a too long chain | 261 damage results in a too long chain |
291 SHOULD be set to <=32768 or at least <=65536 unless there is a very good | 262 SHOULD be set to <=32768 or at least <=65536 unless there is a very good |
292 reason to set it higher otherwise reasonable error recovery will be | 263 reason to set it higher otherwise reasonable error recovery will be |
293 impossible | 264 impossible |
294 | 265 |
295 max_short_distance | 266 max_index_distance |
296 max distance of short startcodes or frame_startcodes, the distance may | 267 max distance of keyframes which are represented in the index, the |
297 only be larger if there is only a single frame between the 2 | 268 distance between consecutive entries A and B may only be larger if |
298 frame_startcodes/short startcodes this can be used by the demuxer to | 269 there are no keyframes within this stream between A and B |
299 detect damaged frame headers if the damage results in a too long chain | 270 SHOULD be set to <=32768 or at least <=65536 unless there is a very good |
300 SHOULD be set to <=4096 or at least <=8192 unless there is a very good | 271 reason to set it higher |
301 reason to set it higher otherwise reasonable error recovery will be | 272 |
302 impossible | 273 stream_id[FIXME] |
303 | |
304 | |
305 short_startcode | |
306 MUST be 3 bytes long and MUST have 'N' as first byte, the second byte | |
307 MUST not be a printable uppercase letter / must not be within 65..90, | |
308 default is 0x4EFE79 | |
309 | |
310 stream_id | |
311 Note: streams with a lower relative class MUST have a lower relative id | 274 Note: streams with a lower relative class MUST have a lower relative id |
312 so a stream with class 0 MUST allways have a id which is lower then any | 275 so a stream with class 0 MUST always have a id which is lower then any |
313 stream with class > 0 | 276 stream with class > 0 |
314 stream_id MUST be < stream_count | 277 stream_id MUST be < stream_count |
315 | 278 |
316 stream_class | 279 stream_class |
317 0 video | 280 0 video |
318 32 audio | 281 1 audio |
319 64 subtiles | 282 2 subtiles |
283 3 metadata | |
320 Note the remaining values are reserved and MUST NOT be used | 284 Note the remaining values are reserved and MUST NOT be used |
321 a demuxer MUST ignore streams with reserved classes | 285 a demuxer MUST ignore streams with reserved classes |
322 | 286 |
323 fourcc | 287 fourcc |
324 identification for the codec | 288 identification for the codec |
325 example: "H264" | 289 example: "H264" |
326 MUST contain 2 or 4 bytes, note, this might be increased in the future | 290 MUST contain 2 or 4 bytes, note, this might be increased in the future |
327 if needed | 291 if needed |
328 | |
329 language_code | |
330 ISO 639 and ISO 3166 for language/country code | |
331 something like "usen" (US english), can be 0 | |
332 if unknown | |
333 see http://www.loc.gov/standards/iso639-2/englangn.html | |
334 and http://www.din.de/gremien/nas/nabd/iso3166ma/codlstp1/en_listp1.html | |
335 | 292 |
336 time_base_nom / time_base_denom = time_base | 293 time_base_nom / time_base_denom = time_base |
337 the number of timer ticks per second, this MUST be equal to the fps | 294 the number of timer ticks per second, this MUST be equal to the fps |
338 if the fixed_fps is 1 | 295 if the fixed_fps is 1 |
339 time_base_denom MUST not be 0 | 296 time_base_denom MUST not be 0 |
380 be larger for future codecs | 337 be larger for future codecs |
381 | 338 |
382 fixed_fps | 339 fixed_fps |
383 1 indicates that the fps is fixed | 340 1 indicates that the fps is fixed |
384 | 341 |
385 codec_specific_data_type | |
386 0 none/end | |
387 1 native | |
388 2 bitmapinfoheader | |
389 3 waveformatex | |
390 4 imagedesc | |
391 5 sounddesc | |
392 "native", means a simple api & container independent storage form, | |
393 for example some mpeg4-es headers | |
394 | |
395 codec_specific_data | 342 codec_specific_data |
396 private global data for a codec (could be huffman tables or ...) | 343 private global data for a codec (could be huffman tables or ...) |
397 | 344 |
398 frame_code | 345 frame_code |
399 the meaning of this byte is stored in the main header | 346 the meaning of this byte is stored in the main header |
485 | 432 |
486 checksum | 433 checksum |
487 adler32 checksum | 434 adler32 checksum |
488 | 435 |
489 index_timestamp | 436 index_timestamp |
490 value of the timetamp in a sync point relative to the last sync-point | 437 value of the timetamp of a keyframe relative to the last keyframe |
438 stored in this index | |
491 | 439 |
492 index_position | 440 index_position |
493 position in bytes of the first byte of a sync-point, relative to the | 441 position in bytes of the first byte of a keyframe, relative to the |
494 last sync_point | 442 last keyframe stored in this index |
443 there MUST be no keyframe with the same stream_id as this index between | |
444 2 consecutive index entries if they are more then max_index_distance | |
445 appart | |
495 | 446 |
496 id | 447 id |
497 the id of the type/name pair, so its more compact | 448 the id of the type/name pair, so its more compact |
498 0 means end | 449 0 means end |
499 | 450 |
502 Note: nonstandard fields should be prefixed by "X-" | 453 Note: nonstandard fields should be prefixed by "X-" |
503 Note: MUST be less than 6 byte long (might be increased to 64 later) | 454 Note: MUST be less than 6 byte long (might be increased to 64 later) |
504 | 455 |
505 info packet types | 456 info packet types |
506 the name of the info entry, valid names are | 457 the name of the info entry, valid names are |
458 "StreamId" the stream(s) to which the info packet applies | |
507 | 459 |
508 "Author" | 460 "Author" |
509 "Description" | 461 "Description" |
510 "Copyright" | 462 "Copyright" |
511 "Encoder" the name & version of the software used for encoding | 463 "Encoder" the name & version of the software used for encoding |
518 "CreationTime" "2003-01-20 20:13:15Z", ... | 470 "CreationTime" "2003-01-20 20:13:15Z", ... |
519 (ISO 8601 format, see http://www.cl.cam.ac.uk/~mgk25/iso-time.html) | 471 (ISO 8601 format, see http://www.cl.cam.ac.uk/~mgk25/iso-time.html) |
520 Note: dont forget the timezone | 472 Note: dont forget the timezone |
521 "Keywords" | 473 "Keywords" |
522 "TotalTime" total length of the stream in msecs | 474 "TotalTime" total length of the stream in msecs |
523 | 475 "Language" ISO 639 and ISO 3166 for language/country code |
524 meta packet types | 476 something like "eng" (US english), can be 0 if unknown |
525 "ReplayGain" | 477 and "multi" if several languages |
526 "Language" the language code | 478 see http://www.loc.gov/standards/iso639-2/englangn.html |
479 and http://www.din.de/gremien/nas/nabd/iso3166ma/codlstp1/en_listp1.htmlthe language code | |
527 "Disposition" "original", "dub" (translated), "comment", "lyrics", "karaoke" | 480 "Disposition" "original", "dub" (translated), "comment", "lyrics", "karaoke" |
528 Note: if someone needs some others, please tell us about them, so we can | 481 Note: if someone needs some others, please tell us about them, so we can |
529 add them to the official standard (if they are sane) | 482 add them to the official standard (if they are sane) |
530 Note: nonstandard fields should be prefixed by "X-" | 483 Note: nonstandard fields should be prefixed by "X-" |
531 Note: MUST be less than 64 bytes long | 484 Note: MUST be less than 64 bytes long |
541 {NULL , NULL }, // end | 494 {NULL , NULL }, // end |
542 {NULL , NULL }, | 495 {NULL , NULL }, |
543 {NULL , "UTF8"}, | 496 {NULL , "UTF8"}, |
544 {NULL , "v"}, | 497 {NULL , "v"}, |
545 {NULL , "s"}, | 498 {NULL , "s"}, |
499 {"StreamId" , "v"}, | |
546 {"Author" , "UTF8"}, | 500 {"Author" , "UTF8"}, |
547 {"Titel" , "UTF8"}, | 501 {"Titel" , "UTF8"}, |
502 {"Language" , "UTF8"}, | |
548 {"Description" , "UTF8"}, | 503 {"Description" , "UTF8"}, |
549 {"Copyright" , "UTF8"}, | 504 {"Copyright" , "UTF8"}, |
550 {"Encoder" , "UTF8"}, | 505 {"Encoder" , "UTF8"}, |
551 {"Keyword" , "UTF8"}, | 506 {"Keyword" , "UTF8"}, |
552 {"Cover" , "JPEG"}, | 507 {"Cover" , "JPEG"}, |
553 {"Cover" , "PNG"}, | 508 {"Cover" , "PNG"}, |
554 }; | 509 {"Disposition" , "UTF8"}, |
555 | |
556 meta_table[][2]={ | |
557 {NULL , NULL }, // end | |
558 {NULL , NULL }, | |
559 {NULL , "UTF8"}, | |
560 {NULL , "v"}, | |
561 {NULL , "s"}, | |
562 {"Language" , to be decided}, | |
563 {"Disposition" , to be decided}, | |
564 {"ReplayGain" , to be decided}, | |
565 }; | 510 }; |
566 | 511 |
567 Structure: | 512 Structure: |
568 | 513 |
569 the headers MUST be in exactly the following order (to simplify demuxer design) | 514 the headers MUST be in exactly the following order (to simplify demuxer design) |
594 every sync-point must be exacty once in the index | 539 every sync-point must be exacty once in the index |
595 Note: in case of realtime streaming there is no end, so no index there either | 540 Note: in case of realtime streaming there is no end, so no index there either |
596 | 541 |
597 Info packets | 542 Info packets |
598 the info_packet can be repeated, it can also contain different names & values | 543 the info_packet can be repeated, it can also contain different names & values |
599 each time but only if allso the time is different | 544 each time but only if also the time is different |
600 Info packets can be used to describe the file or some part of it (chapters) | 545 Info packets can be used to describe the file or some part of it (chapters) |
601 | 546 |
602 info packets, SHOULD be placed at the begin of the file at least | 547 info packets, SHOULD be placed at the begin of the file at least |
603 for realtime streaming info packets will normally be transmitted when they apply | 548 for realtime streaming info packets will normally be transmitted when they apply |
604 for example, the current song title & artist of the currently shown music video | 549 for example, the current song title & artist of the currently shown music video |