public boolean hasDataRef() { DataInfoBox dinf = getMdia().getMinf().getDinf(); if (dinf == null) { return false; } DataRefBox dref = dinf.getDref(); if (dref == null) return false; boolean result = false; for (Box box : dref.boxes) { result |= (((FullBox) box).getFlags() & 0x1) != 0x1; } return result; }
public boolean hasDataRef() { DataInfoBox dinf = getMdia().getMinf().getDinf(); if (dinf == null) { return false; } DataRefBox dref = dinf.getDref(); if (dref == null) return false; boolean result = false; for (Box box : dref.boxes) { result |= (((FullBox) box).getFlags() & 0x1) != 0x1; } return result; }
public boolean hasDataRef() { DataInfoBox dinf = getMdia().getMinf().getDinf(); if (dinf == null) { return false; } DataRefBox dref = dinf.getDref(); if (dref == null) return false; boolean result = false; for (Box box : dref.boxes) { result |= (((FullBox) box).getFlags() & 0x1) != 0x1; } return result; }
public boolean isPureRef() { MediaInfoBox minf = getMdia().getMinf(); DataInfoBox dinf = minf.getDinf(); if (dinf == null) { return false; } DataRefBox dref = dinf.getDref(); if (dref == null) return false; for (Box box : dref.boxes) { if ((((FullBox) box).getFlags() & 0x1) != 0) return false; } return true; }
public boolean isPureRef() { MediaInfoBox minf = getMdia().getMinf(); DataInfoBox dinf = minf.getDinf(); if (dinf == null) { return false; } DataRefBox dref = dinf.getDref(); if (dref == null) return false; for (Box box : dref.boxes) { if ((((FullBox) box).getFlags() & 0x1) != 0) return false; } return true; }
public boolean isPureRef() { MediaInfoBox minf = getMdia().getMinf(); DataInfoBox dinf = minf.getDinf(); if (dinf == null) { return false; } DataRefBox dref = dinf.getDref(); if (dref == null) return false; for (Box box : dref.boxes) { if ((((FullBox) box).getFlags() & 0x1) != 0) return false; } return true; }
public void setDataRef(String url) { MediaInfoBox minf = getMdia().getMinf(); DataInfoBox dinf = minf.getDinf(); if (dinf == null) { dinf = new DataInfoBox(); minf.add(dinf); } DataRefBox dref = dinf.getDref(); UrlBox urlBox = new UrlBox(url); if (dref == null) { dref = new DataRefBox(); dinf.add(dref); dref.add(urlBox); } else { ListIterator<Box> lit = dref.boxes.listIterator(); while (lit.hasNext()) { FullBox box = (FullBox) lit.next(); if ((box.getFlags() & 0x1) != 0) lit.set(urlBox); } } }
public void setDataRef(String url) { MediaInfoBox minf = getMdia().getMinf(); DataInfoBox dinf = minf.getDinf(); if (dinf == null) { dinf = new DataInfoBox(); minf.add(dinf); } DataRefBox dref = dinf.getDref(); UrlBox urlBox = new UrlBox(url); if (dref == null) { dref = new DataRefBox(); dinf.add(dref); dref.add(urlBox); } else { ListIterator<Box> lit = dref.boxes.listIterator(); while (lit.hasNext()) { FullBox box = (FullBox) lit.next(); if ((box.getFlags() & 0x1) != 0) lit.set(urlBox); } } }
public void setDataRef(String url) { MediaInfoBox minf = getMdia().getMinf(); DataInfoBox dinf = minf.getDinf(); if (dinf == null) { dinf = DataInfoBox.createDataInfoBox(); minf.add(dinf); } DataRefBox dref = dinf.getDref(); UrlBox urlBox = UrlBox.createUrlBox(url); if (dref == null) { dref = DataRefBox.createDataRefBox(); dinf.add(dref); dref.add(urlBox); } else { ListIterator<Box> lit = dref.boxes.listIterator(); while (lit.hasNext()) { FullBox box = (FullBox) lit.next(); if ((box.getFlags() & 0x1) != 0) lit.set(urlBox); } } }
private void cleanDrefs(TrakBox trak) { MediaInfoBox minf = trak.getMdia().getMinf(); DataInfoBox dinf = trak.getMdia().getMinf().getDinf(); if (dinf == null) { dinf = new DataInfoBox(); minf.add(dinf); } DataRefBox dref = dinf.getDref(); if (dref == null) { dref = new DataRefBox(); dinf.add(dref); } dref.getBoxes().clear(); dref.add(AliasBox.createSelfRef()); for (SampleEntry entry : NodeBox.findAll(trak, SampleEntry.class, "mdia", "minf", "stbl", "stsd", null)) { entry.setDrefInd((short) 1); } }
private void cleanDrefs(TrakBox trak) { MediaInfoBox minf = trak.getMdia().getMinf(); DataInfoBox dinf = trak.getMdia().getMinf().getDinf(); if (dinf == null) { dinf = new DataInfoBox(); minf.add(dinf); } DataRefBox dref = dinf.getDref(); if (dref == null) { dref = new DataRefBox(); dinf.add(dref); } dref.getBoxes().clear(); dref.add(AliasBox.createSelfRef()); for (SampleEntry entry : NodeBox.findAll(trak, SampleEntry.class, "mdia", "minf", "stbl", "stsd", null)) { entry.setDrefInd((short) 1); } }
private void cleanDrefs(TrakBox trak) { MediaInfoBox minf = trak.getMdia().getMinf(); DataInfoBox dinf = trak.getMdia().getMinf().getDinf(); if (dinf == null) { dinf = DataInfoBox.createDataInfoBox(); minf.add(dinf); } DataRefBox dref = dinf.getDref(); if (dref == null) { dref = DataRefBox.createDataRefBox(); dinf.add(dref); } dref.getBoxes().clear(); dref.add(AliasBox.createSelfRef()); SampleEntry[] sampleEntries = trak.getSampleEntries(); for (int i = 0; i < sampleEntries.length; i++) { SampleEntry entry = sampleEntries[i]; entry.setDrefInd((short) 1); } }
public static ByteBuffer getSampleData(int sample, File file) throws IOException { MovieBox moov = MP4Util.parseMovie(file); MediaInfoBox minf = moov.getAudioTracks().get(0).getMdia().getMinf(); ChunkOffsetsBox stco = NodeBox.findFirstPath(minf, ChunkOffsetsBox.class, Box.path("stbl.stco")); SampleToChunkBox stsc = NodeBox.findFirstPath(minf, SampleToChunkBox.class, Box.path("stbl.stsc")); SampleSizesBox stsz = NodeBox.findFirstPath(minf, SampleSizesBox.class, Box.path("stbl.stsz")); long sampleOffset = getSampleOffset(sample, stsc, stco, stsz); MappedByteBuffer map = NIOUtils.mapFile(file); map.position((int) sampleOffset); map.limit(map.position() + stsz.getSizes()[sample]); return map; }
public TimecodeMP4DemuxerTrack(MovieBox movie, TrakBox trak, SeekableByteChannel input) throws IOException { this.box = trak; this.input = input; this.movie = movie; NodeBox stbl = trak.getMdia().getMinf().getStbl(); TimeToSampleBox stts = findFirst(stbl, TimeToSampleBox.class, "stts"); SampleToChunkBox stsc = findFirst(stbl, SampleToChunkBox.class, "stsc"); ChunkOffsetsBox stco = findFirst(stbl, ChunkOffsetsBox.class, "stco"); ChunkOffsets64Box co64 = findFirst(stbl, ChunkOffsets64Box.class, "co64"); timeToSamples = stts.getEntries(); chunkOffsets = stco != null ? stco.getChunkOffsets() : co64.getChunkOffsets(); sampleToChunks = stsc.getSampleToChunk(); if (chunkOffsets.length == 1) { cacheSamples(sampleToChunks, chunkOffsets); } tse = (TimecodeSampleEntry) box.getSampleEntries()[0]; }
public TimecodeMP4DemuxerTrack(MovieBox movie, TrakBox trak, SeekableByteChannel input) throws IOException { this.box = trak; this.input = input; this.movie = movie; NodeBox stbl = trak.getMdia().getMinf().getStbl(); TimeToSampleBox stts = findFirst(stbl, TimeToSampleBox.class, "stts"); SampleToChunkBox stsc = findFirst(stbl, SampleToChunkBox.class, "stsc"); ChunkOffsetsBox stco = findFirst(stbl, ChunkOffsetsBox.class, "stco"); ChunkOffsets64Box co64 = findFirst(stbl, ChunkOffsets64Box.class, "co64"); timeToSamples = stts.getEntries(); chunkOffsets = stco != null ? stco.getChunkOffsets() : co64.getChunkOffsets(); sampleToChunks = stsc.getSampleToChunk(); if (chunkOffsets.length == 1) { cacheSamples(sampleToChunks, chunkOffsets); } tse = (TimecodeSampleEntry) box.getSampleEntries()[0]; }
public TimecodeMP4DemuxerTrack(MovieBox movie, TrakBox trak, SeekableByteChannel input) throws IOException { this.box = trak; this.input = input; this.movie = movie; NodeBox stbl = trak.getMdia().getMinf().getStbl(); TimeToSampleBox stts = NodeBox.findFirst(stbl, TimeToSampleBox.class, "stts"); SampleToChunkBox stsc = NodeBox.findFirst(stbl, SampleToChunkBox.class, "stsc"); ChunkOffsetsBox stco = NodeBox.findFirst(stbl, ChunkOffsetsBox.class, "stco"); ChunkOffsets64Box co64 = NodeBox.findFirst(stbl, ChunkOffsets64Box.class, "co64"); timeToSamples = stts.getEntries(); chunkOffsets = stco != null ? stco.getChunkOffsets() : co64.getChunkOffsets(); sampleToChunks = stsc.getSampleToChunk(); if (chunkOffsets.length == 1) { cacheSamples(sampleToChunks, chunkOffsets); } tse = (TimecodeSampleEntry) box.getSampleEntries()[0]; }
public AbstractMP4DemuxerTrack(TrakBox trak) { no = trak.getTrackHeader().getNo(); type = MP4Demuxer.getTrackType(trak); sampleEntries = Box.findAll(trak, SampleEntry.class, "mdia", "minf", "stbl", "stsd", null); NodeBox stbl = trak.getMdia().getMinf().getStbl(); TimeToSampleBox stts = findFirst(stbl, TimeToSampleBox.class, "stts"); SampleToChunkBox stsc = findFirst(stbl, SampleToChunkBox.class, "stsc"); ChunkOffsetsBox stco = findFirst(stbl, ChunkOffsetsBox.class, "stco"); ChunkOffsets64Box co64 = findFirst(stbl, ChunkOffsets64Box.class, "co64"); timeToSamples = stts.getEntries(); sampleToChunks = stsc.getSampleToChunk(); chunkOffsets = stco != null ? stco.getChunkOffsets() : co64.getChunkOffsets(); for (TimeToSampleEntry ttse : timeToSamples) { duration += ttse.getSampleCount() * ttse.getSampleDuration(); } box = trak; timescale = trak.getTimescale(); }
public AbstractMP4DemuxerTrack(TrakBox trak) { no = trak.getTrackHeader().getNo(); type = MP4Demuxer.getTrackType(trak); sampleEntries = Box.findAll(trak, SampleEntry.class, "mdia", "minf", "stbl", "stsd", null); NodeBox stbl = trak.getMdia().getMinf().getStbl(); TimeToSampleBox stts = findFirst(stbl, TimeToSampleBox.class, "stts"); SampleToChunkBox stsc = findFirst(stbl, SampleToChunkBox.class, "stsc"); ChunkOffsetsBox stco = findFirst(stbl, ChunkOffsetsBox.class, "stco"); ChunkOffsets64Box co64 = findFirst(stbl, ChunkOffsets64Box.class, "co64"); timeToSamples = stts.getEntries(); sampleToChunks = stsc.getSampleToChunk(); chunkOffsets = stco != null ? stco.getChunkOffsets() : co64.getChunkOffsets(); for (TimeToSampleEntry ttse : timeToSamples) { duration += ttse.getSampleCount() * ttse.getSampleDuration(); } box = trak; timescale = trak.getTimescale(); }
public AbstractMP4DemuxerTrack(TrakBox trak) { no = trak.getTrackHeader().getNo(); type = TrakBox.getTrackType(trak); sampleEntries = NodeBox.findAllPath(trak, SampleEntry.class, new String[]{"mdia", "minf", "stbl", "stsd", null}); NodeBox stbl = trak.getMdia().getMinf().getStbl(); TimeToSampleBox stts = NodeBox.findFirst(stbl, TimeToSampleBox.class, "stts"); SampleToChunkBox stsc = NodeBox.findFirst(stbl, SampleToChunkBox.class, "stsc"); ChunkOffsetsBox stco = NodeBox.findFirst(stbl, ChunkOffsetsBox.class, "stco"); ChunkOffsets64Box co64 = NodeBox.findFirst(stbl, ChunkOffsets64Box.class, "co64"); timeToSamples = stts.getEntries(); sampleToChunks = stsc.getSampleToChunk(); chunkOffsets = stco != null ? stco.getChunkOffsets() : co64.getChunkOffsets(); for (int i = 0; i < timeToSamples.length; i++) { TimeToSampleEntry ttse = timeToSamples[i]; duration += ttse.getSampleCount() * ttse.getSampleDuration(); } box = trak; timescale = trak.getTimescale(); }