comparison mpegvideo_parser.c @ 6994:5a5ded44808a libavcodec

In mpeg1/2 timestamps are associated with the access unit which contains the first picture startcode that commences in the PES packet, instead of the first access unit that commences in the PES packet. Fix the parser to handle that properly. This was a very long standing bug ... The change to the seek regressions is because the mpeg ts muxer stores too many invalid and randomized timestamps which overflow the 4 entry buffer we use in the parser.
author michael
date Tue, 03 Jun 2008 02:43:17 +0000
parents cb31fe7bd914
children 04423b2f6e0b
comparison
equal deleted inserted replaced
6993:91a3324f4abc 6994:5a5ded44808a
27 AVCodecContext *avctx, 27 AVCodecContext *avctx,
28 const uint8_t *buf, int buf_size) 28 const uint8_t *buf, int buf_size)
29 { 29 {
30 ParseContext1 *pc = s->priv_data; 30 ParseContext1 *pc = s->priv_data;
31 const uint8_t *buf_end; 31 const uint8_t *buf_end;
32 const uint8_t *buf_start= buf;
32 uint32_t start_code; 33 uint32_t start_code;
33 int frame_rate_index, ext_type, bytes_left; 34 int frame_rate_index, ext_type, bytes_left;
34 int frame_rate_ext_n, frame_rate_ext_d; 35 int frame_rate_ext_n, frame_rate_ext_d;
35 int picture_structure, top_field_first, repeat_first_field, progressive_frame; 36 int picture_structure, top_field_first, repeat_first_field, progressive_frame;
36 int horiz_size_ext, vert_size_ext, bit_rate_ext; 37 int horiz_size_ext, vert_size_ext, bit_rate_ext;
41 start_code= -1; 42 start_code= -1;
42 buf= ff_find_start_code(buf, buf_end, &start_code); 43 buf= ff_find_start_code(buf, buf_end, &start_code);
43 bytes_left = buf_end - buf; 44 bytes_left = buf_end - buf;
44 switch(start_code) { 45 switch(start_code) {
45 case PICTURE_START_CODE: 46 case PICTURE_START_CODE:
47 ff_fetch_timestamp(s, buf-buf_start-4, 1);
48
46 if (bytes_left >= 2) { 49 if (bytes_left >= 2) {
47 s->pict_type = (buf[1] >> 3) & 7; 50 s->pict_type = (buf[1] >> 3) & 7;
48 } 51 }
49 break; 52 break;
50 case SEQ_START_CODE: 53 case SEQ_START_CODE: