@Override public void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); entryCount = IsoTypeReader.readUInt32(content); for (int i = 0; i < entryCount; i++) { SampleEntry sampleEntry = new SampleEntry(); sampleEntry.setSampleDelta(IsoTypeReader.readUInt32(content)); int subsampleCount = IsoTypeReader.readUInt16(content); for (int j = 0; j < subsampleCount; j++) { SampleEntry.SubsampleEntry subsampleEntry = new SampleEntry.SubsampleEntry(); subsampleEntry.setSubsampleSize( getVersion() == 1 ? IsoTypeReader.readUInt32(content) : IsoTypeReader.readUInt16(content)); subsampleEntry.setSubsamplePriority(IsoTypeReader.readUInt8(content)); subsampleEntry.setDiscardable(IsoTypeReader.readUInt8(content)); subsampleEntry.setReserved(IsoTypeReader.readUInt32(content)); sampleEntry.addSubsampleEntry(subsampleEntry); } entries.add(sampleEntry); } }
@Override protected void getContent(ByteBuffer byteBuffer) { 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()); } } }