Write index always in front when dealing with DASH

This commit is contained in:
Martchus 2016-11-19 23:14:38 +01:00
parent 2eb8760afa
commit a6b2d10655
1 changed files with 9 additions and 1 deletions

View File

@ -239,7 +239,7 @@ 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)
const ElementPosition initialNewTagPos = fileInfo().forceTagPosition() || !fileInfo().forceIndexPosition() ? fileInfo().tagPosition() : fileInfo().indexPosition();
ElementPosition initialNewTagPos = fileInfo().forceTagPosition() || !fileInfo().forceIndexPosition() ? fileInfo().tagPosition() : fileInfo().indexPosition();
ElementPosition newTagPos = initialNewTagPos;
// -> current tag position (determined later)
ElementPosition currentTagPos;
@ -325,6 +325,14 @@ void Mp4Container::internalMakeFile()
currentTagPos = ElementPosition::Keep;
}
// ensure index and tags are always placed at the beginning when dealing with DASH files
if(firstMovieFragmentAtom) {
if(initialNewTagPos == ElementPosition::AfterData) {
addNotification(NotificationType::Warning, "Sorry, but putting index/tags at the end is not possible when dealing with DASH files.", context);
}
initialNewTagPos = newTagPos = ElementPosition::BeforeData;
}
// user data atom, meta atom, next sibling of meta atom
if((userDataAtom = movieAtom->childById(Mp4AtomIds::UserData))) {
metaAtom = userDataAtom->childById(Mp4AtomIds::Meta);