com.coremedia.iso.boxes.ChunkOffset64BitBox Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of isoparser Show documentation
Show all versions of isoparser Show documentation
A generic parser and writer for all ISO 14496 based files (MP4, Quicktime, DCF, PDCF, ...)
The newest version!
package com.coremedia.iso.boxes;
import com.coremedia.iso.IsoTypeReader;
import com.coremedia.iso.IsoTypeWriter;
import java.nio.ByteBuffer;
import static com.googlecode.mp4parser.util.CastUtils.l2i;
/**
* 4cc = "{@value #TYPE}"
* Abstract Chunk Offset Box
*/
public class ChunkOffset64BitBox extends ChunkOffsetBox {
public static final String TYPE = "co64";
private long[] chunkOffsets;
public ChunkOffset64BitBox() {
super(TYPE);
}
@Override
public long[] getChunkOffsets() {
return chunkOffsets;
}
@Override
public void setChunkOffsets(long[] chunkOffsets) {
this.chunkOffsets = chunkOffsets;
}
@Override
protected long getContentSize() {
return 8 + 8 * chunkOffsets.length;
}
@Override
public void _parseDetails(ByteBuffer content) {
parseVersionAndFlags(content);
int entryCount = l2i(IsoTypeReader.readUInt32(content));
chunkOffsets = new long[entryCount];
for (int i = 0; i < entryCount; i++) {
chunkOffsets[i] = IsoTypeReader.readUInt64(content);
}
}
@Override
protected void getContent(ByteBuffer byteBuffer) {
writeVersionAndFlags(byteBuffer);
IsoTypeWriter.writeUInt32(byteBuffer, chunkOffsets.length);
for (long chunkOffset : chunkOffsets) {
IsoTypeWriter.writeUInt64(byteBuffer, chunkOffset);
}
}
}