|
|
@@ -6305,14 +6305,13 @@ static int mov_read_header(AVFormatContext *s) |
|
|
|
avio_seek(pb, 0, SEEK_SET); |
|
|
|
if ((err = mov_read_default(mov, pb, atom)) < 0) { |
|
|
|
av_log(s, AV_LOG_ERROR, "error reading header\n"); |
|
|
|
mov_read_close(s); |
|
|
|
return err; |
|
|
|
goto fail; |
|
|
|
} |
|
|
|
} while ((pb->seekable & AVIO_SEEKABLE_NORMAL) && !mov->found_moov && !mov->moov_retry++); |
|
|
|
if (!mov->found_moov) { |
|
|
|
av_log(s, AV_LOG_ERROR, "moov atom not found\n"); |
|
|
|
mov_read_close(s); |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
err = AVERROR_INVALIDDATA; |
|
|
|
goto fail; |
|
|
|
} |
|
|
|
av_log(mov->fc, AV_LOG_TRACE, "on_parse_exit_offset=%"PRId64"\n", avio_tell(pb)); |
|
|
|
|
|
|
@@ -6365,7 +6364,7 @@ static int mov_read_header(AVFormatContext *s) |
|
|
|
} |
|
|
|
if (st->codecpar->codec_id == AV_CODEC_ID_DVD_SUBTITLE) { |
|
|
|
if ((err = mov_rewrite_dvd_sub_extradata(st)) < 0) |
|
|
|
return err; |
|
|
|
goto fail; |
|
|
|
} |
|
|
|
} |
|
|
|
if (mov->handbrake_version && |
|
|
@@ -6385,8 +6384,8 @@ static int mov_read_header(AVFormatContext *s) |
|
|
|
if (sc->data_size > INT64_MAX / sc->time_scale / 8) { |
|
|
|
av_log(s, AV_LOG_ERROR, "Overflow during bit rate calculation %"PRId64" * 8 * %d\n", |
|
|
|
sc->data_size, sc->time_scale); |
|
|
|
mov_read_close(s); |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
err = AVERROR_INVALIDDATA; |
|
|
|
goto fail; |
|
|
|
} |
|
|
|
st->codecpar->bit_rate = sc->data_size * 8 * sc->time_scale / st->duration; |
|
|
|
} |
|
|
@@ -6401,8 +6400,8 @@ static int mov_read_header(AVFormatContext *s) |
|
|
|
if (sc->data_size > INT64_MAX / sc->time_scale / 8) { |
|
|
|
av_log(s, AV_LOG_ERROR, "Overflow during bit rate calculation %"PRId64" * 8 * %d\n", |
|
|
|
sc->data_size, sc->time_scale); |
|
|
|
mov_read_close(s); |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
err = AVERROR_INVALIDDATA; |
|
|
|
goto fail; |
|
|
|
} |
|
|
|
st->codecpar->bit_rate = sc->data_size * 8 * sc->time_scale / |
|
|
|
sc->duration_for_fps; |
|
|
@@ -6426,8 +6425,7 @@ static int mov_read_header(AVFormatContext *s) |
|
|
|
case AVMEDIA_TYPE_AUDIO: |
|
|
|
err = ff_replaygain_export(st, s->metadata); |
|
|
|
if (err < 0) { |
|
|
|
mov_read_close(s); |
|
|
|
return err; |
|
|
|
goto fail; |
|
|
|
} |
|
|
|
break; |
|
|
|
case AVMEDIA_TYPE_VIDEO: |
|
|
@@ -6435,7 +6433,7 @@ static int mov_read_header(AVFormatContext *s) |
|
|
|
err = av_stream_add_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, (uint8_t*)sc->display_matrix, |
|
|
|
sizeof(int32_t) * 9); |
|
|
|
if (err < 0) |
|
|
|
return err; |
|
|
|
goto fail; |
|
|
|
|
|
|
|
sc->display_matrix = NULL; |
|
|
|
} |
|
|
@@ -6444,7 +6442,7 @@ static int mov_read_header(AVFormatContext *s) |
|
|
|
(uint8_t *)sc->stereo3d, |
|
|
|
sizeof(*sc->stereo3d)); |
|
|
|
if (err < 0) |
|
|
|
return err; |
|
|
|
goto fail; |
|
|
|
|
|
|
|
sc->stereo3d = NULL; |
|
|
|
} |
|
|
@@ -6453,7 +6451,7 @@ static int mov_read_header(AVFormatContext *s) |
|
|
|
(uint8_t *)sc->spherical, |
|
|
|
sc->spherical_size); |
|
|
|
if (err < 0) |
|
|
|
return err; |
|
|
|
goto fail; |
|
|
|
|
|
|
|
sc->spherical = NULL; |
|
|
|
} |
|
|
@@ -6462,7 +6460,7 @@ static int mov_read_header(AVFormatContext *s) |
|
|
|
(uint8_t *)sc->mastering, |
|
|
|
sizeof(*sc->mastering)); |
|
|
|
if (err < 0) |
|
|
|
return err; |
|
|
|
goto fail; |
|
|
|
|
|
|
|
sc->mastering = NULL; |
|
|
|
} |
|
|
@@ -6471,7 +6469,7 @@ static int mov_read_header(AVFormatContext *s) |
|
|
|
(uint8_t *)sc->coll, |
|
|
|
sc->coll_size); |
|
|
|
if (err < 0) |
|
|
|
return err; |
|
|
|
goto fail; |
|
|
|
|
|
|
|
sc->coll = NULL; |
|
|
|
} |
|
|
@@ -6488,6 +6486,9 @@ static int mov_read_header(AVFormatContext *s) |
|
|
|
} |
|
|
|
|
|
|
|
return 0; |
|
|
|
fail: |
|
|
|
mov_read_close(s); |
|
|
|
return err; |
|
|
|
} |
|
|
|
|
|
|
|
static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st) |
|
|
|