public static <T> T findFirst(NodeBox box, Class<T> clazz, String... path) { T[] result = (T[]) findAll(box, clazz, path); return result.length > 0 ? result[0] : null; }
public static <T> T findFirst(NodeBox box, Class<T> clazz, String... path) { T[] result = (T[]) findAll(box, clazz, path); return result.length > 0 ? result[0] : null; }
public static Box[] findAll(Box box, String... path) { return findAll(box, Box.class, path); }
public static Box[] findAll(Box box, String... path) { return findAll(box, Box.class, path); }
public TrackFragmentBox[] getTracks() { return Box.findAll(this, TrackFragmentBox.class, TrackFragmentBox.fourcc()); }
public TrackFragmentBox[] getTracks() { return Box.findAll(this, TrackFragmentBox.class, TrackFragmentBox.fourcc()); }
private void processHeader(NodeBox moov) throws IOException { TrakBox tt = null; for (TrakBox trak : Box.findAll(moov, TrakBox.class, "trak")) { SampleEntry se = Box.findFirst(trak, SampleEntry.class, "mdia", "minf", "stbl", "stsd", null); if ("tmcd".equals(se.getFourcc())) { tt = trak; } else { tracks.add(create(trak)); } } if (tt != null) { AbstractMP4DemuxerTrack video = getVideoTrack(); if (video != null) timecodeTrack = new TimecodeMP4DemuxerTrack(movie, tt, input); } }
private void processHeader(NodeBox moov) throws IOException { TrakBox tt = null; for (TrakBox trak : Box.findAll(moov, TrakBox.class, "trak")) { SampleEntry se = Box.findFirst(trak, SampleEntry.class, "mdia", "minf", "stbl", "stsd", null); if ("tmcd".equals(se.getFourcc())) { tt = trak; } else { tracks.add(create(trak)); } } if (tt != null) { AbstractMP4DemuxerTrack video = getVideoTrack(); if (video != null) timecodeTrack = new TimecodeMP4DemuxerTrack(movie, tt, input); } }
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(); }