Table of Contents

Struct VideoFrameRate

Namespace
VisioForge.Core.Types
Assembly
VisioForge.Core.dll

Represents a video frame rate, typically expressed as a fraction (numerator/denominator) or a floating-point value. This struct provides methods for comparison, conversion, and common frame rate constants.

public struct VideoFrameRate : IComparable<VideoFrameRate>, IConvertible, IComparable, IEquatable<VideoFrameRate>

Implements

Inherited Members

Extension Methods

Remarks

Frame rates are crucial for accurate video playback, synchronization, and encoding. This struct handles the precision required for various video standards by storing frame rates as rational numbers (fractions). The numerator (Num) and denominator (Den) representation is essential for exact representation of rates like 29.97 (30000/1001) or 23.976 (24000/1001). The Value property provides a computed floating-point representation for convenience. Static properties provide standard frame rates: FPS_10, FPS_25 (PAL), FPS_30 (NTSC), FPS_60, FPS_29_97 (NTSC drop-frame), FPS_23_976 (film), etc. The struct implements IComparable, IEquatable, and IConvertible for comprehensive integration with .NET types. Comparison operators allow intuitive frame rate comparisons. IsEmpty property checks if the frame rate is uninitialized (0/0). This type is used throughout the framework wherever frame rate needs to be specified or queried.

Constructors

VideoFrameRate(uint, uint)

Initializes a new instance of the VisioForge.Core.Types.VideoFrameRate struct with a numerator and denominator.

public VideoFrameRate(uint num, uint den)

Parameters

num uint

The numerator of the frame rate.

den uint

The denominator of the frame rate. If 0, the frame rate is considered 0.

VideoFrameRate(long, long)

Initializes a new instance of the VisioForge.Core.Types.VideoFrameRate struct with long integer numerator and denominator.

public VideoFrameRate(long num, long den)

Parameters

num long

The numerator of the frame rate.

den long

The denominator of the frame rate. If 0, the frame rate is considered 0.

VideoFrameRate(int, int)

Initializes a new instance of the VisioForge.Core.Types.VideoFrameRate struct with integer numerator and denominator.

public VideoFrameRate(int num, int den)

Parameters

num int

The numerator of the frame rate.

den int

The denominator of the frame rate. If 0, the frame rate is considered 0.

VideoFrameRate(int)

Initializes a new instance of the VisioForge.Core.Types.VideoFrameRate struct with a whole number frame rate. The denominator is set to 1.

public VideoFrameRate(int num)

Parameters

num int

The whole number frame rate value.

VideoFrameRate(double)

Initializes a new instance of the VisioForge.Core.Types.VideoFrameRate struct from a double-precision floating-point value. The numerator and denominator are calculated from the double value.

public VideoFrameRate(double value)

Parameters

value double

The floating-point frame rate.

VideoFrameRate(uint)

Initializes a new instance of the VisioForge.Core.Types.VideoFrameRate struct from an unsigned integer value. The denominator is set to 1.

public VideoFrameRate(uint value)

Parameters

value uint

The unsigned integer frame rate.

Fields

Empty

Represents an empty or uninitialized video frame rate (0/0).

public static VideoFrameRate Empty

Field Value

VideoFrameRate

Properties

Den

Gets the denominator of the frame rate fraction.

public readonly uint Den { get; }

Property Value

uint

FPS_10

Gets a static VisioForge.Core.Types.VideoFrameRate instance representing 10 frames per second (10/1).

public static VideoFrameRate FPS_10 { get; }

Property Value

VideoFrameRate

FPS_25

Gets a static VisioForge.Core.Types.VideoFrameRate instance representing 25 frames per second (25/1), common for PAL video.

public static VideoFrameRate FPS_25 { get; }

Property Value

VideoFrameRate

FPS_30

Gets a static VisioForge.Core.Types.VideoFrameRate instance representing 30 frames per second (30/1), common for NTSC video.

public static VideoFrameRate FPS_30 { get; }

Property Value

VideoFrameRate

FPS_60

Gets a static VisioForge.Core.Types.VideoFrameRate instance representing 60 frames per second (60/1).

public static VideoFrameRate FPS_60 { get; }

Property Value

VideoFrameRate

IsEmpty

Gets a value indicating whether this VisioForge.Core.Types.VideoFrameRate instance is empty. An empty frame rate has a numerator of 0.

public bool IsEmpty { get; }

Property Value

bool

Num

Gets the numerator of the frame rate fraction.

public readonly uint Num { get; }

Property Value

uint

Value

Gets the floating-point value of the frame rate.

public double Value { get; }

Property Value

double

Methods

CompareTo(double)

Compares the current VisioForge.Core.Types.VideoFrameRate instance with a specified double-precision floating-point value.

public bool CompareTo(double value)

Parameters

value double

The double value to compare with.

Returns

