&& track->codec_priv.data != NULL) {
track->video.fourcc = AV_RL32(track->codec_priv.data + 16);
codec_id = ff_codec_get_id(ff_codec_bmp_tags, track->video.fourcc);
+ extradata_offset = 40;
} else if (!strcmp(track->codec_id, "A_MS/ACM")
- && track->codec_priv.size >= 18
+ && track->codec_priv.size >= 14
&& track->codec_priv.data != NULL) {
init_put_byte(&b, track->codec_priv.data, track->codec_priv.size,
URL_RDONLY, NULL, NULL, NULL, NULL);
ff_get_wav_header(&b, st->codec, track->codec_priv.size);
codec_id = st->codec->codec_id;
- extradata_offset = 18;
- track->codec_priv.size -= extradata_offset;
+ extradata_offset = FFMIN(track->codec_priv.size, 18);
} else if (!strcmp(track->codec_id, "V_QUICKTIME")
&& (track->codec_priv.size >= 86)
&& (track->codec_priv.data != NULL)) {
} else if (codec_id == CODEC_ID_RV10 || codec_id == CODEC_ID_RV20 ||
codec_id == CODEC_ID_RV30 || codec_id == CODEC_ID_RV40) {
extradata_offset = 26;
- track->codec_priv.size -= extradata_offset;
} else if (codec_id == CODEC_ID_RA_144) {
track->audio.out_samplerate = 8000;
track->audio.channels = 1;
} else {
st->codec->block_align = track->audio.sub_packet_size;
extradata_offset = 78;
- track->codec_priv.size -= extradata_offset;
}
}
+ track->codec_priv.size -= extradata_offset;
if (codec_id == CODEC_ID_NONE)
av_log(matroska->ctx, AV_LOG_INFO,
av_reduce(&st->codec->time_base.num, &st->codec->time_base.den,
track->default_duration, 1000000000, 30000);
- if(extradata){
- st->codec->extradata = extradata;
- st->codec->extradata_size = extradata_size;
- } else if(track->codec_priv.data && track->codec_priv.size > 0){
- st->codec->extradata = av_mallocz(track->codec_priv.size +
- FF_INPUT_BUFFER_PADDING_SIZE);
- if(st->codec->extradata == NULL)
- return AVERROR(ENOMEM);
- st->codec->extradata_size = track->codec_priv.size;
- memcpy(st->codec->extradata,
- track->codec_priv.data + extradata_offset,
- track->codec_priv.size);
+ if (!st->codec->extradata) {
+ if(extradata){
+ st->codec->extradata = extradata;
+ st->codec->extradata_size = extradata_size;
+ } else if(track->codec_priv.data && track->codec_priv.size > 0){
+ st->codec->extradata = av_mallocz(track->codec_priv.size +
+ FF_INPUT_BUFFER_PADDING_SIZE);
+ if(st->codec->extradata == NULL)
+ return AVERROR(ENOMEM);
+ st->codec->extradata_size = track->codec_priv.size;
+ memcpy(st->codec->extradata,
+ track->codec_priv.data + extradata_offset,
+ track->codec_priv.size);
+ }
}
if (track->type == MATROSKA_TRACK_TYPE_VIDEO) {
st->codec->height * track->video.display_width,
st->codec-> width * track->video.display_height,
255);
+ if (st->codec->codec_id != CODEC_ID_H264)
st->need_parsing = AVSTREAM_PARSE_HEADERS;
} else if (track->type == MATROSKA_TRACK_TYPE_AUDIO) {
st->codec->codec_type = CODEC_TYPE_AUDIO;