Mercurial > libavcodec.hg
comparison mpeg12.c @ 1289:57172377849a libavcodec
fix mpeg1/2 decoding if there are no 0 bytes after the bitstream
print mpeg1/2 startcodes support
author | michaelni |
---|---|
date | Fri, 30 May 2003 00:02:25 +0000 |
parents | 6e039762d5cb |
children | fc858abf6b10 |
comparison
equal
deleted
inserted
replaced
1288:10c21dffe5ab | 1289:57172377849a |
---|---|
1932 } | 1932 } |
1933 } | 1933 } |
1934 | 1934 |
1935 s->mb_x = 0; | 1935 s->mb_x = 0; |
1936 s->mb_y++; | 1936 s->mb_y++; |
1937 | |
1938 if(s->mb_y<<field_pic >= s->mb_height){ | |
1939 int left= s->gb.size_in_bits - get_bits_count(&s->gb); | |
1940 | |
1941 if(left < 0 || (left && show_bits(&s->gb, FFMIN(left, 23))) | |
1942 || (avctx->error_resilience >= FF_ER_AGGRESSIVE && left>8)){ | |
1943 fprintf(stderr, "end missmatch left=%d\n", left); | |
1944 return -1; | |
1945 }else | |
1946 goto eos; | |
1947 } | |
1937 } | 1948 } |
1938 | 1949 |
1939 /* skip mb handling */ | 1950 /* skip mb handling */ |
1940 if (s->mb_skip_run == -1) { | 1951 if (s->mb_skip_run == -1) { |
1941 /* read again increment */ | 1952 /* read again increment */ |
1961 s->mb_skip_run += code; | 1972 s->mb_skip_run += code; |
1962 break; | 1973 break; |
1963 } | 1974 } |
1964 } | 1975 } |
1965 } | 1976 } |
1966 if(s->mb_y<<field_pic >= s->mb_height){ | |
1967 fprintf(stderr, "slice too long\n"); | |
1968 return -1; | |
1969 } | |
1970 } | 1977 } |
1971 eos: // end of slice | 1978 eos: // end of slice |
1972 *buf += get_bits_count(&s->gb)/8 - 1; | 1979 *buf += get_bits_count(&s->gb)/8 - 1; |
1973 //printf("y %d %d %d %d\n", s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y); | 1980 //printf("y %d %d %d %d\n", s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y); |
1974 return 0; | 1981 return 0; |
2246 if(s2->last_picture_ptr) //FIXME merge with the stuff in mpeg_decode_slice | 2253 if(s2->last_picture_ptr) //FIXME merge with the stuff in mpeg_decode_slice |
2247 *data_size = sizeof(AVPicture); | 2254 *data_size = sizeof(AVPicture); |
2248 } | 2255 } |
2249 return FFMAX(0, buf_ptr - buf - s2->parse_context.last_index); | 2256 return FFMAX(0, buf_ptr - buf - s2->parse_context.last_index); |
2250 } | 2257 } |
2258 | |
2259 input_size = buf_end - buf_ptr; | |
2260 | |
2261 if(avctx->debug & FF_DEBUG_STARTCODE){ | |
2262 printf("%3X at %d left %d\n", start_code, buf_ptr-buf, input_size); | |
2263 } | |
2251 | 2264 |
2252 /* prepare data for next start code */ | 2265 /* prepare data for next start code */ |
2253 input_size = buf_end - buf_ptr; | |
2254 switch(start_code) { | 2266 switch(start_code) { |
2255 case SEQ_START_CODE: | 2267 case SEQ_START_CODE: |
2256 mpeg1_decode_sequence(avctx, buf_ptr, | 2268 mpeg1_decode_sequence(avctx, buf_ptr, |
2257 input_size); | 2269 input_size); |
2258 break; | 2270 break; |