Struct FrameTimeWithRate
A struct that represents a time in a frame sequence.
Namespace: Unity.LiveCapture
Assembly: Unity.LiveCapture.dll
Syntax
public readonly struct FrameTimeWithRate
Remarks
A time specified relative to a frame sequence cannot be converted to other representations or generally compared unless the frame rate of the sequence is also known. This struct stores both pieces of data needed to fully represent the time.
Constructors
FrameTimeWithRate(FrameRate, FrameTime)
Creates a new Frame
Declaration
public FrameTimeWithRate(FrameRate rate, FrameTime time)
Parameters
Type | Name | Description |
---|---|---|
Frame |
rate | The rate of the frame sequence in Hz. |
Frame |
time | The time relative to the frame sequence. |
Properties
Rate
The rate of the frame sequence in Hz.
Declaration
public FrameRate Rate { get; }
Property Value
Type | Description |
---|---|
Frame |
Time
The time relative to the frame sequence.
Declaration
public FrameTime Time { get; }
Property Value
Type | Description |
---|---|
Frame |
Methods
CompareTo(object)
Compares this instance to a specified object and returns an indication of their relative values.
Declaration
public int CompareTo(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with this instance. |
Returns
Type | Description |
---|---|
int | A signed number indicating the relative values of this instance and |
CompareTo(FrameTimeWithRate)
Compares this instance to a specified Frame
Declaration
public int CompareTo(FrameTimeWithRate other)
Parameters
Type | Name | Description |
---|---|---|
Frame |
other | The value to compare with this instance. |
Returns
Type | Description |
---|---|
int | A signed number indicating the relative values of this instance and |
Equals(object)
Returns a value indicating whether this instance is equal to a specified object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | An object to compare with this instance. |
Returns
Type | Description |
---|---|
bool | true if |
Overrides
Equals(FrameTimeWithRate)
Returns a value indicating whether this instance is equal to a specified Frame
Declaration
public bool Equals(FrameTimeWithRate other)
Parameters
Type | Name | Description |
---|---|---|
Frame |
other | A value to compare with this instance. |
Returns
FromSeconds(FrameRate, double)
Creates a new Frame
Declaration
public static FrameTimeWithRate FromSeconds(FrameRate frameRate, double time)
Parameters
Type | Name | Description |
---|---|---|
Frame |
frameRate | The frame rate of the frame sequence. |
double | time | The time in seconds. |
Returns
Type | Description |
---|---|
Frame |
A new Frame |
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | The hash code for this instance. |
Overrides
Remap(FrameRate)
Gets this time represented using a different Frame
Declaration
public FrameTimeWithRate Remap(FrameRate frameRate)
Parameters
Type | Name | Description |
---|---|---|
Frame |
frameRate | The frame rate to convert to. |
Returns
Type | Description |
---|---|
Frame |
A new Frame |
ToSeconds()
Gets the time represented by this Frame
Declaration
public double ToSeconds()
Returns
Type | Description |
---|---|
double | The time in seconds since the start of the frame sequence, or default if Rate is invalid. |
ToString()
Returns a string that represents the current instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current instance. |
Overrides
ToTimecode()
Gets the time represented by this Frame
Declaration
public Timecode ToTimecode()
Returns
Remarks
If the total time is greater than 24 hours, the time is wrapped around to zero.
Operators
operator +(FrameTimeWithRate, FrameTimeWithRate)
Calculates the sum of two specified Frame
Declaration
public static FrameTimeWithRate operator +(FrameTimeWithRate a, FrameTimeWithRate b)
Parameters
Type | Name | Description |
---|---|---|
Frame |
a | The first frame time. |
Frame |
b | The second frame time. |
Returns
Type | Description |
---|---|
Frame |
The sum of |
Exceptions
Type | Condition |
---|---|
Overflow |
Thrown if the resulting value is outside the range representable
by the Frame |
operator --(FrameTimeWithRate)
Decrements a Frame
Declaration
public static FrameTimeWithRate operator --(FrameTimeWithRate a)
Parameters
Type | Name | Description |
---|---|---|
Frame |
a | The frame time to Decrement. |
Returns
Type | Description |
---|---|
Frame |
The decremented frame time. |
Exceptions
Type | Condition |
---|---|
Overflow |
Thrown if the resulting value is outside the range representable
by the Frame |
operator ==(FrameTimeWithRate, FrameTimeWithRate)
Determines whether two specified instances of Frame
Declaration
public static bool operator ==(FrameTimeWithRate a, FrameTimeWithRate b)
Parameters
Type | Name | Description |
---|---|---|
Frame |
a | The first instance to compare. |
Frame |
b | The second instance to compare. |
Returns
operator >(FrameTimeWithRate, FrameTimeWithRate)
Determines whether one specified Frame
Declaration
public static bool operator >(FrameTimeWithRate a, FrameTimeWithRate b)
Parameters
Type | Name | Description |
---|---|---|
Frame |
a | The first instance to compare. |
Frame |
b | The second instance to compare. |
Returns
operator >=(FrameTimeWithRate, FrameTimeWithRate)
Determines whether one specified Frame
Declaration
public static bool operator >=(FrameTimeWithRate a, FrameTimeWithRate b)
Parameters
Type | Name | Description |
---|---|---|
Frame |
a | The first instance to compare. |
Frame |
b | The second instance to compare. |
Returns
operator ++(FrameTimeWithRate)
Increments a Frame
Declaration
public static FrameTimeWithRate operator ++(FrameTimeWithRate a)
Parameters
Type | Name | Description |
---|---|---|
Frame |
a | The frame time to increment. |
Returns
Type | Description |
---|---|
Frame |
The incremented frame time. |
Exceptions
Type | Condition |
---|---|
Overflow |
Thrown if the resulting value is outside the range representable
by the Frame |
operator !=(FrameTimeWithRate, FrameTimeWithRate)
Determines whether two specified instances of Frame
Declaration
public static bool operator !=(FrameTimeWithRate a, FrameTimeWithRate b)
Parameters
Type | Name | Description |
---|---|---|
Frame |
a | The first instance to compare. |
Frame |
b | The second instance to compare. |
Returns
operator <(FrameTimeWithRate, FrameTimeWithRate)
Determines whether one specified Frame
Declaration
public static bool operator <(FrameTimeWithRate a, FrameTimeWithRate b)
Parameters
Type | Name | Description |
---|---|---|
Frame |
a | The first instance to compare. |
Frame |
b | The second instance to compare. |
Returns
operator <=(FrameTimeWithRate, FrameTimeWithRate)
Determines whether one specified Frame
Declaration
public static bool operator <=(FrameTimeWithRate a, FrameTimeWithRate b)
Parameters
Type | Name | Description |
---|---|---|
Frame |
a | The first instance to compare. |
Frame |
b | The second instance to compare. |
Returns
operator -(FrameTimeWithRate, FrameTimeWithRate)
Calculates the difference between two specified Frame
Declaration
public static FrameTimeWithRate operator -(FrameTimeWithRate a, FrameTimeWithRate b)
Parameters
Type | Name | Description |
---|---|---|
Frame |
a | The frame time. |
Frame |
b | The frame time to subtract. |
Returns
Type | Description |
---|---|
Frame |
The difference of |
Exceptions
Type | Condition |
---|---|
Overflow |
Thrown if the resulting value is outside the range representable
by the Frame |