Java Code Examples for com.drew.lang.Rational#doubleValue()
The following examples show how to use
com.drew.lang.Rational#doubleValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QuickTimeDescriptor.java From metadata-extractor with Apache License 2.0 | 5 votes |
private String getDurationDescription() { Rational duration = _directory.getRational(TAG_DURATION_SECONDS); if (duration == null) return null; double value = duration.doubleValue(); Integer hours = (int)(value / (Math.pow(60, 2))); Integer minutes = (int)((value / (Math.pow(60, 1))) - (hours * 60)); Integer seconds = (int)Math.ceil((value / (Math.pow(60, 0))) - (minutes * 60)); return String.format("%1$02d:%2$02d:%3$02d", hours, minutes, seconds); }
Example 2
Source File: Mp4Descriptor.java From metadata-extractor with Apache License 2.0 | 5 votes |
private String getDurationDescription() { Rational duration = _directory.getRational(TAG_DURATION_SECONDS); if (duration == null) return null; double value = duration.doubleValue(); Integer hours = (int)(value / (Math.pow(60, 2))); Integer minutes = (int)((value / (Math.pow(60, 1))) - (hours * 60)); Integer seconds = (int)Math.ceil((value / (Math.pow(60, 0))) - (minutes * 60)); return String.format("%1$02d:%2$02d:%3$02d", hours, minutes, seconds); }