public int getTimescale() { return findFirst(this, MediaHeaderBox.class, "mdia", "mdhd").getTimescale(); }
public int getTimescale() { return findFirst(this, MediaHeaderBox.class, "mdia", "mdhd").getTimescale(); }
/** * 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(); }
public void apply(MovieBox mov) { TrakBox vt = mov.getVideoTrack(); MediaHeaderBox mdhd = NodeBox.findFirstPath(vt, MediaHeaderBox.class, Box.path("mdia.mdhd")); int oldTs = mdhd.getTimescale(); if (oldTs > ts) { throw new RuntimeException("Old timescale (" + oldTs + ") is greater then new timescale (" + ts + "), not touching."); } vt.fixMediaTimescale(ts); mov.fixTimescale(ts); }
public void fixMediaTimescale(int ts) { MediaHeaderBox mdhd = Box.findFirst(this, MediaHeaderBox.class, "mdia", "mdhd"); int oldTs = mdhd.getTimescale(); mdhd.setTimescale(ts); mdhd.setDuration((ts * mdhd.getDuration()) / oldTs); List<Edit> edits = getEdits(); if (edits != null) { for (Edit edit : edits) { edit.setMediaTime((ts * edit.getMediaTime()) / oldTs); } } TimeToSampleBox tts = Box.findFirst(this, TimeToSampleBox.class, "mdia", "minf", "stbl", "stts"); TimeToSampleEntry[] entries = tts.getEntries(); for (TimeToSampleEntry tte : entries) { tte.setSampleDuration((ts * tte.getSampleDuration()) / oldTs); } }
public void fixMediaTimescale(int ts) { MediaHeaderBox mdhd = Box.findFirst(this, MediaHeaderBox.class, "mdia", "mdhd"); int oldTs = mdhd.getTimescale(); mdhd.setTimescale(ts); mdhd.setDuration((ts * mdhd.getDuration()) / oldTs); List<Edit> edits = getEdits(); if (edits != null) { for (Edit edit : edits) { edit.setMediaTime((ts * edit.getMediaTime()) / oldTs); } } TimeToSampleBox tts = Box.findFirst(this, TimeToSampleBox.class, "mdia", "minf", "stbl", "stts"); TimeToSampleEntry[] entries = tts.getEntries(); for (TimeToSampleEntry tte : entries) { tte.setSampleDuration((ts * tte.getSampleDuration()) / oldTs); } }
public void fixMediaTimescale(int ts) { MediaHeaderBox mdhd = NodeBox.findFirstPath(this, MediaHeaderBox.class, Box.path("mdia.mdhd")); int oldTs = mdhd.getTimescale(); mdhd.setTimescale(ts); mdhd.setDuration((ts * mdhd.getDuration()) / oldTs); List<Edit> edits = getEdits(); if (edits != null) { for (Edit edit : edits) { edit.setMediaTime((ts * edit.getMediaTime()) / oldTs); } } TimeToSampleBox tts = NodeBox.findFirstPath(this, TimeToSampleBox.class, Box.path("mdia.minf.stbl.stts")); TimeToSampleEntry[] entries = tts.getEntries(); for (int i = 0; i < entries.length; i++) { TimeToSampleEntry tte = entries[i]; tte.setSampleDuration((ts * tte.getSampleDuration()) / oldTs); } }