40 using boost::lexical_cast;
56 const FrameCnt MAX_FRAME = 265*24*60*60*25;
59 generateRandomFrameNr()
63 frameNr = rand() % (2*MAX_FRAME) - MAX_FRAME;
65 return toString(frameNr)+
"#";
108 string srcCode = generateRandomFrameNr();
132 CHECK (5 == frames2 - frames1);
137 CHECK (srcCode ==
string(frames1));
138 CHECK (srcCode !=
string(frames2));
140 showTimeCode (frames1);
141 showTimeCode (frames2);
148 showTimeCode (TC timecode)
150 cout << timecode.describe()<<
"=\""<<timecode<<
"\" time = "<< timecode.getTime() << endl;
156 UNIMPLEMENTED (
"verify frame count time format");
163 UNIMPLEMENTED (
"verify fractional seconds as timecode format");
170 UNIMPLEMENTED (
"verify hour-minutes-seconds-millis timecode");
187 Time raw(555,23,42,5);
191 cout <<
"----SMPTE-----" << endl;
193 CHECK (
" 5:42:23:13" ==
string(smpte));
194 CHECK (raw -
Time(35,0) == smpte.getTime());
195 CHECK (13 == smpte.frames);
196 CHECK (23 == smpte.secs);
197 CHECK (42 == smpte.mins);
198 CHECK ( 5 == smpte.hours);
199 CHECK ( 1 == smpte.sgn);
200 CHECK (
"SMPTE" == smpte.describe());
203 CHECK (
" 5:42:23:14" ==
string(smpte));
205 CHECK (
" 5:42:24:01" ==
string(smpte));
207 CHECK (
" 5:40:00:01" ==
string(smpte));
208 CHECK (smpte.mins-- == 40);
209 CHECK (--smpte.mins == 38);
210 CHECK (
" 5:38:00:01" ==
string(smpte));
217 CHECK (
"- 0:21:59:24"==
string(smpte));
218 CHECK (tx -
Time(0,0,0,6) == smpte.getTime());
220 CHECK (-1 == smpte.sgn);
221 CHECK (smpte.mins > 0);
222 CHECK (smpte.secs > 0);
223 CHECK (smpte.frames > 0);
224 tx = smpte.getTime();
226 CHECK (
"- 0:22:00:00"==
string(smpte));
227 CHECK (smpte.getTime() == tx -
Time(1000/25,0,0,0));
229 CHECK (
"- 0:21:59:24"==
string(smpte));
230 CHECK (tx == smpte.getTime());
234 CHECK (
" 1:38:00:01"==
string(smpte));
235 CHECK (+1 == smpte.sgn);
236 CHECK (smpte.getTime() > 0);
237 CHECK (tx +
Time(0,0,0,2) == smpte.getTime());
238 smpte.secs -= 2*60*60;
239 CHECK (tx == smpte.getTime());
240 CHECK (
"- 0:21:59:24"==
string(smpte));
243 CHECK (
" 0:21:59:24"==
string(smpte));
244 CHECK (tx == -smpte.getTime());
245 CHECK (+1 == smpte.sgn);
247 smpte.secs.setValueRaw(61);
248 CHECK (smpte.secs == 61);
249 CHECK (smpte.getTime() ==
Time(1000*24/25, 01, 22));
250 CHECK (smpte.secs == 61);
251 CHECK (
" 0:21:61:24"==
string(smpte));
253 CHECK (smpte.secs == 1);
254 CHECK (smpte.mins == 22);
255 CHECK (
" 0:22:01:24"==
string(smpte));
257 smpte.frames.setValueRaw (25);
258 CHECK (
" 0:22:01:25"==
string(smpte));
260 CHECK (
"- 0:37:58:00"==
string(smpte));
262 smpte.mins.setValueRaw (59);
263 smpte.secs.setValueRaw (61);
264 smpte.frames.setValueRaw(-26);
265 smpte.hours.setValueRaw (-2);
266 CHECK (
"--2:59:61:-26"==
string(smpte));
267 tx = smpte.getTime();
269 smpte.invertOrientation();
270 CHECK (
" 1:00:00:01"==
string(smpte));
271 CHECK (tx == smpte.getTime());
273 smpte.frames.setValueRaw(-1);
275 CHECK (tx == smpte.getTime());
276 CHECK (
" 1:00:00:-1"==
string(smpte));
277 smpte.invertOrientation();
278 CHECK (
"--1:00:00:01"==
string(smpte));
279 CHECK (tx == smpte.getTime());
286 UNIMPLEMENTED (
"verify especially SMPTE-drop-frame timecode");
291 checkCopyAssignments ()
293 UNIMPLEMENTED (
"verify Timecode values can be copied and assigned properly");
a mutable time value, behaving like a plain number, allowing copy and re-accessing ...
Classical Timecode value reminiscent to SMPTE format.
Modifying time and timecode values.
static PQuant retrieve(Symbol gridID)
Access an existing grid definition or quantiser, known by the given symbolic ID.
static EncapsulatedMutation changeTime(Time)
Convenience factory to yield a simple Mutation changing the absolute start time.
void accept(Mutation const &)
receive change message, which might cause re-quantisation
Implementation namespace for support and library code.
Lumiera's internal time value datatype.
format::Traits< FMT >::TimeCode formatAs() const
create new time code instance, then castInto
Timecode handling library This header defines the foundation interface TCode to represent a grid alig...
Simple test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
boost::rational< int64_t > FSecs
rational representation of fractional seconds
Support library to represent grid-aligned time specifications This is part of Lumiera's time and time...
To establish a reference scale for quantised time values.
static EncapsulatedMutation nudge(int adjustment)
build a time mutation to nudge the target time value by an offset, defined as number of steps on an i...
int64_t FrameCnt
relative framecount or frame number.
A frame counting timecode value.
basic constant internal time value.
static const FrameRate PAL
predefined constant for PAL framerate
grid aligned time specification, referring to a specific scale.