Struct FrameTimeWithRate
A struct that represents a time in a frame sequence.
Namespace: Unity.LiveCapture
Syntax
public readonly struct FrameTimeWithRate : IComparable, IComparable<FrameTimeWithRate>, IEquatable<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 FrameTimeWithRate instance.
Declaration
public FrameTimeWithRate(FrameRate rate, FrameTime time)
Parameters
| Type | Name | Description |
|---|---|---|
| FrameRate | rate | The rate of the frame sequence in Hz. |
| FrameTime | time | The time relative to the frame sequence. |
Properties
Rate
The rate of the frame sequence in Hz.
Declaration
public readonly FrameRate Rate { get; }
Property Value
| Type | Description |
|---|---|
| FrameRate |
Time
The time relative to the frame sequence.
Declaration
public readonly FrameTime Time { get; }
Property Value
| Type | Description |
|---|---|
| FrameTime |
Methods
CompareTo(Object)
Compares this instance to a specified object and returns an indication of their relative values.
Declaration
public readonly int CompareTo(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | obj | The object to compare with this instance. |
Returns
| Type | Description |
|---|---|
| Int32 | A signed number indicating the relative values of this instance and
|
CompareTo(FrameTimeWithRate)
Compares this instance to a specified FrameTimeWithRate and returns an indication of their relative values.
Declaration
public readonly int CompareTo(FrameTimeWithRate other)
Parameters
| Type | Name | Description |
|---|---|---|
| FrameTimeWithRate | other | The value to compare with this instance. |
Returns
| Type | Description |
|---|---|
| Int32 | 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 readonly bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | obj | An object to compare with this instance. |
Returns
| Type | Description |
|---|---|
| Boolean | true if |
Overrides
Equals(FrameTimeWithRate)
Returns a value indicating whether this instance is equal to a specified FrameTimeWithRate.
Declaration
public readonly bool Equals(FrameTimeWithRate other)
Parameters
| Type | Name | Description |
|---|---|---|
| FrameTimeWithRate | other | A value to compare with this instance. |
Returns
| Type | Description |
|---|---|
| Boolean | true if |
FromSeconds(FrameRate, Double)
Creates a new FrameTimeWithRate instance from a time in seconds and a frame rate.
Declaration
public static FrameTimeWithRate FromSeconds(FrameRate frameRate, double time)
Parameters
| Type | Name | Description |
|---|---|---|
| FrameRate | frameRate | The frame rate of the frame sequence. |
| Double | time | The time in seconds. |
Returns
| Type | Description |
|---|---|
| FrameTimeWithRate | A new FrameTimeWithRate that represents the given time. |
GetHashCode()
Returns the hash code for this instance.
Declaration
public override readonly int GetHashCode()
Returns
| Type | Description |
|---|---|
| Int32 | The hash code for this instance. |
Overrides
Remap(FrameRate)
Gets this time represented using a different FrameRate.
Declaration
public readonly FrameTimeWithRate Remap(FrameRate frameRate)
Parameters
| Type | Name | Description |
|---|---|---|
| FrameRate | frameRate | The frame rate to convert to. |
Returns
| Type | Description |
|---|---|
| FrameTimeWithRate | A new FrameTimeWithRate remapped to the the target frame rate, or default
if |
ToSeconds()
Gets the time represented by this FrameTimeWithRate in seconds.
Declaration
public readonly 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 readonly string ToString()
Returns
| Type | Description |
|---|---|
| String | A string that represents the current instance. |
Overrides
ToTimecode()
Gets the time represented by this FrameTimeWithRate as a Timecode.
Declaration
public readonly Timecode ToTimecode()
Returns
| Type | Description |
|---|---|
| Timecode | A new Timecode that represents this time, or default if Rate is invalid. |
Remarks
If the total time is greater than 24 hours, the time is wrapped around to zero.
Operators
Addition(FrameTimeWithRate, FrameTimeWithRate)
Calculates the sum of two specified FrameTimeWithRate values.
Declaration
public static FrameTimeWithRate operator +(FrameTimeWithRate a, FrameTimeWithRate b)
Parameters
| Type | Name | Description |
|---|---|---|
| FrameTimeWithRate | a | The first frame time. |
| FrameTimeWithRate | b | The second frame time. |
Returns
| Type | Description |
|---|---|
| FrameTimeWithRate | The sum of |
Exceptions
| Type | Condition |
|---|---|
| OverflowException | Thrown if the resulting value is outside the range representable by the FrameTimeWithRate type. |
Decrement(FrameTimeWithRate)
Decrements a FrameTimeWithRate by a single frame.
Declaration
public static FrameTimeWithRate operator --(FrameTimeWithRate a)
Parameters
| Type | Name | Description |
|---|---|---|
| FrameTimeWithRate | a | The frame time to Decrement. |
Returns
| Type | Description |
|---|---|
| FrameTimeWithRate | The decremented frame time. |
Exceptions
| Type | Condition |
|---|---|
| OverflowException | Thrown if the resulting value is outside the range representable by the FrameTimeWithRate type. |
Equality(FrameTimeWithRate, FrameTimeWithRate)
Determines whether two specified instances of FrameTimeWithRate are equal.
Declaration
public static bool operator ==(FrameTimeWithRate a, FrameTimeWithRate b)
Parameters
| Type | Name | Description |
|---|---|---|
| FrameTimeWithRate | a | The first instance to compare. |
| FrameTimeWithRate | b | The second instance to compare. |
Returns
| Type | Description |
|---|---|
| Boolean |
GreaterThan(FrameTimeWithRate, FrameTimeWithRate)
Determines whether one specified FrameTimeWithRate is later than another specified FrameTimeWithRate.
Declaration
public static bool operator>(FrameTimeWithRate a, FrameTimeWithRate b)
Parameters
| Type | Name | Description |
|---|---|---|
| FrameTimeWithRate | a | The first instance to compare. |
| FrameTimeWithRate | b | The second instance to compare. |
Returns
| Type | Description |
|---|---|
| Boolean |
GreaterThanOrEqual(FrameTimeWithRate, FrameTimeWithRate)
Determines whether one specified FrameTimeWithRate is later than or the same as another specified FrameTimeWithRate.
Declaration
public static bool operator >=(FrameTimeWithRate a, FrameTimeWithRate b)
Parameters
| Type | Name | Description |
|---|---|---|
| FrameTimeWithRate | a | The first instance to compare. |
| FrameTimeWithRate | b | The second instance to compare. |
Returns
| Type | Description |
|---|---|
| Boolean |
Increment(FrameTimeWithRate)
Increments a FrameTimeWithRate by a single frame.
Declaration
public static FrameTimeWithRate operator ++(FrameTimeWithRate a)
Parameters
| Type | Name | Description |
|---|---|---|
| FrameTimeWithRate | a | The frame time to increment. |
Returns
| Type | Description |
|---|---|
| FrameTimeWithRate | The incremented frame time. |
Exceptions
| Type | Condition |
|---|---|
| OverflowException | Thrown if the resulting value is outside the range representable by the FrameTimeWithRate type. |
Inequality(FrameTimeWithRate, FrameTimeWithRate)
Determines whether two specified instances of FrameTimeWithRate are not equal.
Declaration
public static bool operator !=(FrameTimeWithRate a, FrameTimeWithRate b)
Parameters
| Type | Name | Description |
|---|---|---|
| FrameTimeWithRate | a | The first instance to compare. |
| FrameTimeWithRate | b | The second instance to compare. |
Returns
| Type | Description |
|---|---|
| Boolean | true if |
LessThan(FrameTimeWithRate, FrameTimeWithRate)
Determines whether one specified FrameTimeWithRate is earlier than another specified FrameTimeWithRate.
Declaration
public static bool operator <(FrameTimeWithRate a, FrameTimeWithRate b)
Parameters
| Type | Name | Description |
|---|---|---|
| FrameTimeWithRate | a | The first instance to compare. |
| FrameTimeWithRate | b | The second instance to compare. |
Returns
| Type | Description |
|---|---|
| Boolean |
LessThanOrEqual(FrameTimeWithRate, FrameTimeWithRate)
Determines whether one specified FrameTimeWithRate is earlier than or the same as another specified FrameTimeWithRate.
Declaration
public static bool operator <=(FrameTimeWithRate a, FrameTimeWithRate b)
Parameters
| Type | Name | Description |
|---|---|---|
| FrameTimeWithRate | a | The first instance to compare. |
| FrameTimeWithRate | b | The second instance to compare. |
Returns
| Type | Description |
|---|---|
| Boolean | true if |
Subtraction(FrameTimeWithRate, FrameTimeWithRate)
Calculates the difference between two specified FrameTimeWithRate values.
Declaration
public static FrameTimeWithRate operator -(FrameTimeWithRate a, FrameTimeWithRate b)
Parameters
| Type | Name | Description |
|---|---|---|
| FrameTimeWithRate | a | The frame time. |
| FrameTimeWithRate | b | The frame time to subtract. |
Returns
| Type | Description |
|---|---|
| FrameTimeWithRate | The difference of |
Exceptions
| Type | Condition |
|---|---|
| OverflowException | Thrown if the resulting value is outside the range representable by the FrameTimeWithRate type. |