Merge Boxes.moov() into Mp4MoovStucture.moov()
Boxes.moov() simply wraps the subboxes and this logic can be put into main method which has all the logic of creating moov box. This is to eventually move Mp4MoovStucture.moov() into Boxes.java where all other box creation methods are already present. PiperOrigin-RevId: 653319292
This commit is contained in:
parent
01dda6d3e5
commit
51d27d7575
@ -487,27 +487,6 @@ import java.util.List;
|
||||
"uuid", ImmutableList.of(ByteBuffer.wrap(Bytes.toArray(uuid)), contents));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the moov box.
|
||||
*
|
||||
* <p>This box is a top level movie descriptor box (there is a single one of this per Mp4 file).
|
||||
*/
|
||||
public static ByteBuffer moov(
|
||||
ByteBuffer mvhdBox,
|
||||
ByteBuffer udtaBox,
|
||||
ByteBuffer metaBox,
|
||||
List<ByteBuffer> trakBoxes,
|
||||
ByteBuffer mvexBox) {
|
||||
List<ByteBuffer> subBoxes = new ArrayList<>();
|
||||
subBoxes.add(mvhdBox);
|
||||
subBoxes.add(udtaBox);
|
||||
subBoxes.add(metaBox);
|
||||
subBoxes.addAll(trakBoxes);
|
||||
subBoxes.add(mvexBox);
|
||||
|
||||
return BoxUtils.wrapBoxesIntoBox("moov", subBoxes);
|
||||
}
|
||||
|
||||
/** Returns an audio sample entry box based on the MIME type. */
|
||||
public static ByteBuffer audioSampleEntry(Format format) {
|
||||
String fourcc = codecSpecificFourcc(format);
|
||||
|
@ -192,14 +192,16 @@ import org.checkerframework.checker.nullness.qual.PolyNull;
|
||||
Boxes.keys(Lists.newArrayList(metadataCollector.metadataEntries)),
|
||||
Boxes.ilst(Lists.newArrayList(metadataCollector.metadataEntries)));
|
||||
|
||||
ByteBuffer moovBox;
|
||||
moovBox =
|
||||
Boxes.moov(
|
||||
mvhdBox,
|
||||
udtaBox,
|
||||
metaBox,
|
||||
trakBoxes,
|
||||
isFragmentedMp4 ? Boxes.mvex(trexBoxes) : ByteBuffer.allocate(0));
|
||||
List<ByteBuffer> subBoxes = new ArrayList<>();
|
||||
subBoxes.add(mvhdBox);
|
||||
subBoxes.add(udtaBox);
|
||||
subBoxes.add(metaBox);
|
||||
subBoxes.addAll(trakBoxes);
|
||||
if (isFragmentedMp4) {
|
||||
subBoxes.add(Boxes.mvex(trexBoxes));
|
||||
}
|
||||
|
||||
ByteBuffer moovBox = BoxUtils.wrapBoxesIntoBox("moov", subBoxes);
|
||||
|
||||
// Also add XMP if needed
|
||||
if (metadataCollector.xmpData != null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user