@author Jason Wood
*/
-class Timecode {
- public:
+class Timecode
+{
+public:
enum Formats { HH_MM_SS_FF, HH_MM_SS_HH, Frames, Seconds };
- Timecode(Formats format = HH_MM_SS_FF, int framesPerSecond =
- 25, bool dropFrame = false);
+ explicit Timecode(Formats format = HH_MM_SS_FF, double framesPerSecond =
+ 25, bool dropFrame = false);
- /** Set the current timecode format; this is the output format for this timecode. */
- void setFormat(int framesPerSecond, bool dropFrame = false, Formats format = HH_MM_SS_FF) {
- m_displayedFramesPerSecond = framesPerSecond;
- m_dropFrame = dropFrame;
- m_format = format;
- }
+ /** Set the current timecode format; this is the output format for this timecode. */
+ void setFormat(double framesPerSecond, bool dropFrame = false, Formats format = HH_MM_SS_FF) {
+ m_displayedFramesPerSecond = (int)(framesPerSecond + 0.5);
+ m_dropFrame = dropFrame;
+ m_format = format;
+ m_realFps = framesPerSecond;
+ }
Formats format() const {
- return m_format;
- }
+ return m_format;
+ }
~Timecode();
- /** Returns the timecode for a given time */
- QString getTimecode(const GenTime & time, double fps) const;
- int getFrameCount(const QString duration, double fps) const;
+ /** Returns the timecode for a given time */
+ QString getDisplayTimecode(const GenTime & time, bool frameDisplay) const;
+ QString getTimecode(const GenTime & time) const;
+ int getDisplayFrameCount(const QString duration, bool frameDisplay) const;
+ int getFrameCount(const QString duration) const;
static QString getEasyTimecode(const GenTime & time, const double &fps);
- QString getTimecodeFromFrames(int frames);
+ static QString getStringTimecode(int frames, const double &fps);
+ const QString getDisplayTimecodeFromFrames(int frames, bool frameDisplay) const;
+ const QString getTimecodeFromFrames(int frames) const;
+ double fps() const;
+ bool df() const;
+ QString inputMask() const;
+ QString reformatSeparators(QString duration) const;
- private:
+private:
Formats m_format;
bool m_dropFrame;
int m_displayedFramesPerSecond;
+ double m_realFps;
+
+ const QString getTimecodeHH_MM_SS_FF(const GenTime & time) const;
+ const QString getTimecodeHH_MM_SS_FF(int frames) const;
- QString getTimecodeHH_MM_SS_FF(const GenTime & time, double fps) const;
- QString getTimecodeHH_MM_SS_FF(int frames) const;
QString getTimecodeHH_MM_SS_HH(const GenTime & time) const;
- QString getTimecodeFrames(const GenTime & time, double fps) const;
+ QString getTimecodeFrames(const GenTime & time) const;
QString getTimecodeSeconds(const GenTime & time) const;
- QString getTimecodeDropFrame(const GenTime & time, double fps) const;
+ QString getTimecodeDropFrame(const GenTime & time) const;
+ QString getTimecodeDropFrame(int frames) const;
};
#endif