@@ -291,6 +291,7 @@ typedef struct MOVContext {
int decryption_key_len;
int enable_drefs;
int32_t movie_display_matrix[3][3]; ///< display matrix from mvhd
+ int64_t header_size;
} MOVContext;
int ff_mp4_read_descr_len(AVIOContext *pb);
@@ -7574,6 +7574,9 @@ static int mov_read_header(AVFormatContext *s)
else
atom.size = INT64_MAX;
+ if (mov->header_size > 0)
+ atom.size = mov->header_size;
+
/* check MOV header */
do {
if (mov->moov_retry)
@@ -7591,6 +7594,9 @@ static int mov_read_header(AVFormatContext *s)
}
av_log(mov->fc, AV_LOG_TRACE, "on_parse_exit_offset=%"PRId64"\n", avio_tell(pb));
+ if (mov->header_size > 0)
+ mov->next_root_atom = mov->header_size;
+
if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
if (mov->nb_chapter_tracks > 0 && !mov->ignore_chapters)
mov_read_chapters(s);
@@ -8162,7 +8168,9 @@ static const AVOption mov_options[] = {
{ "decryption_key", "The media decryption key (hex)", OFFSET(decryption_key), AV_OPT_TYPE_BINARY, .flags = AV_OPT_FLAG_DECODING_PARAM },
{ "enable_drefs", "Enable external track support.", OFFSET(enable_drefs), AV_OPT_TYPE_BOOL,
{.i64 = 0}, 0, 1, FLAGS },
-
+ { "header_size", "size of initial header, ",
+ OFFSET(header_size), AV_OPT_TYPE_INT64, {.i64 = -1},
+ -1, INT64_MAX, FLAGS },
{ NULL },
};