Module vcr4j.core

Class Timecode

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

public class Timecode extends Object
A container for a timecode string in the format of HH:MM:SS:FF (hour:minute:second:frame) If a frameRate is provided the string will be decomposed into frames and framerate
Since:
2015-09-24T10:59:00
Author:
Brian Schlining
  • Field Details

  • Constructor Details

    • Timecode

      public Timecode(double frames, double frameRate)
    • Timecode

      public Timecode(String timecode, double frameRate)
    • Timecode

      public Timecode(String timecode)
  • Method Details

    • isValid

      public boolean isValid()
      Returns:
      true if the timecode is formatted as HH:MM:SS:FF and the individual fields are possible field values. false if this is not a valid timecode representation.
    • isComplete

      public boolean isComplete()
      Returns:
      true If the following are all available: A valid timecode string, a valid framerate and a valid frame value. false otherwise.
    • getHMSF

      public Optional<HMSF> getHMSF()
      If the timecode is in a valid format then this will be present. Use this to access the hour, minute, second, frame fields.
      Returns:
      The hmsf object, if present
    • getFrameRate

      public double getFrameRate()
      Returns:
      The frameRate or NaN if no framerate was provided
    • getFrames

      public double getFrames()
      Returns:
      The frame count represented by the timecode string. If no frameRate was provided this can not be calculated so NaN is returned.
    • getSeconds

      public double getSeconds()
      Returns:
      the timecode as elapsed seconds. NaN is returned if the frameRate was not provided or if the timecode string is invalid
    • toString

      public String toString()
      The string represented. This may NOT necessarily be a valid timecode string if you did not provide one. You can use the isValid() method to check if the string is a valid timecode representation.
      Overrides:
      toString in class Object
      Returns:
      A string representation of HH:MM:SS:F
    • zero

      public static Timecode zero()