From 23584bec87f2cab947e28ba54b0499492d6e5891 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 28 May 2010 18:50:39 +0000 Subject: [PATCH] Parse avctx->extradata if available. Fixes many "non-existing PPS referenced" error messages Originally committed as revision 23363 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/h264.h | 1 + libavcodec/h264_parser.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/libavcodec/h264.h b/libavcodec/h264.h index 2f1dc95..7c76b29 100644 --- a/libavcodec/h264.h +++ b/libavcodec/h264.h @@ -465,6 +465,7 @@ typedef struct H264Context{ int is_avc; ///< this flag is != 0 if codec is avc1 int nal_length_size; ///< Number of bytes used for nal length (1, 2 or 4) + int first_picture; SPS *sps_buffers[MAX_SPS_COUNT]; PPS *pps_buffers[MAX_PPS_COUNT]; diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index 8852950..06271cf 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -245,6 +245,14 @@ static int h264_parse(AVCodecParserContext *s, ParseContext *pc = &h->s.parse_context; int next; + if (h->first_picture) { + h->first_picture = 0; + if (avctx->extradata_size) { + h->s.avctx = avctx; + ff_h264_decode_extradata(h); + } + } + if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){ next= buf_size; }else{ @@ -319,6 +327,7 @@ static int init(AVCodecParserContext *s) { H264Context *h = s->priv_data; h->thread_context[0] = h; + h->first_picture = 1; return 0; } -- 2.7.4