You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
36 lines
803 B
C++
36 lines
803 B
C++
/**
|
|
* \file
|
|
* \brief Source code for the FrameRate class
|
|
* \author Copyright (c) 2011 Jonathan Thomas
|
|
*/
|
|
|
|
#include "../include/FrameRate.h"
|
|
|
|
using namespace openshot;
|
|
|
|
Framerate::Framerate(int numerator, int denominator) {
|
|
m_numerator = numerator;
|
|
m_denominator = denominator;
|
|
}
|
|
|
|
Framerate::Framerate() {
|
|
m_numerator = 24;
|
|
m_denominator = 1;
|
|
}
|
|
|
|
// Return a rounded integer of the frame rate (for example 30000/1001 returns 30 fps)
|
|
int Framerate::GetRoundedFPS() {
|
|
return round((float) m_numerator / m_denominator);
|
|
}
|
|
|
|
// Return a float of the frame rate (for example 30000/1001 returns 29.97...)
|
|
float Framerate::GetFPS() {
|
|
return (float) m_numerator / m_denominator;
|
|
}
|
|
|
|
// Return a Fraction of the framerate
|
|
Fraction Framerate::GetFraction()
|
|
{
|
|
return Fraction(m_numerator, m_denominator);
|
|
}
|