Module vcr4j.core

Class MediaTime

java.lang.Object
org.mbari.vcr4j.time.MediaTime

public class MediaTime extends Object
Time modeled after Apple's CoreMedia CMTime. A MediaTime is represented as a rational number, with a numerator (an long value), and a denominator (an int timescale). Conceptually, the timescale specifies the fraction of a second each unit in the numerator occupies. Thus if the timescale is 4, each unit represents a quarter of a second; if the timescale is 10, each unit represents a tenth of a second, and so on.
Since:
2015-09-24T10:45:00
Author:
Brian Schlining
  • Constructor Details

    • MediaTime

      public MediaTime(long value, int timescale, boolean rounded)
      For example to create a MediaTime that's 200 seconds into a video that has 29.97 frame rate use new MediaTime(20000, 2997)
      Parameters:
      value - numerator
      timescale - denominator
      rounded - Indiates if this value is estimated
    • MediaTime

      public MediaTime(long value, int timescale)
  • Method Details

    • getValue

      public long getValue()
    • getTimescale

      public int getTimescale()
    • getSeconds

      public double getSeconds()
    • isRounded

      public boolean isRounded()
    • fromSeconds

      public static MediaTime fromSeconds(double seconds, int timescale)
    • toString

      public String toString()
      Overrides:
      toString in class Object