Class TimecodeBuilder

java.lang.Object
com.peterphi.std.types.TimecodeBuilder

public class TimecodeBuilder extends Object
Constructs Timecode instances
  • Constructor Details

    • TimecodeBuilder

      public TimecodeBuilder()
  • Method Details

    • withTimecode

      public TimecodeBuilder withTimecode(Timecode timecode)
      Reset this builder to the values in the provided Timecode
      Parameters:
      timecode -
      Returns:
    • withTime

      public TimecodeBuilder withTime(Date dateTime)
    • withTime

      public TimecodeBuilder withTime(org.joda.time.DateTime dateTime)
    • withTime

      public TimecodeBuilder withTime(org.joda.time.LocalTime time)
    • withTime

      public TimecodeBuilder withTime(org.joda.time.LocalTime time, Timebase timebase)
    • withNegative

      public TimecodeBuilder withNegative(boolean negative)
    • withDays

      public TimecodeBuilder withDays(long days)
    • withHours

      public TimecodeBuilder withHours(long hours)
    • withMinutes

      public TimecodeBuilder withMinutes(long minutes)
    • withSeconds

      public TimecodeBuilder withSeconds(long seconds)
    • withFrames

      public TimecodeBuilder withFrames(long frames)
    • withDropFrame

      public TimecodeBuilder withDropFrame(boolean dropFrame)
    • withRate

      public TimecodeBuilder withRate(Timebase rate)
    • build

      public Timecode build()
      Constructs a Timecode instance with the fields defined in this builder
      Returns:
      Throws:
      IllegalArgumentException - if any of the fields are invalid/incompatible
    • isNegative

      public boolean isNegative()
    • getDays

      public long getDays()
    • getHours

      public long getHours()
    • getMinutes

      public long getMinutes()
    • getSeconds

      public long getSeconds()
    • getFrames

      public long getFrames()
    • getRate

      public Timebase getRate()
    • isDropFrame

      public Boolean isDropFrame()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • fromTimecode

      public static TimecodeBuilder fromTimecode(Timecode timecode)
    • fromEncodedValue

      public static TimecodeBuilder fromEncodedValue(String encoded)
      Parse a Timecode encoded in the "vidispine style" (hh:mm:ss:ff@timebase). See Timebase.getInstance(java.lang.String) for information on valid timebase representations
      Parameters:
      encoded - a timecode encoded as hh:mm:ss:ff@timebase
      Returns:
      a parsed timecode object
      Throws:
      RuntimeException - if the encoded string is not well-formed or could not be parsed
    • fromSMPTE

      public static TimecodeBuilder fromSMPTE(String smpte)
      Part a Timecode encoded in the SMPTE style ([dd:]hh:mm:ss:ff - or [dd:]hh:mm:ss;ff for drop-frame timecode)
      Parameters:
      smpte - the SMPTE-encoded timecode
      Returns:
      a parsed timecode object
      Throws:
      RuntimeException - if parsing fails
    • fromSamples

      public static TimecodeBuilder fromSamples(SampleCount samples, boolean dropFrame)
    • fromFrames

      public static TimecodeBuilder fromFrames(long signedFrameNumber, Timebase rate)
    • fromFrames

      public static TimecodeBuilder fromFrames(long signedFrameNumber, Timebase rate, boolean dropFrame)