protected void putEdits(TrakBox trak) { if (edits != null) { NodeBox edts = new NodeBox(new Header("edts")); edts.add(EditListBox.createEditListBox(edits)); trak.add(edts); } }
public static Box parseBox(ByteBuffer input, Header childAtom, BoxFactory factory) { Box box = newBox(childAtom, factory); if (childAtom.getBodySize() < MAX_BOX_SIZE) { box.parse(input); return box; } else { return new LeafBox(new Header("free", 8)); } }
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)); }
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)); }
protected void putEdits(TrakBox trak) { if (edits != null) { NodeBox edts = new NodeBox(new Header("edts")); edts.add(new EditListBox(edits)); trak.add(edts); } }
public void setPAR(Rational par) { for (SampleEntry sampleEntry : getSampleEntries()) { sampleEntry.removeChildren("pasp"); sampleEntry.add(new PixelAspectExt(par)); } }
protected void putName(TrakBox trak) { if (name != null) { NodeBox udta = new NodeBox(new Header("udta")); udta.add(NameBox.createNameBox(name)); trak.add(udta); } }
public void updateDuration() { TrakBox[] tracks = getTracks(); long min = Integer.MAX_VALUE; for (int i = 0; i < tracks.length; i++) { TrakBox trakBox = tracks[i]; if (trakBox.getDuration() < min) min = trakBox.getDuration(); } getMovieHeader().setDuration(min); }
private int calcSpaceReq(MovieBox movie) { int sum = 0; TrakBox[] tracks = movie.getTracks(); for (int i = 0; i < tracks.length; i++) { TrakBox trakBox = tracks[i]; ChunkOffsetsBox stco = trakBox.getStco(); if (stco != null) sum += stco.getChunkOffsets().length * 4; } return sum; }
public static void _setLabels(TrakBox trakBox, Label[] labels) { ChannelBox channel = NodeBox.findFirstPath(trakBox, ChannelBox.class, new String[] { "mdia", "minf", "stbl", "stsd", null, "chan" }); if (channel == null) { channel = ChannelBox.createChannelBox(); NodeBox.findFirstPath(trakBox, SampleEntry.class, new String[] { "mdia", "minf", "stbl", "stsd", null }).add(channel); } setLabels(labels, channel); }
/** * Gets 'media timescale' of this track. This is the timescale used to * represent the durations of samples inside mdia/minf/stbl/stts box. * * @return 'media timescale' of the track. */ public int getTimescale() { return NodeBox.findFirstPath(this, MediaHeaderBox.class, Box.path("mdia.mdhd")).getTimescale(); }
private boolean matchSampleSizes(TrakBox trakBox1, TrakBox trakBox2) { SampleSizesBox stsz1 = NodeBox.findFirstPath(trakBox1, SampleSizesBox.class, Box.path("mdia.minf.stbl.stsz")); SampleSizesBox stsz2 = NodeBox.findFirstPath(trakBox1, SampleSizesBox.class, Box.path("mdia.minf.stbl.stsz")); return stsz1.getDefaultSize() == stsz2.getDefaultSize(); }
public static Box parseBox(ByteBuffer input, Header childAtom, BoxFactory factory) { Box box = newBox(childAtom, factory); if (childAtom.getBodySize() < MAX_BOX_SIZE) { box.parse(input); return box; } else { return new LeafBox(new Header("free", 8)); } }