[FFmpeg-cvslog] r8962 - in trunk: configure libavcodec/h263dec.c libavcodec/mpeg4video_parser.c libavcodec/mpeg4video_parser.h libavcodec/parser.h

aurel subversion
Thu May 10 01:13:43 CEST 2007


Author: aurel
Date: Thu May 10 01:13:43 2007
New Revision: 8962

Log:
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


Added:
   trunk/libavcodec/mpeg4video_parser.h
      - copied, changed from r8949, /trunk/libavcodec/parser.h
Modified:
   trunk/configure
   trunk/libavcodec/h263dec.c
   trunk/libavcodec/mpeg4video_parser.c
   trunk/libavcodec/parser.h

Modified: trunk/configure
==============================================================================
--- trunk/configure	(original)
+++ trunk/configure	Thu May 10 01:13:43 2007
@@ -677,7 +677,7 @@ dxa_decoder_deps="zlib"
 flashsv_decoder_deps="zlib"
 flashsv_encoder_deps="zlib"
 flv_decoder_deps="h263_decoder"
-h263_decoder_deps="h263_parser"
+h263_decoder_deps="h263_parser mpeg4video_parser"
 h263i_decoder_deps="h263_decoder"
 mpeg_xvmc_decoder_deps="xvmc"
 mpeg4_decoder_deps="h263_decoder"

Modified: trunk/libavcodec/h263dec.c
==============================================================================
--- trunk/libavcodec/h263dec.c	(original)
+++ trunk/libavcodec/h263dec.c	Thu May 10 01:13:43 2007
@@ -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 @@ static int decode_slice(MpegEncContext *
     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)

Modified: trunk/libavcodec/mpeg4video_parser.c
==============================================================================
--- trunk/libavcodec/mpeg4video_parser.c	(original)
+++ trunk/libavcodec/mpeg4video_parser.c	Thu May 10 01:13:43 2007
@@ -22,7 +22,45 @@
 
 #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,

Copied: trunk/libavcodec/mpeg4video_parser.h (from r8949, /trunk/libavcodec/parser.h)
==============================================================================
--- /trunk/libavcodec/parser.h	(original)
+++ trunk/libavcodec/mpeg4video_parser.h	Thu May 10 01:13:43 2007
@@ -1,5 +1,5 @@
 /*
- * AVCodecParser prototypes and definitions
+ * MPEG4 video parser prototypes
  * Copyright (c) 2003 Fabrice Bellard.
  * Copyright (c) 2003 Michael Niedermayer.
  *
@@ -20,46 +20,15 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#ifndef FFMPEG_PARSER_H
-#define FFMPEG_PARSER_H
-
-#include "avcodec.h"
-
-typedef struct ParseContext{
-    uint8_t *buffer;
-    int index;
-    int last_index;
-    unsigned int buffer_size;
-    uint32_t state;             ///< contains the last few bytes in MSB order
-    int frame_start_found;
-    int overread;               ///< the number of bytes which where irreversibly read from the next frame
-    int overread_index;         ///< the index into ParseContext.buffer of the overread bytes
-} ParseContext;
-
-struct MpegEncContext;
-
-typedef struct ParseContext1{
-    ParseContext pc;
-/* XXX/FIXME PC1 vs. PC */
-    /* MPEG2 specific */
-    AVRational frame_rate;
-    int progressive_sequence;
-    int width, height;
-
-    /* XXX: suppress that, needed by MPEG4 */
-    struct MpegEncContext *enc;
-    int first_picture;
-} ParseContext1;
-
-#define END_NOT_FOUND (-100)
+#ifndef MPEG4VIDEO_PARSER_H
+#define MPEG4VIDEO_PARSER_H
 
-int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size);
-int ff_mpeg4video_split(AVCodecContext *avctx, const uint8_t *buf,
-                        int buf_size);
-void ff_parse_close(AVCodecParserContext *s);
-void ff_parse1_close(AVCodecParserContext *s);
+#include "parser.h"
 
-/* h263dec.c */
+/**
+ * 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 /* !FFMPEG_PARSER_H */
+#endif /* MPEG4VIDEO_PARSER_H */

Modified: trunk/libavcodec/parser.h
==============================================================================
--- trunk/libavcodec/parser.h	(original)
+++ trunk/libavcodec/parser.h	Thu May 10 01:13:43 2007
@@ -59,7 +59,4 @@ int ff_mpeg4video_split(AVCodecContext *
 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 */




More information about the ffmpeg-cvslog mailing list