summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg12.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-04-29 14:21:33 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-04-29 14:21:33 +0000
commite4cb187db8f96634f2306538e134d40f2793e376 (patch)
tree7b8617c0ac55f1f437f65715a41dda57f56e3645 /libavcodec/mpeg12.c
parent20da31792b1988d2f21f4c14548333405cd9c37d (diff)
remove duplicated find_frame_end() code
move codec specific code from parser.c -> <codecname>.c as far as its easily possible Originally committed as revision 3087 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpeg12.c')
-rw-r--r--libavcodec/mpeg12.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index a85a15d2dc..d2500f393d 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -2715,8 +2715,8 @@ static void mpeg_decode_gop(AVCodecContext *avctx,
* finds the end of the current frame in the bitstream.
* @return the position of the first byte of the next frame, or -1
*/
-static int mpeg1_find_frame_end(MpegEncContext *s, uint8_t *buf, int buf_size){
- ParseContext *pc= &s->parse_context;
+int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
+{
int i;
uint32_t state;
@@ -2735,6 +2735,9 @@ static int mpeg1_find_frame_end(MpegEncContext *s, uint8_t *buf, int buf_size){
}
if(pc->frame_start_found){
+ /* EOF considered as end of frame */
+ if (buf_size == 0)
+ return 0;
for(; i<buf_size; i++){
state= (state<<8) | buf[i];
if((state&0xFFFFFF00) == 0x100){
@@ -2775,9 +2778,9 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
}
if(s2->flags&CODEC_FLAG_TRUNCATED){
- int next= mpeg1_find_frame_end(s2, buf, buf_size);
+ int next= ff_mpeg1_find_frame_end(&s2->parse_context, buf, buf_size);
- if( ff_combine_frame(s2, next, &buf, &buf_size) < 0 )
+ if( ff_combine_frame(&s2->parse_context, next, &buf, &buf_size) < 0 )
return buf_size;
}