bool

true if the absolute difference between the two values is less than 0.0001; otherwise, false.

CompareTo(VideoFrameRate)

Compares the current instance with another VisioForge.Core.Types.VideoFrameRate object and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

public int CompareTo(VideoFrameRate other)

Parameters

other VideoFrameRate

An object to compare with this instance.

Returns

int

A value that indicates the relative order of the objects being compared.

ValueMeaning
Less than zeroThis instance precedes other in the sort order.
ZeroThis instance occurs in the same position in the sort order as other.
Greater than zeroThis instance follows other in the sort order.

CompareTo(object)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. This method is not fully implemented and will throw a NotImplementedException if the object is not a VisioForge.Core.Types.VideoFrameRate.

public int CompareTo(object obj)

Parameters

obj object

An object to compare with this instance.

Returns

int

A value that indicates the relative order of the objects being compared.

Value Meaning
Less than zero This instance precedes obj in the sort order.
Zero This instance occurs in the same position in the sort order as obj.
Greater than zero This instance follows obj in the sort order.

Exceptions

NotImplementedException

Equals(object)

Determines whether the specified Object is equal to this instance.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if the specified Object is equal to this instance; otherwise, false.

Equals(VideoFrameRate)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(VideoFrameRate other)

Parameters

other VideoFrameRate

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

GetAvgTimePerFrame()

Gets the average time per frame in 100-nanosecond units.

public long GetAvgTimePerFrame()

Returns

long

The average time per frame as a Int64.

GetHashCode()

Returns a hash code for this instance.

public override int GetHashCode()

Returns

int

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

GetTypeCode()

Returns the TypeCode for this instance.

public TypeCode GetTypeCode()

Returns

TypeCode

The enumerated constant that is the TypeCode of the class or value type that implements this interface.

ToBoolean(IFormatProvider)

Converts the value of this instance to an equivalent Boolean value using the specified culture-specific formatting information. This method is not implemented and will throw a NotImplementedException.

