writeVersionAndFlags(byteBuffer);
IsoTypeWriter.writeUInt32(byteBuffer, entries.size());
for (SampleEntry sampleEntry : entries) {
IsoTypeWriter.writeUInt32(byteBuffer, sampleEntry.getSampleDelta());
IsoTypeWriter.writeUInt16(byteBuffer, sampleEntry.getSubsampleCount());
List<SampleEntry.SubsampleEntry> subsampleEntries = sampleEntry.getSubsampleEntries();
for (SampleEntry.SubsampleEntry subsampleEntry : subsampleEntries) {
if (getVersion() == 1) {
IsoTypeWriter.writeUInt32(byteBuffer, subsampleEntry.getSubsampleSize());
} else {
IsoTypeWriter.writeUInt16(byteBuffer, l2i(subsampleEntry.getSubsampleSize()));
}
IsoTypeWriter.writeUInt8(byteBuffer, subsampleEntry.getSubsamplePriority());
IsoTypeWriter.writeUInt8(byteBuffer, subsampleEntry.getDiscardable());
IsoTypeWriter.writeUInt32(byteBuffer, subsampleEntry.getReserved());
}
}