public DataRefBox getDref() { return NodeBox.findFirst(this, DataRefBox.class, "dref"); } }
public static ByteBuffer getCodecPrivate(SampleEntry mp4a) { LeafBox b = NodeBox.findFirst(mp4a, LeafBox.class, "esds"); if (b == null) { b = NodeBox.findFirstPath(mp4a, LeafBox.class, new String[] { null, "esds" }); } if (b == null) return null; EsdsBox esds = EsdsBox.newEsdsBox(); esds.parse(b.getData()); return esds.getStreamInfo(); }
public MediaInfoBox getMinf() { return NodeBox.findFirst(this, MediaInfoBox.class, "minf"); } }
public static MetadataEditor createFrom(File f) throws IOException { Format format = JCodecUtil.detectFormat(f); if (format != Format.MOV) { throw new IllegalArgumentException("Unsupported format: " + format); } Movie movie = MP4Util.parseFullMovie(f); MetaBox keyedMeta = NodeBox.findFirst(movie.getMoov(), MetaBox.class, MetaBox.fourcc()); MetaBox itunesMeta = NodeBox.findFirstPath(movie.getMoov(), MetaBox.class, new String[] { "udta", MetaBox.fourcc() }); return new MetadataEditor(f, keyedMeta == null ? new HashMap<String, MetaValue>() : keyedMeta.getKeyedMeta(), itunesMeta == null ? new HashMap<Integer, MetaValue>() : itunesMeta.getItunesMeta()); }
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"); }
public static AvcCBox parseAVCC(VideoSampleEntry vse) { Box lb = NodeBox.findFirst(vse, Box.class, "avcC"); if (lb instanceof AvcCBox) return (AvcCBox) lb; else { return parseAVCCFromBuffer(((LeafBox) lb).getData().duplicate()); } }
public int getSequenceNumber() { MovieFragmentHeaderBox mfhd = NodeBox .findFirst(this, MovieFragmentHeaderBox.class, MovieFragmentHeaderBox.fourcc()); if (mfhd == null) throw new RuntimeException("Corrupt movie fragment, no header atom found"); return mfhd.getSequenceNumber(); }
public int getTrackId() { TrackFragmentHeaderBox tfhd = NodeBox .findFirst(this, TrackFragmentHeaderBox.class, TrackFragmentHeaderBox.fourcc()); if (tfhd == null) throw new RuntimeException("Corrupt track fragment, no header atom found"); return tfhd.getTrackId(); }
public Rational getPAR() { PixelAspectExt pasp = NodeBox.findFirst(this, PixelAspectExt.class, "mdia", "minf", "stbl", "stsd", null, "pasp"); return pasp == null ? new Rational(1, 1) : pasp.getRational(); }
public Rational getPAR() { PixelAspectExt pasp = NodeBox.findFirst(this, PixelAspectExt.class, "mdia", "minf", "stbl", "stsd", null, "pasp"); return pasp == null ? new Rational(1, 1) : pasp.getRational(); }
public static void forceEditList(MovieBox movie, TrakBox trakBox) { List<Edit> edits = trakBox.getEdits(); if (edits == null || edits.size() == 0) { MovieHeaderBox mvhd = NodeBox.findFirst(movie, MovieHeaderBox.class, "mvhd"); edits = new ArrayList<Edit>(); trakBox.setEdits(edits); edits.add(new Edit((int) mvhd.getDuration(), 0, 1.0f)); trakBox.setEdits(edits); } }
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 Size getDisplayDimensions() { int width = 0, height = 0; if (sampleEntries != null && !sampleEntries.isEmpty() && sampleEntries.get(0) instanceof VideoSampleEntry) { VideoSampleEntry vse = (VideoSampleEntry) sampleEntries.get(0); PixelAspectExt paspBox = NodeBox.findFirst(vse, PixelAspectExt.class, PixelAspectExt.fourcc()); Rational pasp = paspBox != null ? paspBox.getRational() : new Rational(1, 1); width = pasp.getNum() * vse.getWidth() / pasp.getDen(); height = vse.getHeight(); } return new Size(width, height); }
public void apply() { NodeBox stbl = NodeBox.findFirst(trak, NodeBox.class, "mdia", "minf", "stbl"); stbl.removeChildren("stco", "co64"); stbl.add(new ChunkOffsets64Box(offsets)); cleanDrefs(trak); }
private boolean matchLoad(TrakBox trakBox1, TrakBox trakBox2) { LoadSettingsBox load1 = NodeBox.findFirst(trakBox1, LoadSettingsBox.class, "load"); LoadSettingsBox load2 = NodeBox.findFirst(trakBox2, LoadSettingsBox.class, "load"); if (load1 != null && load2 != null) { return load1.getPreloadStartTime() == load2.getPreloadStartTime() && load1.getPreloadDuration() == load2.getPreloadDuration() && load1.getPreloadFlags() == load2.getPreloadFlags() && load1.getDefaultHints() == load2.getDefaultHints(); } if (load1 == null && load2 == null) return true; return false; }
public void setClipRect(short x, short y, short width, short height) { NodeBox clip = NodeBox.findFirst(this, NodeBox.class, "clip"); if (clip == null) { clip = new NodeBox(new Header("clip")); add(clip); } clip.replace("crgn", new ClipRegionBox(x, y, width, height)); }
public void setClipRect(short x, short y, short width, short height) { NodeBox clip = NodeBox.findFirst(this, NodeBox.class, "clip"); if (clip == null) { clip = new NodeBox(new Header("clip")); add(clip); } clip.replace("crgn", ClipRegionBox.createClipRegionBox(x, y, width, height)); }
public void setClipRect(short x, short y, short width, short height) { NodeBox clip = NodeBox.findFirst(this, NodeBox.class, "clip"); if (clip == null) { clip = new NodeBox(new Header("clip")); add(clip); } clip.replace("crgn", new ClipRegionBox(x, y, width, height)); }
public void setName(String string) { NodeBox udta = NodeBox.findFirst(this, NodeBox.class, "udta"); if (udta == null) { udta = new NodeBox(new Header("udta")); this.add(udta); } udta.removeChildren("name"); udta.add(NameBox.createNameBox(string)); }
public void setEdits(List<Edit> edits) { NodeBox edts = NodeBox.findFirst(this, NodeBox.class, "edts"); if (edts == null) { edts = new NodeBox(new Header("edts")); this.add(edts); } edts.removeChildren("elst"); edts.add(EditListBox.createEditListBox(edits)); getTrackHeader().setDuration(getEditedDuration(this)); }