comparison h263dec.c @ 4957:3fcb2f0d9ef1 libavcodec

move ff_mpeg4_find_frame_end() from h263dec.c to mpeg4video_parser.c now h263dec depends on mpeg4video_parser this fixes compilation when h263 decoder is disabled
author aurel
date Wed, 09 May 2007 23:13:43 +0000
parents ee6c1ce06470
children 6d45158e0249
comparison
equal deleted inserted replaced
4956:ea7519d7649f 4957:3fcb2f0d9ef1
27 27
28 #include "avcodec.h" 28 #include "avcodec.h"
29 #include "dsputil.h" 29 #include "dsputil.h"
30 #include "mpegvideo.h" 30 #include "mpegvideo.h"
31 #include "h263_parser.h" 31 #include "h263_parser.h"
32 #include "mpeg4video_parser.h"
32 33
33 //#define DEBUG 34 //#define DEBUG
34 //#define PRINT_FRAME_TIME 35 //#define PRINT_FRAME_TIME
35 36
36 int ff_h263_decode_init(AVCodecContext *avctx) 37 int ff_h263_decode_init(AVCodecContext *avctx)
316 ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)&part_mask); 317 ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
317 318
318 return -1; 319 return -1;
319 } 320 }
320 321
321 /**
322 * finds the end of the current frame in the bitstream.
323 * @return the position of the first byte of the next frame, or -1
324 */
325 int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){
326 int vop_found, i;
327 uint32_t state;
328
329 vop_found= pc->frame_start_found;
330 state= pc->state;
331
332 i=0;
333 if(!vop_found){
334 for(i=0; i<buf_size; i++){
335 state= (state<<8) | buf[i];
336 if(state == 0x1B6){
337 i++;
338 vop_found=1;
339 break;
340 }
341 }
342 }
343
344 if(vop_found){
345 /* EOF considered as end of frame */
346 if (buf_size == 0)
347 return 0;
348 for(; i<buf_size; i++){
349 state= (state<<8) | buf[i];
350 if((state&0xFFFFFF00) == 0x100){
351 pc->frame_start_found=0;
352 pc->state=-1;
353 return i-3;
354 }
355 }
356 }
357 pc->frame_start_found= vop_found;
358 pc->state= state;
359 return END_NOT_FOUND;
360 }
361
362 int ff_h263_decode_frame(AVCodecContext *avctx, 322 int ff_h263_decode_frame(AVCodecContext *avctx,
363 void *data, int *data_size, 323 void *data, int *data_size,
364 uint8_t *buf, int buf_size) 324 uint8_t *buf, int buf_size)
365 { 325 {
366 MpegEncContext *s = avctx->priv_data; 326 MpegEncContext *s = avctx->priv_data;