![JAR search and dependency download from the Maven repository](/logo.png)
org.jcodec.containers.mp4.boxes.ChunkOffsetsBox Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jcodec Show documentation
Show all versions of jcodec Show documentation
Pure Java implementation of video/audio codecs and formats
package org.jcodec.containers.mp4.boxes;
import java.io.DataOutput;
import java.io.IOException;
import org.jcodec.containers.mp4.io.Input;
import org.jcodec.containers.mp4.io.Parser;
/**
* This class is part of JCodec ( www.jcodec.org )
* This software is distributed under FreeBSD License
*
* A box to hold chunk offsets
*
* @author Stanislav Vitvitskiy
*
*/
public class ChunkOffsetsBox extends FullBox {
private long[] chunkOffsets;
public static String fourcc() {
return "stco";
}
public ChunkOffsetsBox(long[] chunkOffsets) {
super(new Header(fourcc()));
this.chunkOffsets = chunkOffsets;
}
public ChunkOffsetsBox() {
super(new Header(fourcc()));
}
public void parse(Input input) throws IOException {
super.parse(input);
int length = (int) Parser.readInt32(input);
chunkOffsets = new long[length];
for (int i = 0; i < length; i++) {
chunkOffsets[i] = Parser.readInt32(input);
}
}
@Override
public void doWrite(DataOutput out) throws IOException {
super.doWrite(out);
out.writeInt(chunkOffsets.length);
for (long offset : chunkOffsets) {
out.writeInt((int) offset);
}
}
public long[] getChunkOffsets() {
return chunkOffsets;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy