Class TimeCode

java.lang.Object
se.datadosen.jalbum.TimeCode
All Implemented Interfaces:
com.github.cliftonlabs.json_simple.Jsonable, Serializable, Comparable<TimeCode>

public class TimeCode extends Object implements Serializable, Comparable<TimeCode>, com.github.cliftonlabs.json_simple.Jsonable
Represents time measurements used by VideoProcessor
Since:
v11
See Also:
  • Constructor Details

    • TimeCode

      public TimeCode()
    • TimeCode

      public TimeCode(int secs)
    • TimeCode

      public TimeCode(int secs, int millis)
    • TimeCode

      public TimeCode(double millis)
    • TimeCode

      public TimeCode(String s) throws IllegalArgumentException
      Parse a time code formatted as hh:mm:ss.ff, hh:mm:ss.xxx or hh:mm:ss as a TimeCode (xxx represents fractions of a second, so .1 means a tenth of a second)
      Parameters:
      s - timecode string
      Throws:
      IllegalArgumentException - If passed string is null or doesn't format as any of the allowed formats
  • Method Details

    • toString

      public String toString()
      Return TimeCode formatted as h:m:ss or m:ss.xxx if there are frames too
      Overrides:
      toString in class Object
      Returns:
    • toShortString

      public String toShortString()
    • getSecs

      public int getSecs()
    • setSecs

      public void setSecs(int secs)
    • getMillis

      public int getMillis()
    • setMillis

      public void setMillis(int millis)
    • setFrames

      @Deprecated public void setFrames(int frames)
      Deprecated.
      Use setMillis. Parameter isn't actually frames, but fractions of a second in millisecond precision
      Parameters:
      frames -
    • asMillis

      public long asMillis()
    • fromMillis

      public static TimeCode fromMillis(long millis)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(TimeCode o)
      Specified by:
      compareTo in interface Comparable<TimeCode>
    • toJson

      public String toJson()
      Specified by:
      toJson in interface com.github.cliftonlabs.json_simple.Jsonable
    • toJson

      public void toJson(Writer writable) throws IOException
      Specified by:
      toJson in interface com.github.cliftonlabs.json_simple.Jsonable
      Throws:
      IOException