Vtc.Source.Seconds protocol (vtc v0.3.7) View Source

Protocol which types can implement to be passed as the main value of Timecode.with_seconds/3.

Implementations

Out of the box, this protocol is implemented for the following types:

Link to this section Summary

Types

Result type of seconds/2.

t()

Functions

Returns the value as a rational, real-world seconds value.

Link to this section Types

Specs

result() ::
  {:ok, Vtc.Utils.Rational.t()} | {:error, Vtc.Timecode.ParseError.t()}

Result type of seconds/2.

Specs

t() :: term()

Link to this section Functions

Specs

seconds(t(), Vtc.Framerate.t()) :: result()

Returns the value as a rational, real-world seconds value.

Arguments

  • value: The source value.

  • rate: The framerate of the timecode being parsed.

Returns

A result tuple with a rational representation of the seconds value using Ratio on success.