]> git.sesse.net Git - ffmpeg/commitdiff
movenc: Place the sidx index after the initial moov/mdat pair
authorMartin Storsjö <martin@martin.st>
Sun, 9 Aug 2015 19:40:39 +0000 (22:40 +0300)
committerMartin Storsjö <martin@martin.st>
Mon, 10 Aug 2015 06:46:14 +0000 (09:46 +0300)
For fragmented files with non-empty moov, with a fragment index
(sidx), place the index after the initial moov/mdat pair.

Previously, for this pathological case, the index was written
at the start of the file.

Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/movenc.c

index feb6a8480b2bf2b22906a7f22ed19cb88c722ffe..bb2504fa5f110214530b6e4669f236c03566e4a8 100644 (file)
@@ -3242,6 +3242,9 @@ static int mov_flush_fragment(AVFormatContext *s)
         avio_write(s->pb, buf, buf_size);
         av_free(buf);
 
+        if (mov->flags & FF_MOV_FLAG_FASTSTART)
+            mov->reserved_header_pos = avio_tell(s->pb);
+
         mov->moov_written = 1;
         mov->mdat_size = 0;
         for (i = 0; i < mov->nb_streams; i++) {