public static ChunkOffsets64Box createChunkOffsets64Box(long[] offsets) { ChunkOffsets64Box co64 = new ChunkOffsets64Box(Header.createHeader(fourcc(), 0)); co64.chunkOffsets = offsets; return co64; }
public ChunkWriter(TrakBox trak, SeekableByteChannel[] inputs, SeekableByteChannel out) { entries = NodeBox.findAll(trak, SampleEntry.class, "mdia", "minf", "stbl", "stsd", null); ChunkOffsetsBox stco = NodeBox.findFirst(trak, ChunkOffsetsBox.class, "mdia", "minf", "stbl", "stco"); ChunkOffsets64Box co64 = NodeBox.findFirst(trak, ChunkOffsets64Box.class, "mdia", "minf", "stbl", "co64"); int size; if (stco != null) size = stco.getChunkOffsets().length; else size = co64.getChunkOffsets().length; this.inputs = inputs; offsets = new long[size]; this.out = out; this.trak = trak; }
private static void appendChunkOffsets(TrakBox trakBox1, TrakBox trakBox2) { ChunkOffsetsBox stco1 = trakBox1.getStco(); ChunkOffsets64Box co641 = trakBox1.getCo64(); ChunkOffsetsBox stco2 = trakBox2.getStco(); ChunkOffsets64Box co642 = trakBox2.getCo64(); long[] off1 = stco1 == null ? co641.getChunkOffsets() : stco1.getChunkOffsets(); long[] off2 = stco2 == null ? co642.getChunkOffsets() : stco2.getChunkOffsets(); NodeBox stbl1 = NodeBox.findFirstPath(trakBox1, NodeBox.class, Box.path("mdia.minf.stbl")); stbl1.removeChildren("stco", "co64"); stbl1.add(co641 == null && co642 == null ? ChunkOffsetsBox.createChunkOffsetsBox(ArrayUtil.addAllLong(off1, off2)) : ChunkOffsets64Box.createChunkOffsets64Box(ArrayUtil.addAllLong(off1, off2))); }
public void apply() { NodeBox stbl = NodeBox.findFirst(trak, NodeBox.class, "mdia", "minf", "stbl"); stbl.removeChildren("stco", "co64"); stbl.add(new ChunkOffsets64Box(offsets)); cleanDrefs(trak); }
public ChunkOffsets64Box() { super(new Header(fourcc(), 0)); }
public Box getChunkOffsets(List<Chunk> chunks) { long[] result = new long[chunks.size()]; boolean longBox = false; int i = 0; for (Chunk chunk : chunks) { if (chunk.getOffset() >= 0x100000000L) longBox = true; result[i++] = chunk.getOffset(); } return longBox ? ChunkOffsets64Box.createChunkOffsets64Box(result) : ChunkOffsetsBox.createChunkOffsetsBox(result); }
public void apply() { NodeBox stbl = NodeBox.findFirst(trak, NodeBox.class, "mdia", "minf", "stbl"); stbl.removeChildren("stco", "co64"); stbl.add(new ChunkOffsets64Box(offsets)); cleanDrefs(trak); }
public ChunkOffsets64Box() { super(new Header(fourcc(), 0)); }
public void apply() { NodeBox stbl = NodeBox.findFirstPath(trak, NodeBox.class, Box.path("mdia.minf.stbl")); stbl.removeChildren("stco", "co64"); stbl.add(ChunkOffsets64Box.createChunkOffsets64Box(offsets)); cleanDrefs(trak); }
public ChunkWriter(TrakBox trak, SeekableByteChannel[] inputs, SeekableByteChannel out) { entries = NodeBox.findAll(trak, SampleEntry.class, "mdia", "minf", "stbl", "stsd", null); ChunkOffsetsBox stco = NodeBox.findFirst(trak, ChunkOffsetsBox.class, "mdia", "minf", "stbl", "stco"); ChunkOffsets64Box co64 = NodeBox.findFirst(trak, ChunkOffsets64Box.class, "mdia", "minf", "stbl", "co64"); int size; if (stco != null) size = stco.getChunkOffsets().length; else size = co64.getChunkOffsets().length; this.inputs = inputs; offsets = new long[size]; this.out = out; this.trak = trak; }
stbl.add(new SampleSizesBox(frameSize, totalFrames)); stbl.add(new TimeToSampleBox(new TimeToSampleEntry[] { new TimeToSampleEntry(totalFrames, frameDuration) })); stbl.add(new ChunkOffsets64Box(chunkOffsets.toArray()));
mappings.put("ipro", NodeBox.class); mappings.put("sinf", NodeBox.class); mappings.put(ChunkOffsets64Box.fourcc(), ChunkOffsets64Box.class); mappings.put(SoundMediaHeaderBox.fourcc(), SoundMediaHeaderBox.class); mappings.put("clip", NodeBox.class);
stbl.add(TimeToSampleBox .createTimeToSampleBox(new TimeToSampleEntry[] { new TimeToSampleEntry(totalFrames, frameDuration) })); stbl.add(ChunkOffsets64Box.createChunkOffsets64Box(chunkOffsets.toArray()));
public ChunkWriter(TrakBox trak, SeekableByteChannel[] inputs, SeekableByteChannel out) { this.buf = new byte[8092]; entries = trak.getSampleEntries(); ChunkOffsetsBox stco = trak.getStco(); ChunkOffsets64Box co64 = trak.getCo64(); int size; if (stco != null) size = stco.getChunkOffsets().length; else size = co64.getChunkOffsets().length; this.inputs = inputs; offsets = new long[size]; this.out = out; this.trak = trak; }
stbl.add(new SampleSizesBox(frameSize, totalFrames)); stbl.add(new TimeToSampleBox(new TimeToSampleEntry[] { new TimeToSampleEntry(totalFrames, frameDuration) })); stbl.add(new ChunkOffsets64Box(chunkOffsets.toArray()));
mappings.put("ipro", NodeBox.class); mappings.put("sinf", NodeBox.class); mappings.put(ChunkOffsets64Box.fourcc(), ChunkOffsets64Box.class); mappings.put(SoundMediaHeaderBox.fourcc(), SoundMediaHeaderBox.class); mappings.put("clip", NodeBox.class);
stbl.add(SampleSizesBox.createSampleSizesBox2(sampleSizes.toArray())); stbl.add(TimeToSampleBox.createTimeToSampleBox(sampleDurations.toArray(new TimeToSampleEntry[] {}))); stbl.add(ChunkOffsets64Box.createChunkOffsets64Box(chunkOffsets.toArray())); if (!allIframes && iframes.size() > 0) stbl.add(SyncSamplesBox.createSyncSamplesBox(iframes.toArray()));
public ChunkReader(TrakBox trakBox) { TimeToSampleBox stts = NodeBox.findFirst(trakBox, TimeToSampleBox.class, "mdia", "minf", "stbl", "stts"); tts = stts.getEntries(); ChunkOffsetsBox stco = NodeBox.findFirst(trakBox, ChunkOffsetsBox.class, "mdia", "minf", "stbl", "stco"); ChunkOffsets64Box co64 = NodeBox.findFirst(trakBox, ChunkOffsets64Box.class, "mdia", "minf", "stbl", "co64"); stsz = NodeBox.findFirst(trakBox, SampleSizesBox.class, "mdia", "minf", "stbl", "stsz"); SampleToChunkBox stsc = NodeBox.findFirst(trakBox, SampleToChunkBox.class, "mdia", "minf", "stbl", "stsc"); if (stco != null) chunkOffsets = stco.getChunkOffsets(); else chunkOffsets = co64.getChunkOffsets(); sampleToChunk = stsc.getSampleToChunk(); stsd = NodeBox.findFirst(trakBox, SampleDescriptionBox.class, "mdia", "minf", "stbl", "stsd"); }
stbl.add(new SampleSizesBox(sampleSizes.toArray())); stbl.add(new TimeToSampleBox(sampleDurations.toArray(new TimeToSampleEntry[] {}))); stbl.add(new ChunkOffsets64Box(chunkOffsets.toArray())); if (!allIframes && iframes.size() > 0) stbl.add(new SyncSamplesBox(iframes.toArray()));
mappings.put("ipro", NodeBox.class); mappings.put("sinf", NodeBox.class); mappings.put(ChunkOffsets64Box.fourcc(), ChunkOffsets64Box.class); mappings.put(SoundMediaHeaderBox.fourcc(), SoundMediaHeaderBox.class); mappings.put("clip", NodeBox.class);