diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-03-02 14:27:58 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-03-02 14:27:58 +0400 |
commit | 973dc110ba0ace5ecc57a01b3f6a44d58cd8079c (patch) | |
tree | 78f3d550ebf1438cef260a321f5d9fb35576a46b /libavformat/flvdec.c | |
parent | 3827734591d8e4a9948f3e57c53e59a549193b9e (diff) | |
parent | c91c63b5380bf79655c09320774a022f84d76fd5 (diff) |
Merge commit 'c91c63b5380bf79655c09320774a022f84d76fd5'
* commit 'c91c63b5380bf79655c09320774a022f84d76fd5':
flvdec: Don't read the VP6 header byte when setting codec type based on metadata
Conflicts:
libavformat/flvdec.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/flvdec.c')
-rw-r--r-- | libavformat/flvdec.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index b57929eda1..482e876d6e 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -199,7 +199,7 @@ static int flv_same_video_codec(AVCodecContext *vcodec, int flags) } } -static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_codecid) { +static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_codecid, int read) { AVCodecContext *vcodec = vstream->codec; switch(flv_codecid) { case FLV_CODECID_H263 : vcodec->codec_id = AV_CODEC_ID_FLV1 ; break; @@ -210,11 +210,13 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co case FLV_CODECID_VP6A : if(flv_codecid == FLV_CODECID_VP6A) vcodec->codec_id = AV_CODEC_ID_VP6A; - if(vcodec->extradata_size != 1) { - vcodec->extradata_size = 1; - vcodec->extradata = av_malloc(1 + FF_INPUT_BUFFER_PADDING_SIZE); + if (read) { + if (vcodec->extradata_size != 1) { + vcodec->extradata_size = 1; + vcodec->extradata = av_malloc(1 + FF_INPUT_BUFFER_PADDING_SIZE); + } + vcodec->extradata[0] = avio_r8(s->pb); } - vcodec->extradata[0] = avio_r8(s->pb); return 1; // 1 byte body size adjustment for flv_read_packet() case FLV_CODECID_H264: vcodec->codec_id = AV_CODEC_ID_H264; @@ -406,7 +408,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst st->codec->codec_id = AV_CODEC_ID_TEXT; } else if (flv->trust_metadata) { if (!strcmp(key, "videocodecid") && vcodec) { - flv_set_video_codec(s, vstream, num_val); + flv_set_video_codec(s, vstream, num_val, 0); } else if (!strcmp(key, "audiocodecid") && acodec) { flv_set_audio_codec(s, astream, acodec, num_val); @@ -795,7 +797,7 @@ retry_duration: sample_rate = ctx.sample_rate; } } else if(stream_type == FLV_STREAM_TYPE_VIDEO) { - size -= flv_set_video_codec(s, st, flags & FLV_VIDEO_CODECID_MASK); + size -= flv_set_video_codec(s, st, flags & FLV_VIDEO_CODECID_MASK, 1); } if (st->codec->codec_id == AV_CODEC_ID_AAC || |