libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
FrameRate Class Reference

Represents a video frame rate as a rational number. More...

#include <framerate.h>

Public Types

enum  WellKnownRate {
  FPS_NotWellKnown = 0 , FPS_Invalid , FPS_60 , FPS_5994 ,
  FPS_50 , FPS_30 , FPS_2997 , FPS_25 ,
  FPS_24 , FPS_2398
}
 Enumeration of well-known industry-standard frame rates. More...
 
using RationalType = Rational< unsigned int >
 Underlying rational type used to store the frame rate.
 

Public Member Functions

 FrameRate ()=default
 Default constructor. Creates an invalid (zero) frame rate.
 
 FrameRate (WellKnownRate rate)
 Constructs a FrameRate from a well-known rate enum.
 
 FrameRate (const RationalType &r)
 Constructs a FrameRate from an arbitrary rational value.
 
bool isValid () const
 Returns true if this frame rate is valid (numerator > 0).
 
unsigned int numerator () const
 Returns the numerator of the frame rate rational.
 
unsigned int denominator () const
 Returns the denominator of the frame rate rational.
 
double toDouble () const
 Returns the frame rate as a double-precision floating point value.
 
String toString () const
 Returns a string representation of the frame rate.
 
bool isWellKnownRate () const
 Returns true if this is a well-known industry frame rate.
 
WellKnownRate wellKnownRate () const
 Returns the WellKnownRate enum value for this frame rate.
 

Detailed Description

Represents a video frame rate as a rational number.

FrameRate wraps a Rational value and provides an enumeration of well-known industry-standard frame rates (24, 25, 29.97, 30, etc.). A frame rate can be constructed from a WellKnownRate enum or from an arbitrary rational value.

Member Enumeration Documentation

◆ WellKnownRate

Enumeration of well-known industry-standard frame rates.

Enumerator
FPS_NotWellKnown 

Not a well-known rate.

Constructor & Destructor Documentation

◆ FrameRate() [1/2]

FrameRate::FrameRate ( WellKnownRate  rate)

Constructs a FrameRate from a well-known rate enum.

Parameters
rateThe well-known rate to use.

◆ FrameRate() [2/2]

FrameRate::FrameRate ( const RationalType r)

Constructs a FrameRate from an arbitrary rational value.

Parameters
rThe rational frame rate (numerator / denominator).

Member Function Documentation

◆ isValid()

bool FrameRate::isValid ( ) const
inline

Returns true if this frame rate is valid (numerator > 0).

Returns
true if valid.

◆ isWellKnownRate()

bool FrameRate::isWellKnownRate ( ) const
inline

Returns true if this is a well-known industry frame rate.

Returns
true if the rate matches a WellKnownRate entry.

◆ toDouble()

double FrameRate::toDouble ( ) const
inline

Returns the frame rate as a double-precision floating point value.

Returns
The frame rate in frames per second.

◆ toString()

String FrameRate::toString ( ) const
inline

Returns a string representation of the frame rate.

Returns
The frame rate as a String (e.g. "30000/1001").

◆ wellKnownRate()

WellKnownRate FrameRate::wellKnownRate ( ) const
inline

Returns the WellKnownRate enum value for this frame rate.

Returns
The matching WellKnownRate, or FPS_NotWellKnown.

The documentation for this class was generated from the following file: