Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
timecode.hpp
Go to the documentation of this file.
1/*
2 TIMECODE.hpp - grid aligned and fixed format time specifications
3
4 Copyright (C)
5 2010, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12*/
13
14
27#ifndef LIB_TIME_TIMECODE_H
28#define LIB_TIME_TIMECODE_H
29
31#include "lib/time/formats.hpp"
32#include "lib/time/digxel.hpp"
33#include "lib/symbol.hpp"
34
35#include <boost/operators.hpp>
36#include <boost/lexical_cast.hpp>
37#include <string>
38
39
40namespace lib {
41namespace time {
42
43 using std::string;
44 using lib::Literal;
45 using boost::lexical_cast;
46
47
56 class TCode
57 {
58
59 public:
60 virtual ~TCode() { }
61
62 operator string() const { return show(); }
63 string describe() const { return string(tcID()); }
64 Time getTime() const { return Time(value()); }
65
66 protected:
67 TCode (PQuant const& quant)
68 : quantiser_(quant)
69 { }
70
71 virtual string show() const =0;
72 virtual Literal tcID() const =0;
73 virtual TimeValue value() const =0;
74
75 protected:
77 };
78
79
80 class QuTime;
81
96 class FrameNr
97 : public TCode
98 , public CountVal
99 {
100
101 string show() const { return string(CountVal::show())+"#"; }
102 Literal tcID() const { return "Framecount"; }
103 TimeValue value() const { return Format::evaluate (*this, *quantiser_); }
104
105 public:
107
108 FrameNr (QuTime const& quantisedTime);
109
111 static FrameCnt quant (Time const&, Symbol gridID);// defined in common-services.cpp
112
113 using TCode::operator string;
114 // CountVal implicitly convertible to long ///////////TICKET #882 : outch! should be a 64bit type!
115 };
116
117
118
145 : public TCode
146 , boost::unit_steppable<SmpteTC>
147 {
149
150 virtual string show() const ;
151 virtual Literal tcID() const { return "SMPTE"; }
152 virtual TimeValue value() const { return Format::evaluate (*this, *quantiser_); }
153
154
155 public:
157
158 SmpteTC (QuTime const& quantisedTime);
159 SmpteTC (SmpteTC const&);
160 SmpteTC& operator= (SmpteTC const&);
161
162 uint getFps() const;
163
164 void clear();
165 void rebuild();
166 void invertOrientation();
167
168
174
177 };
178
179
180
189 class HmsTC
190 : public TCode
191 {
193
194 virtual string show() const { return string(tpoint_); }
195 virtual Literal tcID() const { return "Timecode"; }
196 virtual TimeValue value() const { return tpoint_; }
197
198 public:
200
201 HmsTC (QuTime const& quantisedTime);
202
204 double getMillis () const;
205 int getSecs () const;
206 int getMins () const;
207 int getHours () const;
208 };
209
210
211
215 class Secs
216 : public TCode
217 {
219
220 virtual string show() const { return string(Time(sec_)); }
221 virtual Literal tcID() const { return "Seconds"; }
222 virtual TimeValue value() const { return Time(sec_); }
223
224 public:
226
227 Secs (QuTime const& quantisedTime);
228
229 operator FSecs() const;
230 };
231
232
237}} // lib::time
238#endif
Inline string literal.
Definition symbol.hpp:78
Token or Atom with distinct identity.
Definition symbol.hpp:120
A number element for building structured numeric displays.
Definition digxel.hpp:217
digxel::CBuf show() const
Definition digxel.hpp:262
A frame counting timecode value.
Definition timecode.hpp:99
TimeValue value() const
Definition timecode.hpp:103
string show() const
Definition timecode.hpp:101
Literal tcID() const
Definition timecode.hpp:102
static FrameCnt quant(Time const &, Symbol gridID)
convenience shortcut: time grid to frame number
double getMillis() const
Definition timecode.cpp:473
virtual string show() const
Definition timecode.hpp:194
virtual TimeValue value() const
Definition timecode.hpp:196
int getMins() const
Definition timecode.cpp:459
int getSecs() const
Definition timecode.cpp:452
virtual Literal tcID() const
Definition timecode.hpp:195
int getHours() const
Definition timecode.cpp:466
grid aligned time specification, referring to a specific scale.
Definition timequant.hpp:91
virtual string show() const
Definition timecode.hpp:220
virtual TimeValue value() const
Definition timecode.hpp:222
virtual Literal tcID() const
Definition timecode.hpp:221
special Digxel to show a sign.
Definition digxel.hpp:318
Classical Timecode value reminiscent to SMPTE format.
Definition timecode.hpp:147
SmpteTC & operator++()
Definition timecode.cpp:432
virtual string show() const
Definition timecode.cpp:416
void invertOrientation()
flip the orientation of min, sec, and frames.
Definition timecode.cpp:388
virtual TimeValue value() const
Definition timecode.hpp:152
SmpteTC & operator--()
Definition timecode.cpp:439
uint getFps() const
Definition timecode.cpp:409
virtual Literal tcID() const
Definition timecode.hpp:151
SmpteTC & operator=(SmpteTC const &)
Definition timecode.cpp:326
Interface: fixed format timecode specification.
Definition timecode.hpp:57
Time getTime() const
Definition timecode.hpp:64
virtual ~TCode()
Definition timecode.hpp:60
virtual string show() const =0
string describe() const
Definition timecode.hpp:63
virtual Literal tcID() const =0
TCode(PQuant const &quant)
Definition timecode.hpp:67
virtual TimeValue value() const =0
basic constant internal time value.
a mutable time value, behaving like a plain number, allowing copy and re-accessing
Lumiera's internal time value datatype.
A self-contained numeric element for building structured numeric displays.
Definition of time code formats This header is part of the Lumiera time and timecode handling library...
unsigned int uint
Definition integral.hpp:29
int64_t FrameCnt
relative framecount or frame number.
Definition digxel.hpp:310
std::shared_ptr< const Quantiser > PQuant
Definition formats.hpp:58
boost::rational< int64_t > FSecs
rational representation of fractional seconds
Implementation namespace for support and library code.
Frame count as timecode format.
Definition formats.hpp:77
static TimeValue evaluate(FrameNr const &, QuantR)
calculate the time point denoted by this frame count
Definition timecode.cpp:157
The informal hours-minutes-seconds-millisecond timecode.
Definition formats.hpp:110
Simple timecode specification as fractional seconds.
Definition formats.hpp:128
Widely used standard media timecode format.
Definition formats.hpp:92
static TimeValue evaluate(SmpteTC const &, QuantR)
calculate the time point denoted by this SMPTE timecode, by summing up the timecode's components
Definition timecode.cpp:178
Marker types to indicate a literal string and a Symbol.
a family of time value like entities and their relationships.