Commit 2c33bb98 authored by alexc's avatar alexc

Add an AVSTREAM_PARSE_FULL_ONCE parsing mode to parse headers and combine...

Add an AVSTREAM_PARSE_FULL_ONCE parsing mode to parse headers and combine packets once and only once.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23332 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent f3f30102
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "libavutil/avutil.h" #include "libavutil/avutil.h"
#define LIBAVCODEC_VERSION_MAJOR 52 #define LIBAVCODEC_VERSION_MAJOR 52
#define LIBAVCODEC_VERSION_MINOR 69 #define LIBAVCODEC_VERSION_MINOR 70
#define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
...@@ -3649,6 +3649,7 @@ typedef struct AVCodecParserContext { ...@@ -3649,6 +3649,7 @@ typedef struct AVCodecParserContext {
int flags; int flags;
#define PARSER_FLAG_COMPLETE_FRAMES 0x0001 #define PARSER_FLAG_COMPLETE_FRAMES 0x0001
#define PARSER_FLAG_ONCE 0x0002
int64_t offset; ///< byte offset from starting packet start int64_t offset; ///< byte offset from starting packet start
int64_t cur_frame_end[AV_PARSER_PTS_NB]; int64_t cur_frame_end[AV_PARSER_PTS_NB];
......
...@@ -272,6 +272,9 @@ static int h264_parse(AVCodecParserContext *s, ...@@ -272,6 +272,9 @@ static int h264_parse(AVCodecParserContext *s,
s->dts_ref_dts_delta = INT_MIN; s->dts_ref_dts_delta = INT_MIN;
s->pts_dts_delta = INT_MIN; s->pts_dts_delta = INT_MIN;
} }
if (s->flags & PARSER_FLAG_ONCE) {
s->flags &= PARSER_FLAG_COMPLETE_FRAMES;
}
} }
*poutbuf = buf; *poutbuf = buf;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#define AVFORMAT_AVFORMAT_H #define AVFORMAT_AVFORMAT_H
#define LIBAVFORMAT_VERSION_MAJOR 52 #define LIBAVFORMAT_VERSION_MAJOR 52
#define LIBAVFORMAT_VERSION_MINOR 65 #define LIBAVFORMAT_VERSION_MINOR 66
#define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_MICRO 0
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
...@@ -377,6 +377,7 @@ enum AVStreamParseType { ...@@ -377,6 +377,7 @@ enum AVStreamParseType {
AVSTREAM_PARSE_FULL, /**< full parsing and repack */ AVSTREAM_PARSE_FULL, /**< full parsing and repack */
AVSTREAM_PARSE_HEADERS, /**< Only parse headers, do not repack. */ 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_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 */
}; };
typedef struct AVIndexEntry { typedef struct AVIndexEntry {
......
...@@ -1117,6 +1117,8 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt) ...@@ -1117,6 +1117,8 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
st->need_parsing = AVSTREAM_PARSE_NONE; st->need_parsing = AVSTREAM_PARSE_NONE;
}else if(st->need_parsing == AVSTREAM_PARSE_HEADERS){ }else if(st->need_parsing == AVSTREAM_PARSE_HEADERS){
st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES; st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
}else if(st->need_parsing == AVSTREAM_PARSE_FULL_ONCE){
st->parser->flags |= PARSER_FLAG_ONCE;
} }
if(st->parser && (s->iformat->flags & AVFMT_GENERIC_INDEX)){ if(st->parser && (s->iformat->flags & AVFMT_GENERIC_INDEX)){
st->parser->next_frame_offset= st->parser->next_frame_offset=
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment