]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Add key_frame to AVCodecParserContext, used in libavformat.
authorcehoyos <cehoyos@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Wed, 18 Feb 2009 23:46:05 +0000 (23:46 +0000)
committercehoyos <cehoyos@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Wed, 18 Feb 2009 23:46:05 +0000 (23:46 +0000)
Initialized to -1 in parser.c for backward compatibility.

Patch by Ivan Schreter, schreter gmx net

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@17442 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavcodec/avcodec.h
libavcodec/parser.c
libavformat/avformat.h
libavformat/utils.c

index 4dfd6d7ce1f096cd7681d7208475dfc40f8771e5..62e4e474fe6f4eb030ebbdc8181e33d0dd666622 100644 (file)
@@ -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 {
index 6a801ec0da9e653c90f83ff5a1ec1cffe8a951ef..db9b2363fe93c2bf282849fff97551758c2197d2 100644 (file)
@@ -73,6 +73,7 @@ AVCodecParserContext *av_parser_init(int codec_id)
     }
     s->fetch_timestamp=1;
     s->pict_type = FF_I_TYPE;
+    s->key_frame = -1;
     return s;
 }
 
index 3640808765b71ca8cf4ed7b97a148b3e98a8ab49..561e367a315c65942db7cc122331640033ba9157 100644 (file)
@@ -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, \
index d2e141a5af9cb5ed658d8c294436dc2c77c69be1..2d66dced35572701e9965ebd1f5f214d93f3a89f 100644 (file)
@@ -904,8 +904,10 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
     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;
     }
 }