changeset 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 ea7519d7649f
children 842b30b88d9a
files h263dec.c mpeg4video_parser.c mpeg4video_parser.h parser.h
diffstat 4 files changed, 73 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/h263dec.c	Wed May 09 23:08:01 2007 +0000
+++ b/h263dec.c	Wed May 09 23:13:43 2007 +0000
@@ -29,6 +29,7 @@
 #include "dsputil.h"
 #include "mpegvideo.h"
 #include "h263_parser.h"
+#include "mpeg4video_parser.h"
 
 //#define DEBUG
 //#define PRINT_FRAME_TIME
@@ -318,47 +319,6 @@
     return -1;
 }
 
-/**
- * finds the end of the current frame in the bitstream.
- * @return the position of the first byte of the next frame, or -1
- */
-int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){
-    int vop_found, i;
-    uint32_t state;
-
-    vop_found= pc->frame_start_found;
-    state= pc->state;
-
-    i=0;
-    if(!vop_found){
-        for(i=0; i<buf_size; i++){
-            state= (state<<8) | buf[i];
-            if(state == 0x1B6){
-                i++;
-                vop_found=1;
-                break;
-            }
-        }
-    }
-
-    if(vop_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){
-                pc->frame_start_found=0;
-                pc->state=-1;
-                return i-3;
-            }
-        }
-    }
-    pc->frame_start_found= vop_found;
-    pc->state= state;
-    return END_NOT_FOUND;
-}
-
 int ff_h263_decode_frame(AVCodecContext *avctx,
                              void *data, int *data_size,
                              uint8_t *buf, int buf_size)
--- a/mpeg4video_parser.c	Wed May 09 23:08:01 2007 +0000
+++ b/mpeg4video_parser.c	Wed May 09 23:13:43 2007 +0000
@@ -22,8 +22,46 @@
 
 #include "parser.h"
 #include "mpegvideo.h"
+#include "mpeg4video_parser.h"
 
 
+int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){
+    int vop_found, i;
+    uint32_t state;
+
+    vop_found= pc->frame_start_found;
+    state= pc->state;
+
+    i=0;
+    if(!vop_found){
+        for(i=0; i<buf_size; i++){
+            state= (state<<8) | buf[i];
+            if(state == 0x1B6){
+                i++;
+                vop_found=1;
+                break;
+            }
+        }
+    }
+
+    if(vop_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){
+                pc->frame_start_found=0;
+                pc->state=-1;
+                return i-3;
+            }
+        }
+    }
+    pc->frame_start_found= vop_found;
+    pc->state= state;
+    return END_NOT_FOUND;
+}
+
 /* XXX: make it use less memory */
 static int av_mpeg4_decode_header(AVCodecParserContext *s1,
                                   AVCodecContext *avctx,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpeg4video_parser.h	Wed May 09 23:13:43 2007 +0000
@@ -0,0 +1,34 @@
+/*
+ * MPEG4 video parser prototypes
+ * Copyright (c) 2003 Fabrice Bellard.
+ * Copyright (c) 2003 Michael Niedermayer.
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef MPEG4VIDEO_PARSER_H
+#define MPEG4VIDEO_PARSER_H
+
+#include "parser.h"
+
+/**
+ * finds the end of the current frame in the bitstream.
+ * @return the position of the first byte of the next frame, or -1
+ */
+int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size);
+
+#endif /* MPEG4VIDEO_PARSER_H */
--- a/parser.h	Wed May 09 23:08:01 2007 +0000
+++ b/parser.h	Wed May 09 23:13:43 2007 +0000
@@ -59,7 +59,4 @@
 void ff_parse_close(AVCodecParserContext *s);
 void ff_parse1_close(AVCodecParserContext *s);
 
-/* h263dec.c */
-int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size);
-
 #endif /* !FFMPEG_PARSER_H */