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
numuint-
The numerator of the frame rate.
denuint-
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
numlong-
The numerator of the frame rate.
denlong-
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
numint-
The numerator of the frame rate.
denint-
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
numint-
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
valuedouble-
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
valueuint-
The unsigned integer frame rate.
Fields
Empty
Represents an empty or uninitialized video frame rate (0/0).
public static VideoFrameRate EmptyField Value
Properties
Den
Gets the denominator of the frame rate fraction.
public readonly uint Den { get; }Property Value
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
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
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
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
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
Num
Gets the numerator of the frame rate fraction.
public readonly uint Num { get; }Property Value
Value
Gets the floating-point value of the frame rate.
public double Value { get; }Property Value
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
valuedouble-
The double value to compare with.
Returns
- bool
-
trueif 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
otherVideoFrameRate-
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 otherin the sort order.Zero This instance occurs in the same position in the sort order as other.Greater than zero This instance follows otherin 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
objobject-
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 objin the sort order.Zero This instance occurs in the same position in the sort order as obj.Greater than zero This instance follows objin the sort order.
Exceptions
Equals(object)
Determines whether the specified Object is equal to this instance.
public override bool Equals(object obj)Parameters
objobject-
The object to compare with the current instance.
Returns
Equals(VideoFrameRate)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(VideoFrameRate other)Parameters
otherVideoFrameRate-
An object to compare with this object.
Returns
GetAvgTimePerFrame()
Gets the average time per frame in 100-nanosecond units.
public long GetAvgTimePerFrame()Returns
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
providerIFormatProvider-
An IFormatProvider interface implementation that supplies culture-specific formatting information.
Returns
- bool
-
A Boolean value equivalent to the value of this instance.
Exceptions
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
providerIFormatProvider-
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
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
providerIFormatProvider-
An IFormatProvider interface implementation that supplies culture-specific formatting information.
Returns
- char
-
A Unicode character equivalent to the value of this instance.
Exceptions
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
providerIFormatProvider-
An IFormatProvider interface implementation that supplies culture-specific formatting information.
Returns
Exceptions
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
providerIFormatProvider-
An IFormatProvider interface implementation that supplies culture-specific formatting information.
Returns
Exceptions
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
providerIFormatProvider-
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
providerIFormatProvider-
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
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
providerIFormatProvider-
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
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
providerIFormatProvider-
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
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
providerIFormatProvider-
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
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
providerIFormatProvider-
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
ToString()
Returns a string that represents the current VisioForge.Core.Types.VideoFrameRate instance, formatted to two decimal places.
public override string ToString()Returns
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
cultureInfoCultureInfo-
The culture information to use for formatting.
Returns
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
providerIFormatProvider-
An IFormatProvider interface implementation that supplies culture-specific formatting information.
Returns
Exceptions
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
conversionTypeType-
The Type to which the value of this instance is converted.
providerIFormatProvider-
An IFormatProvider interface implementation that supplies culture-specific formatting information.
Returns
- object
-
An Object instance of type
conversionTypewhose value is equivalent to the value of this instance.
Exceptions
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
providerIFormatProvider-
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
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
providerIFormatProvider-
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
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
providerIFormatProvider-
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
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
S1VideoFrameRate-
The first VisioForge.Core.Types.VideoFrameRate to compare.
S2VideoFrameRate-
The second VisioForge.Core.Types.VideoFrameRate to compare.
Returns
- bool
-
trueif 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
S1VideoFrameRate-
The first VisioForge.Core.Types.VideoFrameRate to compare.
S2VideoFrameRate-
The second VisioForge.Core.Types.VideoFrameRate to compare.
Returns
- bool
-
trueif 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
S1VideoFrameRate-
The first VisioForge.Core.Types.VideoFrameRate to compare.
S2VideoFrameRate-
The second VisioForge.Core.Types.VideoFrameRate to compare.
Returns
- bool
-
trueif 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
S1VideoFrameRate-
The first VisioForge.Core.Types.VideoFrameRate to compare.
S2VideoFrameRate-
The second VisioForge.Core.Types.VideoFrameRate to compare.
Returns
- bool
-
trueif the first instance is less than the second; otherwise,false.