protected long withTimestamp(long pts, boolean isPts) { return scale.multiplyS(pts); } }.fix(src);
/** * Converts timevalue to frame number based on timecode track * * @param timecodeTrack * @param tv * @return */ public static int timevalueToTimecodeFrame(TrakBox timecodeTrack, RationalLarge tv, int movieTimescale) { TimecodeSampleEntry se = (TimecodeSampleEntry) timecodeTrack.getSampleEntries()[0]; return (int) ((2 * tv.multiplyS(se.getTimescale()) / se.getFrameDuration()) + 1) / 2; }
/** * Converts timevalue to frame number based on timecode track * * @param timecodeTrack * @param tv * @return */ public static int timevalueToTimecodeFrame(TrakBox timecodeTrack, RationalLarge tv, int movieTimescale) { TimecodeSampleEntry se = (TimecodeSampleEntry) timecodeTrack.getSampleEntries()[0]; return (int) ((2 * tv.multiplyS(se.getTimescale()) / se.getFrameDuration()) + 1) / 2; }
/** * Converts timevalue to frame number based on timecode track * * @param timecodeTrack * @param tv * @return */ public static int timevalueToTimecodeFrame(TrakBox timecodeTrack, RationalLarge tv, int movieTimescale) { TimecodeSampleEntry se = (TimecodeSampleEntry) timecodeTrack.getSampleEntries()[0]; return (int) ((2 * tv.multiplyS(se.getTimescale()) / se.getFrameDuration()) + 1) / 2; }
/** * Calculates and formats tape timecode as in Quicktime player * * @param timecodeTrack * @param tv * @param startCounter * @return * @throws IOException */ public static String qtPlayerTimecode(TimecodeMP4DemuxerTrack timecodeTrack, RationalLarge tv, int movieTimescale) throws IOException { TrakBox tt = timecodeTrack.getBox(); int ttTimescale = tt.getTimescale(); long ttTv = editedToMedia(tt, tv.multiplyS(ttTimescale), movieTimescale); return formatTimecode( timecodeTrack.getBox(), timecodeTrack.getStartTimecode() + timevalueToTimecodeFrame(timecodeTrack.getBox(), new RationalLarge(ttTv, ttTimescale), movieTimescale)); }
/** * Calculates and formats tape timecode as in Quicktime player * * @param timecodeTrack * @param tv * @param startCounter * @return * @throws IOException */ public static String qtPlayerTimecode(TimecodeMP4DemuxerTrack timecodeTrack, RationalLarge tv, int movieTimescale) throws IOException { TrakBox tt = timecodeTrack.getBox(); int ttTimescale = tt.getTimescale(); long ttTv = editedToMedia(tt, tv.multiplyS(ttTimescale), movieTimescale); return formatTimecode( timecodeTrack.getBox(), timecodeTrack.getStartTimecode() + timevalueToTimecodeFrame(timecodeTrack.getBox(), new RationalLarge(ttTv, ttTimescale), movieTimescale)); }
/** * Calculates and formats tape timecode as in Quicktime player * * @param timecodeTrack * @param tv * @param startCounter * @return * @throws IOException */ public static String qtPlayerTimecode(TimecodeMP4DemuxerTrack timecodeTrack, RationalLarge tv, int movieTimescale) throws IOException { TrakBox tt = timecodeTrack.getBox(); int ttTimescale = tt.getTimescale(); long ttTv = editedToMedia(tt, tv.multiplyS(ttTimescale), movieTimescale); return formatTimecode( timecodeTrack.getBox(), timecodeTrack.getStartTimecode() + timevalueToTimecodeFrame(timecodeTrack.getBox(), new RationalLarge(ttTv, ttTimescale), movieTimescale)); }