]> git.sesse.net Git - kdenlive/blobdiff - src/timecode.cpp
Treat 23.97 fps as 24 fps (don't know if it's correct but anyways better than 23fps...
[kdenlive] / src / timecode.cpp
index cc429252ca8eace7a3c3d5237a6b0adbae2c638a..244079a0790c834e7fa874d31babcad447da8b27 100644 (file)
@@ -22,7 +22,7 @@
 Timecode::Timecode(Formats format, int framesPerSecond, bool dropFrame) :
         m_format(format),
         m_dropFrame(dropFrame),
-        m_displayedFramesPerSecond(framesPerSecond)
+        m_displayedFramesPerSecond(framesPerSecond + 0.5)
 {
 }
 
@@ -30,7 +30,7 @@ Timecode::~Timecode()
 {
 }
 
-int Timecode::fps()
+int Timecode::fps() const
 {
     return m_displayedFramesPerSecond;
 }
@@ -91,7 +91,7 @@ QString Timecode::getTimecode(const GenTime & time, double fps) const
     }
 }
 
-QString Timecode::getTimecodeFromFrames(int frames)
+QString Timecode::getTimecodeFromFrames(int frames) const
 {
     return getTimecodeHH_MM_SS_FF(frames);
 }
@@ -167,7 +167,7 @@ QString Timecode::getTimecodeHH_MM_SS_FF(const GenTime & time, double fps) const
     if (m_dropFrame)
         return getTimecodeDropFrame(time, fps);
 
-    return getTimecodeHH_MM_SS_FF((int)time.frames(fps));
+    return getTimecodeHH_MM_SS_FF((int)(time.frames(fps) + 0.5));
 }
 
 QString Timecode::getTimecodeHH_MM_SS_FF(int frames) const