From 56e49e11fc39420e3df3730bd2cc2bf2bad15b78 Mon Sep 17 00:00:00 2001 From: Martchus Date: Sat, 19 Nov 2016 21:25:18 +0100 Subject: [PATCH] Fix making MP4 file when forcing index pos --- mp4/mp4container.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mp4/mp4container.cpp b/mp4/mp4container.cpp index 71813f7..4c77872 100644 --- a/mp4/mp4container.cpp +++ b/mp4/mp4container.cpp @@ -239,7 +239,8 @@ void Mp4Container::internalMakeFile() // -> whether rewrite is required (always required when forced to rewrite or when tracks have been altered) bool rewriteRequired = fileInfo().isForcingRewrite() || writeChunkByChunk; // -> use the preferred tag position/index position (force one wins, if both are force tag pos wins; might be changed later if none is forced) - ElementPosition newTagPos = fileInfo().forceTagPosition() || !fileInfo().forceIndexPosition() ? fileInfo().tagPosition() : fileInfo().indexPosition(); + const ElementPosition initialNewTagPos = fileInfo().forceTagPosition() || !fileInfo().forceIndexPosition() ? fileInfo().tagPosition() : fileInfo().indexPosition(); + ElementPosition newTagPos = initialNewTagPos; // -> current tag position (determined later) ElementPosition currentTagPos; // -> holds new padding (before actual data) @@ -488,7 +489,7 @@ calculatePadding: } else { // writing tag before media data is forced -> rewrite the file // when rewriting anyways, ensure the preferred tag position is used - newTagPos = fileInfo().tagPosition() == ElementPosition::Keep ? currentTagPos : fileInfo().tagPosition(); + newTagPos = initialNewTagPos == ElementPosition::Keep ? currentTagPos : initialNewTagPos; } // in any case: recalculate padding goto calculatePadding;