m_format(format),
m_dropFrame(dropFrame),
m_displayedFramesPerSecond(framesPerSecond + 0.5),
- m_realFps(framesPerSecond)
+ m_realFps(framesPerSecond)
{
}
{
}
-int Timecode::fps() const
+double Timecode::fps() const
{
- return m_displayedFramesPerSecond;
+ return m_realFps; //m_displayedFramesPerSecond;
}
+int Timecode::getDisplayFrameCount(const QString duration, bool frameDisplay) const
+{
+ if (frameDisplay) return duration.toInt();
+ return getFrameCount(duration);
+}
+
int Timecode::getFrameCount(const QString duration) const
{
if (m_dropFrame) {
return (int)((duration.section(':', 0, 0).toInt()*3600.0 + duration.section(':', 1, 1).toInt()*60.0 + duration.section(':', 2, 2).toInt()) * m_realFps + duration.section(':', 3, 3).toInt());
}
+QString Timecode::getDisplayTimecode(const GenTime & time, bool frameDisplay) const
+{
+ if (frameDisplay) return QString::number((int) time.frames(m_realFps));
+ return getTimecode(time);
+}
+
QString Timecode::getTimecode(const GenTime & time) const
{
switch (m_format) {
}
}
-QString Timecode::getTimecodeFromFrames(int frames) const
+const QString Timecode::getDisplayTimecodeFromFrames(int frames, bool frameDisplay) const
+{
+ if (frameDisplay) return QString::number(frames);
+ return getTimecodeHH_MM_SS_FF(frames);
+}
+
+const QString Timecode::getTimecodeFromFrames(int frames) const
{
return getTimecodeHH_MM_SS_FF(frames);
}
QString Timecode::getStringTimecode(int frames, const double &fps)
{
// Returns the timecode in an hh:mm:ss format
- int seconds = frames / (int) floor(fps + 0.5);
+ int seconds = (int)(frames / fps);
int minutes = seconds / 60;
seconds = seconds % 60;
int hours = minutes / 60;
QString Timecode::getEasyTimecode(const GenTime & time, const double &fps)
{
// Returns the timecode in an easily read display, like 3 min. 5 sec.
- int frames = (int)time.frames(fps);
- int seconds = frames / (int) floor(fps + 0.5);
- frames = frames % ((int) fps);
+ int frames = (int) time.frames(fps);
+ int seconds = (int)(frames / fps);
+ frames = frames - ((int)(fps * seconds));
int minutes = seconds / 60;
seconds = seconds % 60;
}
-QString Timecode::getTimecodeHH_MM_SS_FF(const GenTime & time) const
+const QString Timecode::getTimecodeHH_MM_SS_FF(const GenTime & time) const
{
if (m_dropFrame)
return getTimecodeDropFrame(time);
return getTimecodeHH_MM_SS_FF((int) time.frames(m_realFps));
}
-QString Timecode::getTimecodeHH_MM_SS_FF(int frames) const
+const QString Timecode::getTimecodeHH_MM_SS_FF(int frames) const
{
if (m_dropFrame) {
- return getTimecodeDropFrame(frames);
+ return getTimecodeDropFrame(frames);
}
int seconds = frames / m_displayedFramesPerSecond;
frames = frames % m_displayedFramesPerSecond;
// calculate how many frames need to be dropped every minute.
int toDrop = (int) floor(600.0 * (m_displayedFramesPerSecond - m_realFps) + 0.5);
-
+
int perMinute = toDrop / 9;
int tenthMinute = toDrop % 9;