Mercurial > libavcodec.hg
comparison mpeg4video_parser.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 | 0d1cc37d9430 |
| children | 04423b2f6e0b |
comparison
equal
deleted
inserted
replaced
| 4956:ea7519d7649f | 4957:3fcb2f0d9ef1 |
|---|---|
| 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 */ | 21 */ |
| 22 | 22 |
| 23 #include "parser.h" | 23 #include "parser.h" |
| 24 #include "mpegvideo.h" | 24 #include "mpegvideo.h" |
| 25 #include "mpeg4video_parser.h" | |
| 25 | 26 |
| 27 | |
| 28 int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){ | |
| 29 int vop_found, i; | |
| 30 uint32_t state; | |
| 31 | |
| 32 vop_found= pc->frame_start_found; | |
| 33 state= pc->state; | |
| 34 | |
| 35 i=0; | |
| 36 if(!vop_found){ | |
| 37 for(i=0; i<buf_size; i++){ | |
| 38 state= (state<<8) | buf[i]; | |
| 39 if(state == 0x1B6){ | |
| 40 i++; | |
| 41 vop_found=1; | |
| 42 break; | |
| 43 } | |
| 44 } | |
| 45 } | |
| 46 | |
| 47 if(vop_found){ | |
| 48 /* EOF considered as end of frame */ | |
| 49 if (buf_size == 0) | |
| 50 return 0; | |
| 51 for(; i<buf_size; i++){ | |
| 52 state= (state<<8) | buf[i]; | |
| 53 if((state&0xFFFFFF00) == 0x100){ | |
| 54 pc->frame_start_found=0; | |
| 55 pc->state=-1; | |
| 56 return i-3; | |
| 57 } | |
| 58 } | |
| 59 } | |
| 60 pc->frame_start_found= vop_found; | |
| 61 pc->state= state; | |
| 62 return END_NOT_FOUND; | |
| 63 } | |
| 26 | 64 |
| 27 /* XXX: make it use less memory */ | 65 /* XXX: make it use less memory */ |
| 28 static int av_mpeg4_decode_header(AVCodecParserContext *s1, | 66 static int av_mpeg4_decode_header(AVCodecParserContext *s1, |
| 29 AVCodecContext *avctx, | 67 AVCodecContext *avctx, |
| 30 const uint8_t *buf, int buf_size) | 68 const uint8_t *buf, int buf_size) |