public bool ToBoolean(IFormatProvider provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

bool

A Boolean value equivalent to the value of this instance.

Exceptions

NotImplementedException

ToByte(IFormatProvider)

Converts the value of this instance to an equivalent 8-bit unsigned integer using the specified culture-specific formatting information. This method is not implemented and will throw a NotImplementedException.

public byte ToByte(IFormatProvider provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

byte

An 8-bit unsigned integer equivalent to the value of this instance.

Exceptions

NotImplementedException

ToChar(IFormatProvider)

Converts the value of this instance to an equivalent Unicode character using the specified culture-specific formatting information. This method is not implemented and will throw a NotImplementedException.

public char ToChar(IFormatProvider provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

char

A Unicode character equivalent to the value of this instance.

Exceptions

NotImplementedException

ToDateTime(IFormatProvider)

Converts the value of this instance to an equivalent DateTime using the specified culture-specific formatting information. This method is not implemented and will throw a NotImplementedException.

public DateTime ToDateTime(IFormatProvider provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

DateTime

A DateTime instance equivalent to the value of this instance.

Exceptions

NotImplementedException

ToDecimal(IFormatProvider)

Converts the value of this instance to an equivalent Decimal number using the specified culture-specific formatting information. This method is not implemented and will throw a NotImplementedException.

public decimal ToDecimal(IFormatProvider provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

decimal

A Decimal number equivalent to the value of this instance.

Exceptions

NotImplementedException

ToDouble(IFormatProvider)

Converts the value of this instance to an equivalent double-precision floating-point number using the specified culture-specific formatting information.

public double ToDouble(IFormatProvider provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

double

A double-precision floating-point number equivalent to the value of this instance.

ToInt16(IFormatProvider)

Converts the value of this instance to an equivalent 16-bit signed integer using the specified culture-specific formatting information. This method is not implemented and will throw a NotImplementedException.

public short ToInt16(IFormatProvider provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

short

An 16-bit signed integer equivalent to the value of this instance.

Exceptions

NotImplementedException

ToInt32(IFormatProvider)

Converts the value of this instance to an equivalent 32-bit signed integer using the specified culture-specific formatting information. This method is not implemented and will throw a NotImplementedException.

public int ToInt32(IFormatProvider provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

int

An 32-bit signed integer equivalent to the value of this instance.

Exceptions

NotImplementedException

ToInt64(IFormatProvider)

Converts the value of this instance to an equivalent 64-bit signed integer using the specified culture-specific formatting information. This method is not implemented and will throw a NotImplementedException.

public long ToInt64(IFormatProvider provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

long

An 64-bit signed integer equivalent to the value of this instance.

Exceptions

NotImplementedException

ToSByte(IFormatProvider)

Converts the value of this instance to an equivalent 8-bit signed integer using the specified culture-specific formatting information. This method is not implemented and will throw a NotImplementedException.

public sbyte ToSByte(IFormatProvider provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

sbyte

An 8-bit signed integer equivalent to the value of this instance.

Exceptions

NotImplementedException

ToSingle(IFormatProvider)

Converts the value of this instance to an equivalent single-precision floating-point number using the specified culture-specific formatting information. This method is not implemented and will throw a NotImplementedException.

public float ToSingle(IFormatProvider provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

float

A single-precision floating-point number equivalent to the value of this instance.

Exceptions

NotImplementedException

ToString()

Returns a string that represents the current VisioForge.Core.Types.VideoFrameRate instance, formatted to two decimal places.

public override string ToString()

Returns

string

A String that represents this instance.

ToString(CultureInfo)

Returns a string that represents the current VisioForge.Core.Types.VideoFrameRate instance, formatted using the specified culture information.

public string ToString(CultureInfo cultureInfo)

Parameters

cultureInfo CultureInfo

The culture information to use for formatting.

Returns

string

A String that represents this instance.

ToString(IFormatProvider)

Returns a String that represents this instance. This method is not implemented and will throw a NotImplementedException.

public string ToString(IFormatProvider provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

string

A String that represents this instance.

Exceptions

NotImplementedException

ToType(Type, IFormatProvider)

Converts the value of this instance to an Object of the specified Type that has an equivalent value, using the specified culture-specific formatting information. This method is not implemented and will throw a NotImplementedException.

public object ToType(Type conversionType, IFormatProvider provider)

Parameters

conversionType Type

The Type to which the value of this instance is converted.

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

object

An Object instance of type conversionType whose value is equivalent to the value of this instance.

Exceptions

NotImplementedException

ToUInt16(IFormatProvider)

Converts the value of this instance to an equivalent 16-bit unsigned integer using the specified culture-specific formatting information. This method is not implemented and will throw a NotImplementedException.

public ushort ToUInt16(IFormatProvider provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

ushort

An 16-bit unsigned integer equivalent to the value of this instance.

Exceptions

NotImplementedException

ToUInt32(IFormatProvider)

Converts the value of this instance to an equivalent 32-bit unsigned integer using the specified culture-specific formatting information. This method is not implemented and will throw a NotImplementedException.

public uint ToUInt32(IFormatProvider provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

uint

An 32-bit unsigned integer equivalent to the value of this instance.

Exceptions

NotImplementedException

ToUInt64(IFormatProvider)

Converts the value of this instance to an equivalent 64-bit unsigned integer using the specified culture-specific formatting information. This method is not implemented and will throw a NotImplementedException.

public ulong ToUInt64(IFormatProvider provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

ulong

An 64-bit unsigned integer equivalent to the value of this instance.

Exceptions

NotImplementedException

Operators

operator ==(VideoFrameRate, VideoFrameRate)

Implements the equality (==) operator for comparing two VisioForge.Core.Types.VideoFrameRate instances.

public static bool operator ==(VideoFrameRate S1, VideoFrameRate S2)

Parameters

S1 VideoFrameRate

The first VisioForge.Core.Types.VideoFrameRate to compare.

S2 VideoFrameRate

The second VisioForge.Core.Types.VideoFrameRate to compare.

Returns

bool

true if the two instances are equal; otherwise, false.

operator >(VideoFrameRate, VideoFrameRate)

Implements the greater than (>) operator for comparing two VisioForge.Core.Types.VideoFrameRate instances.

public static bool operator >(VideoFrameRate S1, VideoFrameRate S2)

Parameters

S1 VideoFrameRate

The first VisioForge.Core.Types.VideoFrameRate to compare.

S2 VideoFrameRate

The second VisioForge.Core.Types.VideoFrameRate to compare.

Returns

bool

true if the first instance is greater than the second; otherwise, false.

operator !=(VideoFrameRate, VideoFrameRate)

Implements the inequality (!=) operator for comparing two VisioForge.Core.Types.VideoFrameRate instances.

public static bool operator !=(VideoFrameRate S1, VideoFrameRate S2)

Parameters

S1 VideoFrameRate

The first VisioForge.Core.Types.VideoFrameRate to compare.

S2 VideoFrameRate

The second VisioForge.Core.Types.VideoFrameRate to compare.

Returns

bool

true if the two instances are not equal; otherwise, false.

operator <(VideoFrameRate, VideoFrameRate)

Implements the less than (<) operator for comparing two VisioForge.Core.Types.VideoFrameRate instances.

public static bool operator <(VideoFrameRate S1, VideoFrameRate S2)

Parameters

S1 VideoFrameRate

The first VisioForge.Core.Types.VideoFrameRate to compare.

S2 VideoFrameRate

The second VisioForge.Core.Types.VideoFrameRate to compare.

Returns

bool

true if the first instance is less than the second; otherwise, false.