Mercurial > libavcodec.hg
comparison mpeg12.c @ 1218:358bbc952e27 libavcodec
10l (returning negative number of consumed bytes if the first startcode of a frame was split between 2 buffers)
author | michaelni |
---|---|
date | Sun, 27 Apr 2003 01:11:26 +0000 |
parents | 126f766bc4c5 |
children | 78a51075aacb |
comparison
equal
deleted
inserted
replaced
1217:eb2affe57a2a | 1218:358bbc952e27 |
---|---|
2188 } | 2188 } |
2189 } | 2189 } |
2190 } | 2190 } |
2191 } | 2191 } |
2192 pc->state= state; | 2192 pc->state= state; |
2193 return -1; | 2193 return END_NOT_FOUND; |
2194 } | 2194 } |
2195 | 2195 |
2196 /* handle buffering and image synchronisation */ | 2196 /* handle buffering and image synchronisation */ |
2197 static int mpeg_decode_frame(AVCodecContext *avctx, | 2197 static int mpeg_decode_frame(AVCodecContext *avctx, |
2198 void *data, int *data_size, | 2198 void *data, int *data_size, |
2216 } | 2216 } |
2217 return 0; | 2217 return 0; |
2218 } | 2218 } |
2219 | 2219 |
2220 if(s2->flags&CODEC_FLAG_TRUNCATED){ | 2220 if(s2->flags&CODEC_FLAG_TRUNCATED){ |
2221 int next; | 2221 int next= mpeg1_find_frame_end(s2, buf, buf_size); |
2222 | |
2223 next= mpeg1_find_frame_end(s2, buf, buf_size); | |
2224 | 2222 |
2225 if( ff_combine_frame(s2, next, &buf, &buf_size) < 0 ) | 2223 if( ff_combine_frame(s2, next, &buf, &buf_size) < 0 ) |
2226 return buf_size; | 2224 return buf_size; |
2227 } | 2225 } |
2228 | 2226 |
2286 start_code, &buf_ptr, input_size); | 2284 start_code, &buf_ptr, input_size); |
2287 | 2285 |
2288 if (ret == DECODE_SLICE_EOP) { | 2286 if (ret == DECODE_SLICE_EOP) { |
2289 if(s2->last_picture_ptr) //FIXME merge with the stuff in mpeg_decode_slice | 2287 if(s2->last_picture_ptr) //FIXME merge with the stuff in mpeg_decode_slice |
2290 *data_size = sizeof(AVPicture); | 2288 *data_size = sizeof(AVPicture); |
2291 return FFMAX(1, buf_ptr - buf - s2->parse_context.last_index); | 2289 return FFMAX(0, buf_ptr - buf - s2->parse_context.last_index); |
2292 }else if(ret < 0){ | 2290 }else if(ret < 0){ |
2293 if(ret == DECODE_SLICE_ERROR) | 2291 if(ret == DECODE_SLICE_ERROR) |
2294 ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x, s2->mb_y, AC_ERROR|DC_ERROR|MV_ERROR); | 2292 ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x, s2->mb_y, AC_ERROR|DC_ERROR|MV_ERROR); |
2295 | 2293 |
2296 fprintf(stderr,"Error while decoding slice\n"); | 2294 fprintf(stderr,"Error while decoding slice\n"); |