X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fmov.c;h=5464b783d37f852f09779f4b284e876b736fb50e;hb=ac1d489320f476c18d6a8125f73389aecb73f3d3;hp=f26162da4f1d20791f57b81680d76330dc485ec4;hpb=f93f6963babf08a7bcf85b9a57f37266dc0a4ae0;p=ffmpeg diff --git a/libavformat/mov.c b/libavformat/mov.c index f26162da4f1..5464b783d37 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -456,7 +456,7 @@ static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, MOVAtom atom) st->codec->codec_type = AVMEDIA_TYPE_AUDIO; else if(type == MKTAG('m','1','a',' ')) st->codec->codec_id = CODEC_ID_MP2; - else if(type == MKTAG('s','u','b','p')) + else if((type == MKTAG('s','u','b','p')) || (type == MKTAG('c','l','c','p'))) st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; avio_rb32(pb); /* component manufacture */ @@ -478,8 +478,7 @@ int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb, MOVAtom atom) avio_rb32(pb); /* version + flags */ ff_mp4_read_descr(fc, pb, &tag); if (tag == MP4ESDescrTag) { - avio_rb16(pb); /* ID */ - avio_r8(pb); /* priority */ + ff_mp4_parse_es_descr(pb, NULL); } else avio_rb16(pb); /* ID */ @@ -1194,7 +1193,18 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) st->codec->width = sc->width; st->codec->height = sc->height; } else { - /* other codec type, just skip (rtp, mp4s, tmcd ...) */ + if (st->codec->codec_tag == MKTAG('t','m','c','d')) { + int val; + avio_rb32(pb); /* reserved */ + val = avio_rb32(pb); /* flags */ + if (val & 1) + st->codec->flags2 |= CODEC_FLAG2_DROP_FRAME_TIMECODE; + avio_rb32(pb); + avio_rb32(pb); + st->codec->time_base.den = get_byte(pb); + st->codec->time_base.num = 1; + } + /* other codec type, just skip (rtp, mp4s, ...) */ avio_skip(pb, size - (avio_tell(pb) - start_pos)); } /* this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...) */ @@ -1471,6 +1481,11 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom) sample_count=avio_rb32(pb); sample_duration = avio_rb32(pb); + /* sample_duration < 0 is invalid based on the spec */ + if (sample_duration < 0) { + av_log(c->fc, AV_LOG_ERROR, "Invalid SampleDelta in STTS %d", sample_duration); + sample_duration = 1; + } sc->stts_data[i].count= sample_count; sc->stts_data[i].duration= sample_duration;