summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/ffmpeg/libavformat/mov.c
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-12-10 16:19:40 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-12-10 16:01:50 +0000
commit51f6c2793adab2d864b3d2b360000ef8db1d3e92 (patch)
tree835b3b4446b012c75e80177cef9fbe6972cc7dbe /chromium/third_party/ffmpeg/libavformat/mov.c
parent6036726eb981b6c4b42047513b9d3f4ac865daac (diff)
BASELINE: Update Chromium to 71.0.3578.93
Change-Id: I6a32086c33670e1b033f8b10e6bf1fd4da1d105d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/third_party/ffmpeg/libavformat/mov.c')
-rw-r--r--chromium/third_party/ffmpeg/libavformat/mov.c44
1 files changed, 25 insertions, 19 deletions
diff --git a/chromium/third_party/ffmpeg/libavformat/mov.c b/chromium/third_party/ffmpeg/libavformat/mov.c
index 2541bf54e28..76525e208ee 100644
--- a/chromium/third_party/ffmpeg/libavformat/mov.c
+++ b/chromium/third_party/ffmpeg/libavformat/mov.c
@@ -1911,6 +1911,8 @@ static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom)
ret = ff_get_extradata(c->fc, st->codecpar, pb, atom.size);
if (ret < 0)
return ret;
+ if (atom.type == MKTAG('h','v','c','C') && st->codecpar->codec_tag == MKTAG('d','v','h','1'))
+ st->codecpar->codec_id = AV_CODEC_ID_HEVC;
return 0;
}
@@ -2041,6 +2043,8 @@ static int mov_codec_id(AVStream *st, uint32_t format)
id = ff_codec_get_id(ff_codec_movsubtitle_tags, format);
if (id > 0)
st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
+ else
+ id = ff_codec_get_id(ff_codec_movdata_tags, format);
}
}
@@ -2127,8 +2131,8 @@ static void mov_parse_stsd_audio(MOVContext *c, AVIOContext *pb,
// Read QT version 1 fields. In version 0 these do not exist.
av_log(c->fc, AV_LOG_TRACE, "version =%d, isom =%d\n", version, c->isom);
if (!c->isom ||
- (compatible_brands && strstr(compatible_brands->value, "qt "))) {
-
+ (compatible_brands && strstr(compatible_brands->value, "qt ")) ||
+ (sc->stsd_version == 0 && version > 0)) {
if (version == 1) {
sc->samples_per_frame = avio_rb32(pb);
avio_rb32(pb); /* bytes per packet */
@@ -2508,18 +2512,16 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
"size=%"PRId64" 4CC=%s codec_type=%d\n", size,
av_fourcc2str(format), st->codecpar->codec_type);
+ st->codecpar->codec_id = id;
if (st->codecpar->codec_type==AVMEDIA_TYPE_VIDEO) {
- st->codecpar->codec_id = id;
mov_parse_stsd_video(c, pb, st, sc);
} else if (st->codecpar->codec_type==AVMEDIA_TYPE_AUDIO) {
- st->codecpar->codec_id = id;
mov_parse_stsd_audio(c, pb, st, sc);
if (st->codecpar->sample_rate < 0) {
av_log(c->fc, AV_LOG_ERROR, "Invalid sample rate %d\n", st->codecpar->sample_rate);
return AVERROR_INVALIDDATA;
}
} else if (st->codecpar->codec_type==AVMEDIA_TYPE_SUBTITLE){
- st->codecpar->codec_id = id;
mov_parse_stsd_subtitle(c, pb, st, sc,
size - (avio_tell(pb) - start_pos));
} else {
@@ -2570,11 +2572,12 @@ static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
st = c->fc->streams[c->fc->nb_streams - 1];
sc = st->priv_data;
- avio_r8(pb); /* version */
+ sc->stsd_version = avio_r8(pb);
avio_rb24(pb); /* flags */
entries = avio_rb32(pb);
- if (entries <= 0) {
+ /* Each entry contains a size (4 bytes) and format (4 bytes). */
+ if (entries <= 0 || entries > atom.size / 8) {
av_log(c->fc, AV_LOG_ERROR, "invalid STSD entries %d\n", entries);
return AVERROR_INVALIDDATA;
}
@@ -3710,9 +3713,9 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
st->index_entries[i].timestamp -= msc->min_corrected_pts;
}
}
- // Start time should be equal to zero or the duration of any empty edits.
- st->start_time = empty_edits_sum_duration;
}
+ // Start time should be equal to zero or the duration of any empty edits.
+ st->start_time = empty_edits_sum_duration;
// Update av stream length, if it ends up shorter than the track's media duration
st->duration = FFMIN(st->duration, edit_list_dts_entry_end - start_dts);
@@ -5218,27 +5221,25 @@ static int mov_read_tmcd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_av1c(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
AVStream *st;
- int ret, version;
+ int ret;
if (c->fc->nb_streams < 1)
return 0;
st = c->fc->streams[c->fc->nb_streams - 1];
- if (atom.size < 5) {
+ if (atom.size < 4) {
av_log(c->fc, AV_LOG_ERROR, "Empty AV1 Codec Configuration Box\n");
return AVERROR_INVALIDDATA;
}
- version = avio_r8(pb);
- if (version != 0) {
- av_log(c->fc, AV_LOG_WARNING, "Unknown AV1 Codec Configuration Box version %d\n", version);
- return 0;
- }
- avio_skip(pb, 3); /* flags */
+ /* For now, propagate only the OBUs, if any. Once libavcodec is
+ updated to handle isobmff style extradata this can be removed. */
+ avio_skip(pb, 4);
- avio_skip(pb, 1); /* reserved, initial_presentation_delay_present, initial_presentation_delay_minus_one */
+ if (atom.size == 4)
+ return 0;
- ret = ff_get_extradata(c->fc, st->codecpar, pb, atom.size - 5);
+ ret = ff_get_extradata(c->fc, st->codecpar, pb, atom.size - 4);
if (ret < 0)
return ret;
@@ -5912,6 +5913,11 @@ static int mov_read_sample_encryption_info(MOVContext *c, AVIOContext *pb, MOVSt
unsigned int subsample_count;
AVSubsampleEncryptionInfo *subsamples;
+ if (!sc->cenc.default_encrypted_sample) {
+ av_log(c->fc, AV_LOG_ERROR, "Missing schm or tenc\n");
+ return AVERROR_INVALIDDATA;
+ }
+
*sample = av_encryption_info_clone(sc->cenc.default_encrypted_sample);
if (!*sample)
return AVERROR(ENOMEM);