[FFmpeg-devel] [PATCH 3/4] avformat: add needs_parsing type to enable codec TS use.

Michael Niedermayer michaelni at gmx.at
Mon May 21 14:55:13 CEST 2012


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavformat/avformat.h |    1 +
 libavformat/utils.c    |   10 ++++++++--
 libavformat/version.h  |    4 ++--
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 8198793..c1d720e 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -567,6 +567,7 @@ enum AVStreamParseType {
     AVSTREAM_PARSE_HEADERS,    /**< Only parse headers, do not repack. */
     AVSTREAM_PARSE_TIMESTAMPS, /**< full parsing and interpolation of timestamps for frames not starting on a packet boundary */
     AVSTREAM_PARSE_FULL_ONCE,  /**< full parsing and repack of the first frame only, only implemented for H.264 currently */
+    AVSTREAM_PARSE_FULL_RAW=MKTAG(0,'R','A','W'),       /**< full parsing and repack with timestamp generation for raw */
 };
 
 typedef struct AVIndexEntry {
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 8e4d6fc..c1751a8 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1316,6 +1316,8 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
                 st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
             } else if(st->need_parsing == AVSTREAM_PARSE_FULL_ONCE) {
                 st->parser->flags |= PARSER_FLAG_ONCE;
+            } else if(st->need_parsing == AVSTREAM_PARSE_FULL_RAW) {
+                st->parser->flags |= PARSER_FLAG_USE_CODEC_TS;
             }
         }
 
@@ -2456,8 +2458,12 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
         //only for the split stuff
         if (!st->parser && !(ic->flags & AVFMT_FLAG_NOPARSE)) {
             st->parser = av_parser_init(st->codec->codec_id);
-            if(st->need_parsing == AVSTREAM_PARSE_HEADERS && st->parser){
-                st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
+            if(st->parser){
+                if(st->need_parsing == AVSTREAM_PARSE_HEADERS){
+                    st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
+                } else if(st->need_parsing == AVSTREAM_PARSE_FULL_RAW) {
+                    st->parser->flags |= PARSER_FLAG_USE_CODEC_TS;
+                }
             }
         }
         codec = st->codec->codec ? st->codec->codec :
diff --git a/libavformat/version.h b/libavformat/version.h
index afc235c..1158fdf 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -30,8 +30,8 @@
 #include "libavutil/avutil.h"
 
 #define LIBAVFORMAT_VERSION_MAJOR 54
-#define LIBAVFORMAT_VERSION_MINOR  5
-#define LIBAVFORMAT_VERSION_MICRO 101
+#define LIBAVFORMAT_VERSION_MINOR  6
+#define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list