comparison DOCS/tech/mpcf.txt @ 17726:541738aa3079

return index_ptr to inside index add max_size disallow reserved headers after index
author ods15
date Sat, 04 Mar 2006 16:30:25 +0000
parents 7337cbf41e2d
children a0d4f253e82b
comparison
equal deleted inserted replaced
17725:d7dd016cb97a 17726:541738aa3079
164 fourcc vb 164 fourcc vb
165 time_base_nom v 165 time_base_nom v
166 time_base_denom v 166 time_base_denom v
167 msb_pts_shift v 167 msb_pts_shift v
168 max_pts_distance v 168 max_pts_distance v
169 max_size v
169 decode_delay v 170 decode_delay v
170 reserved u(7) 171 reserved u(7)
171 fixed_fps u(1) 172 fixed_fps u(1)
172 codec_specific_data vb 173 codec_specific_data vb
173 if(stream_class == video){ 174 if(stream_class == video){
244 keyframe_pts[j][i] = last_pts + A 245 keyframe_pts[j][i] = last_pts + A
245 last_pts += A + B 246 last_pts += A + B
246 } 247 }
247 } 248 }
248 } 249 }
250 last 8 reserved_bytes of index:
251 index_ptr u(64)
249 252
250 info_packet: 253 info_packet:
251 stream_id_plus1 v 254 stream_id_plus1 v
252 chapter_id v 255 chapter_id v
253 chapter_start v 256 chapter_start v
286 289
287 Complete definition: 290 Complete definition:
288 291
289 file: 292 file:
290 file_id_string 293 file_id_string
291 while(bytes_left > 8){ 294 while(!eof){
292 if(next_byte == 'N'){ 295 if(next_byte == 'N'){
293 startcode f(64) 296 startcode f(64)
294 forward_ptr v 297 forward_ptr v
295 switch(startcode){ 298 switch(startcode){
296 case main_startcode: main_header; break; 299 case main_startcode: main_header; break;
302 reserved_bytes 305 reserved_bytes
303 checksum u(32) 306 checksum u(32)
304 }else 307 }else
305 frame 308 frame
306 } 309 }
307 index_ptr u(64)
308 310
309 the structure of a undamaged file should look like the following, but 311 the structure of a undamaged file should look like the following, but
310 demuxers should be flexible and be able to deal with damaged headers so the 312 demuxers should be flexible and be able to deal with damaged headers so the
311 above is a better loop in practice (not to mention its simpler) 313 above is a better loop in practice (not to mention its simpler)
312 note, demuxers MUST be able to deal with new and unknown headers 314 note, demuxers MUST be able to deal with new and unknown headers
329 packet_footer 331 packet_footer
330 } 332 }
331 333
332 file: 334 file:
333 file_id_string 335 file_id_string
334 while(bytes_left > 8){ 336 while(!eof){
335 packet_header, main_header, packet_footer 337 packet_header, main_header, packet_footer
336 reserved_headers 338 reserved_headers
337 for(i=0; i<stream_count; i++){ 339 for(i=0; i<stream_count; i++){
338 packet_header, stream_header, packet_footer 340 packet_header, stream_header, packet_footer
339 reserved_headers 341 reserved_headers
340 } 342 }
341 while(next_code == info_startcode){ 343 while(next_code == info_startcode){
342 packet_header, info_packet, packet_footer 344 packet_header, info_packet, packet_footer
343 reserved_headers 345 reserved_headers
344 } 346 }
345 while(next_code == index_startcode){ 347 if(next_code == index_startcode){
346 packet_header, index_packet, packet_footer 348 packet_header, index_packet, packet_footer
347 reserved_headers
348 } 349 }
349 if (bytes_left > 8) while(next_code != main_startcode){ 350 if (!eof) while(next_code != main_startcode){
350 if(next_code == syncpoint_startcode){ 351 if(next_code == syncpoint_startcode){
351 packet_header, syncpoint, packet_footer 352 packet_header, syncpoint, packet_footer
352 } 353 }
353 frame 354 frame
354 reserved_headers 355 reserved_headers
355 } 356 }
356 } 357 }
357 index_ptr u(64)
358 358
359 359
360 Tag description: 360 Tag description:
361 ---------------- 361 ----------------
362 362
404 max_pts_distance 404 max_pts_distance
405 max absoloute difference of pts of new frame from last_pts in the 405 max absoloute difference of pts of new frame from last_pts in the
406 timebase of the stream, without a checksum after the frameheader 406 timebase of the stream, without a checksum after the frameheader
407 Note that last_pts is not necessarily the pts of the last frame 407 Note that last_pts is not necessarily the pts of the last frame
408 on the same stream, as it is altered by syncpoint timestamps. 408 on the same stream, as it is altered by syncpoint timestamps.
409
410 max_size
411 max frame size without a checksum after the frameheader.
412 MUST be <=4*max_distance. If stored value is bigger than max_size MUST
413 be set to 4*max_distance .
409 414
410 stream_id 415 stream_id
411 Stream identifier 416 Stream identifier
412 stream_id MUST be < stream_count 417 stream_id MUST be < stream_count
413 418
505 EOR frames MUST be zero-length and must be set keyframe. 510 EOR frames MUST be zero-length and must be set keyframe.
506 All streams SHOULD end with EOR, where the pts of the EOR indicates the 511 All streams SHOULD end with EOR, where the pts of the EOR indicates the
507 end presentation time of the final frame. 512 end presentation time of the final frame.
508 An EOR set stream is unset by the first content frames. 513 An EOR set stream is unset by the first content frames.
509 EOR can only be unset in streams with zero decode_delay . 514 EOR can only be unset in streams with zero decode_delay .
510 has_checksum must be set if the frame is larger then 2*max_distance or its 515 FLAG_CHECKSUM must be set if the frame is larger than max_size or its
511 pts differs by more then max_pts_distance from the last frame 516 pts differs by more then max_pts_distance from the last frame
512 517
513 stream_id_plus1[frame_code] 518 stream_id_plus1[frame_code]
514 must be <250 519 must be <250
515 if it is 0, then the stream_id is coded in the frame 520 if it is 0, then the stream_id is coded in the frame
635 eor_pts 640 eor_pts
636 Coded only if EOR is set at the position of the syncpoint. The pts of 641 Coded only if EOR is set at the position of the syncpoint. The pts of
637 that EOR. EOR is unset by the first keyframe after it. 642 that EOR. EOR is unset by the first keyframe after it.
638 643
639 index_ptr 644 index_ptr
640 absolute location in the file of the first byte of the startcode of the 645 Length in bytes of the entire index, from the first byte of the
641 first index packet, or 0 if there is no index 646 startcode until the last byte of the checksum.
647 Note: A demuxer can use this to find the index when it is written at
648 EOF, as index_ptr will always be 12 bytes before the end of file if
649 there is an index at all.
650
642 651
643 Info tags: 652 Info tags:
644 ---------- 653 ----------
645 654
646 stream_id_plus1 655 stream_id_plus1
746 Index: 755 Index:
747 ------ 756 ------
748 757
749 Note: with realtime streaming, there is no end, so no index there either 758 Note: with realtime streaming, there is no end, so no index there either
750 Index MAY only be repeated after main headers. 759 Index MAY only be repeated after main headers.
760 If an index is written anywhere in the file, it MUST be written at end of
761 file as well.
751 762
752 763
753 Info: 764 Info:
754 ----- 765 -----
755 766