protected void createStco(Track track, SampleTableBox stbl) { ArrayList<Long> chunksOffsets = new ArrayList<>(); long lastOffset = -1; for (Sample sample : track.getSamples()) { long offset = sample.getOffset(); if (lastOffset != -1 && lastOffset != offset) { lastOffset = -1; } if (lastOffset == -1) { chunksOffsets.add(offset); } lastOffset = offset + sample.getSize(); } long[] chunkOffsetsLong = new long[chunksOffsets.size()]; for (int a = 0; a < chunksOffsets.size(); a++) { chunkOffsetsLong[a] = chunksOffsets.get(a); } StaticChunkOffsetBox stco = new StaticChunkOffsetBox(); stco.setChunkOffsets(chunkOffsetsLong); stbl.addBox(stco); } }
@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.readUInt32(content); } }
@Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeUInt32(byteBuffer, chunkOffsets.length); for (long chunkOffset : chunkOffsets) { IsoTypeWriter.writeUInt32(byteBuffer, chunkOffset); } }
trackToSample.put(track, 0); trackToTime.put(track, 0.0); chunkOffsetBoxes.put(track, new StaticChunkOffsetBox());
long[] offsets = chunkOffsetBox.getChunkOffsets(); for (int i = 0; i < offsets.length; i++) { offsets[i] += dataOffset;
protected Box createStbl(Movie movie, Track track) { SampleTableBox stbl = new SampleTableBox(); stbl.addBox(track.getSampleDescriptionBox()); stbl.addBox(new TimeToSampleBox()); //stbl.addBox(new SampleToChunkBox()); stbl.addBox(new StaticChunkOffsetBox()); return stbl; }
long[] offsets = chunkOffsetBox.getChunkOffsets(); for (int i = 0; i < offsets.length; i++) { offsets[i] += dataOffset;
protected void createStco(Track track, SampleTableBox stbl) { ArrayList<Long> chunksOffsets = new ArrayList<>(); long lastOffset = -1; for (Sample sample : track.getSamples()) { long offset = sample.getOffset(); if (lastOffset != -1 && lastOffset != offset) { lastOffset = -1; } if (lastOffset == -1) { chunksOffsets.add(offset); } lastOffset = offset + sample.getSize(); } long[] chunkOffsetsLong = new long[chunksOffsets.size()]; for (int a = 0; a < chunksOffsets.size(); a++) { chunkOffsetsLong[a] = chunksOffsets.get(a); } StaticChunkOffsetBox stco = new StaticChunkOffsetBox(); stco.setChunkOffsets(chunkOffsetsLong); stbl.addBox(stco); } }
protected Box createStbl(Movie movie, Track track) { SampleTableBox stbl = new SampleTableBox(); stbl.addBox(track.getSampleDescriptionBox()); stbl.addBox(new TimeToSampleBox()); //stbl.addBox(new SampleToChunkBox()); stbl.addBox(new StaticChunkOffsetBox()); return stbl; }
@Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeUInt32(byteBuffer, chunkOffsets.length); for (long chunkOffset : chunkOffsets) { IsoTypeWriter.writeUInt32(byteBuffer, chunkOffset); } }
@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.readUInt32(content); } }
long[] offsets = chunkOffsetBox.getChunkOffsets(); for (int i = 0; i < offsets.length; i++) { offsets[i] += dataOffset;
protected void createStco(Track track, SampleTableBox stbl) { ArrayList<Long> chunksOffsets = new ArrayList<>(); long lastOffset = -1; for (Sample sample : track.getSamples()) { long offset = sample.getOffset(); if (lastOffset != -1 && lastOffset != offset) { lastOffset = -1; } if (lastOffset == -1) { chunksOffsets.add(offset); } lastOffset = offset + sample.getSize(); } long[] chunkOffsetsLong = new long[chunksOffsets.size()]; for (int a = 0; a < chunksOffsets.size(); a++) { chunkOffsetsLong[a] = chunksOffsets.get(a); } StaticChunkOffsetBox stco = new StaticChunkOffsetBox(); stco.setChunkOffsets(chunkOffsetsLong); stbl.addBox(stco); } }
protected Box createStbl(Movie movie, Track track) { SampleTableBox stbl = new SampleTableBox(); createStsd(track, stbl); stbl.addBox(new TimeToSampleBox()); stbl.addBox(new SampleToChunkBox()); stbl.addBox(new SampleSizeBox()); stbl.addBox(new StaticChunkOffsetBox()); return stbl; }
@Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); IsoTypeWriter.writeUInt32(byteBuffer, chunkOffsets.length); for (long chunkOffset : chunkOffsets) { IsoTypeWriter.writeUInt32(byteBuffer, chunkOffset); } }
@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.readUInt32(content); } }
private void correctChunkOffsets(Container container, long correction) { List<Box> chunkOffsetBoxes = Path.getPaths(container, "/moov[0]/trak/mdia[0]/minf[0]/stbl[0]/stco[0]"); for (Box chunkOffsetBox : chunkOffsetBoxes) { LinkedList<Box> stblChildren = new LinkedList<>(chunkOffsetBox.getParent().getBoxes()); stblChildren.remove(chunkOffsetBox); long[] cOffsets = ((ChunkOffsetBox) chunkOffsetBox).getChunkOffsets(); for (int i = 0; i < cOffsets.length; i++) { cOffsets[i] += correction; } StaticChunkOffsetBox cob = new StaticChunkOffsetBox(); cob.setChunkOffsets(cOffsets); stblChildren.add(cob); chunkOffsetBox.getParent().setBoxes(stblChildren); } }
protected Box createStbl() { SampleTableBox stbl = new SampleTableBox(); stbl.addBox(source.getSampleDescriptionBox()); stbl.addBox(new TimeToSampleBox()); stbl.addBox(new SampleToChunkBox()); stbl.addBox(new SampleSizeBox()); stbl.addBox(new StaticChunkOffsetBox()); return stbl; }
StaticChunkOffsetBox stco = new StaticChunkOffsetBox(); this.chunkOffsetBoxes.add(stco); long offset = 0; stco.setChunkOffsets(chunkOffset); stbl.addBox(stco); minf.addBox(stbl);
protected Box createStbl(StreamingTrack streamingTrack) { SampleTableBox stbl = new SampleTableBox(); stbl.addBox(streamingTrack.getSampleDescriptionBox()); stbl.addBox(new TimeToSampleBox()); stbl.addBox(new SampleToChunkBox()); stbl.addBox(new SampleSizeBox()); stbl.addBox(new StaticChunkOffsetBox()); return stbl; }