default:
return vcodec->codec_tag == flv_codecid;
}
-
- return 0;
}
- 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;
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);
++ 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;
flv_set_audio_codec(s, st, &ctx, flags & FLV_AUDIO_CODECID_MASK);
sample_rate = ctx.sample_rate;
}
- }else{
+ } 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 ||