• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.coremedia.iso.boxes;
2 
3 import com.coremedia.iso.IsoTypeReader;
4 import com.coremedia.iso.IsoTypeWriter;
5 
6 import java.nio.ByteBuffer;
7 
8 import static com.googlecode.mp4parser.util.CastUtils.l2i;
9 
10 /**
11  * Abstract Chunk Offset Box
12  */
13 public class ChunkOffset64BitBox extends ChunkOffsetBox {
14     public static final String TYPE = "co64";
15     private long[] chunkOffsets;
16 
ChunkOffset64BitBox()17     public ChunkOffset64BitBox() {
18         super(TYPE);
19     }
20 
21     @Override
getChunkOffsets()22     public long[] getChunkOffsets() {
23         return chunkOffsets;
24     }
25 
26     @Override
getContentSize()27     protected long getContentSize() {
28         return 8 + 8 * chunkOffsets.length;
29     }
30 
31     @Override
_parseDetails(ByteBuffer content)32     public void _parseDetails(ByteBuffer content) {
33         parseVersionAndFlags(content);
34         int entryCount = l2i(IsoTypeReader.readUInt32(content));
35         chunkOffsets = new long[entryCount];
36         for (int i = 0; i < entryCount; i++) {
37             chunkOffsets[i] = IsoTypeReader.readUInt64(content);
38         }
39     }
40 
41     @Override
getContent(ByteBuffer byteBuffer)42     protected void getContent(ByteBuffer byteBuffer) {
43         writeVersionAndFlags(byteBuffer);
44         IsoTypeWriter.writeUInt32(byteBuffer, chunkOffsets.length);
45         for (long chunkOffset : chunkOffsets) {
46             IsoTypeWriter.writeUInt64(byteBuffer, chunkOffset);
47         }
48     }
49 
50 
51 }
52