[FFmpeg-cvslog] r17442 - in trunk: libavcodec/avcodec.h libavcodec/parser.c libavformat/avformat.h libavformat/utils.c

cehoyos subversion
Thu Feb 19 00:46:06 CET 2009


Author: cehoyos
Date: Thu Feb 19 00:46:05 2009
New Revision: 17442

Log:
Add key_frame to AVCodecParserContext, used in libavformat.
Initialized to -1 in parser.c for backward compatibility.

Patch by Ivan Schreter, schreter gmx net

Modified:
   trunk/libavcodec/avcodec.h
   trunk/libavcodec/parser.c
   trunk/libavformat/avformat.h
   trunk/libavformat/utils.c

Modified: trunk/libavcodec/avcodec.h
==============================================================================
--- trunk/libavcodec/avcodec.h	Thu Feb 19 00:33:30 2009	(r17441)
+++ trunk/libavcodec/avcodec.h	Thu Feb 19 00:46:05 2009	(r17442)
@@ -30,7 +30,7 @@
 #include "libavutil/avutil.h"
 
 #define LIBAVCODEC_VERSION_MAJOR 52
-#define LIBAVCODEC_VERSION_MINOR 15
+#define LIBAVCODEC_VERSION_MINOR 16
 #define LIBAVCODEC_VERSION_MICRO  0
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
@@ -3025,6 +3025,14 @@ typedef struct AVCodecParserContext {
 
     int64_t offset;      ///< byte offset from starting packet start
     int64_t cur_frame_end[AV_PARSER_PTS_NB];
+
+    /*!
+     * Set by parser to 1 for key frames and 0 for non-key frames.
+     * It is initialized to -1, so if the parser doesn't set this flag,
+     * old-style fallback using FF_I_TYPE picture type as key frames
+     * will be used.
+     */
+    int key_frame;
 } AVCodecParserContext;
 
 typedef struct AVCodecParser {

Modified: trunk/libavcodec/parser.c
==============================================================================
--- trunk/libavcodec/parser.c	Thu Feb 19 00:33:30 2009	(r17441)
+++ trunk/libavcodec/parser.c	Thu Feb 19 00:46:05 2009	(r17442)
@@ -73,6 +73,7 @@ AVCodecParserContext *av_parser_init(int
     }
     s->fetch_timestamp=1;
     s->pict_type = FF_I_TYPE;
+    s->key_frame = -1;
     return s;
 }
 

Modified: trunk/libavformat/avformat.h
==============================================================================
--- trunk/libavformat/avformat.h	Thu Feb 19 00:33:30 2009	(r17441)
+++ trunk/libavformat/avformat.h	Thu Feb 19 00:46:05 2009	(r17442)
@@ -23,7 +23,7 @@
 
 #define LIBAVFORMAT_VERSION_MAJOR 52
 #define LIBAVFORMAT_VERSION_MINOR 29
-#define LIBAVFORMAT_VERSION_MICRO  0
+#define LIBAVFORMAT_VERSION_MICRO  1
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	Thu Feb 19 00:33:30 2009	(r17441)
+++ trunk/libavformat/utils.c	Thu Feb 19 00:46:05 2009	(r17442)
@@ -904,8 +904,10 @@ static void compute_pkt_fields(AVFormatC
     else if (pc) {
         pkt->flags = 0;
         /* keyframe computation */
-            if (pc->pict_type == FF_I_TYPE)
-                pkt->flags |= PKT_FLAG_KEY;
+        if (pc->key_frame == 1)
+            pkt->flags |= PKT_FLAG_KEY;
+        else if (pc->key_frame == -1 && pc->pict_type == FF_I_TYPE)
+            pkt->flags |= PKT_FLAG_KEY;
     }
 }
 




More information about the ffmpeg-cvslog mailing list