1 /***************************************************************************
4 begin : Wed Dec 17 2003
5 copyright : (C) 2003 by Jason Wood
6 email : jasonwood@blueyonder.co.uk
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
25 Handles the conversion of a GenTime into a nicely formatted string, taking into account things such as drop frame if necessary. Handles multiple formats, such as HH:MM:SS:FF, HH:MM:SS:F, All Frames, All Seconds, etc.
31 enum Formats { HH_MM_SS_FF, HH_MM_SS_HH, Frames, Seconds };
33 Timecode(Formats format = HH_MM_SS_FF, int framesPerSecond =
34 25, bool dropFrame = false);
36 /** Set the current timecode format; this is the output format for this timecode. */
37 void setFormat(int framesPerSecond, bool dropFrame = false, Formats format = HH_MM_SS_FF) {
38 m_displayedFramesPerSecond = framesPerSecond;
39 m_dropFrame = dropFrame;
43 Formats format() const {
49 /** Returns the timecode for a given time */
50 QString getTimecode(const GenTime & time, double fps) const;
51 int getFrameCount(const QString duration, double fps) const;
52 static QString getEasyTimecode(const GenTime & time, const double &fps);
53 QString getTimecodeFromFrames(int frames);
59 int m_displayedFramesPerSecond;
61 QString getTimecodeHH_MM_SS_FF(const GenTime & time, double fps) const;
62 QString getTimecodeHH_MM_SS_FF(int frames) const;
63 QString getTimecodeHH_MM_SS_HH(const GenTime & time) const;
64 QString getTimecodeFrames(const GenTime & time, double fps) const;
65 QString getTimecodeSeconds(const GenTime & time) const;
66 QString getTimecodeDropFrame(const GenTime & time, double fps) const;