comparison DOCS/tech/mpcf.txt @ 12501:cd0d9a99b730

remove index flag max_short_distance reserved_v -> reserved_count header repeation rules some of this is from rich
author michael
date Tue, 25 May 2004 20:42:22 +0000
parents bfa269cec22b
children 6db7e319aaa0
comparison
equal deleted inserted replaced
12500:a6c9198b538d 12501:cd0d9a99b730
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 global_time_base_nom v 93 global_time_base_nom v
93 global_time_base_denom v 94 global_time_base_denom v
94 short_startcode v 95 short_startcode v
95 for(i=0; i<256; ){ 96 for(i=0; i<256; ){
96 tmp_flag v 97 tmp_flag v
111 flags[i]= tmp_flag; 112 flags[i]= tmp_flag;
112 stream_id_plus1[i]= tmp_stream; 113 stream_id_plus1[i]= tmp_stream;
113 data_size_mul[i]= tmp_mul; 114 data_size_mul[i]= tmp_mul;
114 data_size_lsb[i]= tmp_size + j; 115 data_size_lsb[i]= tmp_size + j;
115 timestamp_delta[i]= tmp_timestamp; 116 timestamp_delta[i]= tmp_timestamp;
116 reserved_v[i]= tmp_res; 117 reserved_count[i]= tmp_res;
117 } 118 }
118 } 119 }
119 reserved_bytes 120 reserved_bytes
120 checksum u(32) 121 checksum u(32)
121 122
130 time_base_nom v 131 time_base_nom v
131 time_base_denom v 132 time_base_denom v
132 msb_timestamp_shift v 133 msb_timestamp_shift v
133 decode_delay v 134 decode_delay v
134 fixed_fps u(1) 135 fixed_fps u(1)
135 index_flag u(1)
136 reserved u(6) 136 reserved u(6)
137 for(;;){ 137 for(;;){
138 codec_specific_data_type v 138 codec_specific_data_type v
139 if(codec_specific_data_type==0) break; 139 if(codec_specific_data_type==0) break;
140 codec_specific_data vb 140 codec_specific_data vb
168 coded_timestamp v 168 coded_timestamp v
169 } 169 }
170 if(flags[frame_code]&1){ 170 if(flags[frame_code]&1){
171 data_size_msb v 171 data_size_msb v
172 } 172 }
173 for(i=0; i<reserved_v[frame_code]; i++) 173 for(i=0; i<reserved_count[frame_code]; i++)
174 reserved v 174 reserved v
175 data 175 data
176 176
177 Index: 177 Index:
178 index_startcode f(64) 178 index_startcode f(64)
179 packet header 179 packet header
180 stream_id v
181 index_length v 180 index_length v
182 for(i=0; i<index_length; i++){ 181 for(i=0; i<index_length; i++){
183 index_timestamp v 182 index_timestamp v
184 index_position v 183 index_position v
185 } 184 }
265 max_distance 264 max_distance
266 max distance of frame_startcodes, the distance may only be larger if 265 max distance of frame_startcodes, the distance may only be larger if
267 there is only a single frame between the 2 frame_startcodes 266 there is only a single frame between the 2 frame_startcodes
268 this can be used by the demuxer to detect damaged frame headers if the 267 this can be used by the demuxer to detect damaged frame headers if the
269 damage results in a too long chain 268 damage results in a too long chain
270 SHOULD be set to <=16384 to ensure reasonable error recovery 269 SHOULD be set to <=32768 or at least <=65536 unless there is a very good
270 reason to set it higher otherwise reasonable error recovery will be
271 impossible
272
273 max_short_distance
274 max distance of short startcodes or frame_startcodes, the distance may
275 only be larger if there is only a single frame between the 2
276 frame_startcodes/short startcodes this can be used by the demuxer to
277 detect damaged frame headers if the damage results in a too long chain
278 SHOULD be set to <=4096 or at least <=8192 unless there is a very good
279 reason to set it higher otherwise reasonable error recovery will be
280 impossible
281
271 282
272 short_startcode 283 short_startcode
273 MUST be 3 bytes long and MUST have 'N' as first byte, the second byte 284 MUST be 3 bytes long and MUST have 'N' as first byte, the second byte
274 MUST not be a printable uppercase letter / must not be within 65..90, 285 MUST not be a printable uppercase letter / must not be within 65..90,
275 default is 0x4EFE79 286 default is 0x4EFE79
276 287
277 stream_id 288 stream_id
278 Note: streams with a lower relative class MUST have a lower relative id 289 Note: streams with a lower relative class MUST have a lower relative id
279 so a stream with class 0 MUST allways have a id which is lower then any 290 so a stream with class 0 MUST allways have a id which is lower then any
280 stream with class > 0 291 stream with class > 0
281 stream_id MUST be < stream_count 292 stream_id MUST be < stream_count
537 ... 548 ...
538 stream_header (id=n) 549 stream_header (id=n)
539 550
540 headers may be repated, but if they are then they MUST all be repeated together 551 headers may be repated, but if they are then they MUST all be repeated together
541 and repeated headers MUST be identical 552 and repeated headers MUST be identical
542 553 headers MAY only repeated at the closest possible positions after 2^x where x is
543 headers MUST be repeated every 10sec at least ? FIXME 554 an integer and the file end, so the headers may be repeated at 4102 if thats the
544 headers MUST be repeated BEFORE keyframes 555 closest possition after 2^12=4096 at which the headers can be placed
556
557 headers MUST be placed at least at the begin of the file and immedeatly before
558 the index or at the file end if there is no index
545 headers MUST be repeated at least twice (so they exist 3 times in a file) 559 headers MUST be repeated at least twice (so they exist 3 times in a file)
560
561 a demuxer MUST not demux a stream which contains more than one stream, or which
562 is wrapped in a structure to facilitate more than one stream or otherwise
563 duplicate the role of a container. any such file is to be considered invalid
546 564
547 Index 565 Index
548 the index can be repeated but there SHOULD be at least one for each stream at 566 the index can be repeated but there SHOULD be at least one for each stream at
549 the end 567 the end
550 Note: in case of realtime streaming there is no end, so no index there either 568 Note: in case of realtime streaming there is no end, so no index there either
558 for realtime streaming info packets will normally be transmitted when they apply 576 for realtime streaming info packets will normally be transmitted when they apply
559 for example, the current song title & artist of the currently shown music video 577 for example, the current song title & artist of the currently shown music video
560 578
561 Unknown packets 579 Unknown packets
562 MUST be ignored by the demuxer 580 MUST be ignored by the demuxer
581
582 demuxer (non-normative)
583
584 in the absence of valid header at beginning, players SHOULD search for backup
585 headers starting at offset 2^x for each x players SHOULD end their search from a
586 particular offset when any startcode is found (including syncpoint)
587
563 588
564 Sample code (GPL, & untested) 589 Sample code (GPL, & untested)
565 590
566 typedef BufferContext{ 591 typedef BufferContext{
567 uint8_t *buf; 592 uint8_t *buf;