Open Reality Reference Guide
fbtime.h
Go to the documentation of this file.
1#ifndef __FBTIME_H__
2#define __FBTIME_H__
3/**************************************************************************
4 Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
5 All Rights Reserved.
6
7 The coded instructions, statements, computer programs, and/or related
8 material (collectively the "Data") in these files contain unpublished
9 information proprietary to Autodesk, Inc. and/or its licensors, which is
10 protected by Canada and United States of America federal copyright law
11 and by international treaties.
12
13 The Data may not be disclosed or distributed to third parties, in whole
14 or in part, without the prior written consent of Autodesk, Inc.
15 ("Autodesk").
16
17 THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
18 ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
19 WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR
20 ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES
21 OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
22 PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT
23 WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR
24 FREE.
25
26 IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
27 OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR
28 EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE
29 DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS
30 OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR
31 DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF
32 LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT
33 LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE
34 DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS
35 BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
36
37**************************************************************************/
38
43#include <kaydaradef.h>
44
45#ifndef FBSDK_DLL
49 #define FBSDK_DLL K_DLLIMPORT
50#endif
51
52#include <fbsdk/fbstring.h>
53
54#ifdef FBSDKUseNamespace
55 namespace FBSDKNamespace {
56#endif
57
59// FBTime
61
82};
83
85
88{
89 private:
90 kLongLong mTime;
91 public:
92
95 {
98 eDefaultFormat
99 };
100
101 /* Constructor.
102 * \param pTime Time to initialize with(default=0).
103 */
104 FBTime( kLongLong pTime=0);
105
114 FBTime (int pHour,int pMinute,int pSecond=0,int pFrame=0,int pField=0, FBTimeMode pTimeMode=kFBTimeModeDefault);
115
122
126 void SetTimeString(const char *pTime);
127
138 bool GetTime(int &pHour, int &pMinute, int &pSecond, int &pFrame, int &pField, int &pMilliSecond, FBTimeMode pTimeMode=kFBTimeModeDefault );
142 kLongLong GetMilliSeconds();
143
147 void SetMilliSeconds(kLongLong pMilliSeconds);
148
152 kLongLong& Get();
153
157 const kLongLong& Get() const;
158
162 void Set( kLongLong pTime );
163
168
172 void SetSecondDouble(double pTime);
173
182 void SetTime (int pHour,int pMinute=0,int pSecond=0,int pFrame=0,int pField=0, FBTimeMode pTimeMode=kFBTimeModeDefault);
183
185
189 FBTime& operator= (const FBTime& pTime);
190 FBTime& operator+= (const FBTime& pTime);
191 FBTime& operator-= (const FBTime& pTime);
192 FBTime& operator*= (const FBTime& pTime);
193 FBTime& operator/= (const FBTime& pTime);
195
197
201 FBTime& operator= (double pConstant);
202 FBTime& operator+= (double pConstant);
203 FBTime& operator-= (double pConstant);
204 FBTime& operator*= (double pConstant);
205 FBTime& operator/= (double pConstant);
207
209
213 FBTime operator- (const FBTime &pTime);
214 FBTime operator+ (const FBTime &pTime);
215 FBTime operator/ (const FBTime &pTime);
216 FBTime operator* (const FBTime &pTime);
218
220
224 FBTime operator- (double pConstant);
225 FBTime operator+ (double pConstant);
226 FBTime operator/ (double pConstant);
227 FBTime operator* (double pConstant);
229
231
235 bool operator== (const FBTime& pTime);
236 bool operator!= (const FBTime& pTime);
237 bool operator>= (const FBTime& pTime);
238 bool operator<= (const FBTime& pTime);
239 bool operator> (const FBTime& pTime);
240 bool operator< (const FBTime& pTime);
242
249
254 void SetFrame(kLongLong pFrames, FBTimeMode pTimeMode=kFBTimeModeDefault);
255
257 static const FBTime Infinity;
258
260 static const FBTime MinusInfinity;
261
263 static const FBTime Zero;
264
266 static const FBTime Epsilon;
267
269 static const FBTime OneSecond;
270
272 static const FBTime OneMinute;
273
275 static const FBTime OneHour;
276};
277
279
282{
283 private:
284 double mSecond;
285 double mFrame;
286 double mRate;
287 public:
288
292 FBTimeCode(float pRate=FRAMES_30);
293
300 void SetTimeCode(int pHour,int pMinute=0,int pSecond=0,float pFrame=0);
301
307
313
317
321 void SetTime(FBTime pTime);
322
325 double GetFrame() const;
326
330 void SetFrame(double pFrame);
331
334 float GetFrameRate() const;
335
339 double GetRawSecond() const;
340
344 double GetRawFrame() const;
345
349 double GetRawRate() const;
350
355 bool operator==(const FBTimeCode& pTimeCode)const;
356
361 bool operator!=(const FBTimeCode& pTimeCode)const;
362
363
365 static const float NTSC_DROP;
366 static const float NTSC_FULL;
367 static const float PAL_25;
368 static const float MPAL_30;
369 static const float FILM_24;
370 static const float FILM_23976;
371 static const float FRAMES_30;
372 static const float FRAMES_5994;
373 static const float FRAMES_11988;
374};
375
377// FBTimeSpan
379
381
384{
385 private:
386 FBTime mStart;
387 FBTime mStop;
388 public:
393 FBTimeSpan( FBTime pStart=0,FBTime pStop=0);
394
396
400 FBTime& GetStop();
401 const FBTime& GetStart() const;
402 const FBTime& GetStop() const;
404
409 void Set( FBTime pStart, FBTime pStop );
410
415
420
426
431 bool operator& (FBTime &pTime);
432
436 FBTimeSpan operator& (FBTimeSpan &pTimeSpan);
437};
439// Global
441#ifdef FBSDKUseNamespace
442 }
443#endif
444
445#endif
446
Basic string class.
Definition: fbstring.h:67
TimeCode data structure.
Definition: fbtime.h:282
FBTime GetTime() const
Return a Time corresponding to the timecode.
static const float PAL_25
-25.0f
Definition: fbtime.h:367
double GetFrame() const
Return a frame number corresponding to the timecode.
bool operator==(const FBTimeCode &pTimeCode) const
Equality operator.
void SetFrame(double pFrame)
Set Frame according to the given time.
static const float FILM_23976
-23.976f
Definition: fbtime.h:370
void SetTimeCodeString(const char *pTime, FBTime::ETimeFormats pFormat=FBTime::eDefaultFormat)
Set time from string.
static const float NTSC_DROP
Rates.
Definition: fbtime.h:365
double GetRawSecond() const
Get the raw value for the second.
FBTimeCode(float pRate=FRAMES_30)
Constructor.
void SetTimeCode(int pHour, int pMinute=0, int pSecond=0, float pFrame=0)
Set timecode.
static const float MPAL_30
-29.971f Currently not supported : "1" is added just to differentiate from NTSC_FULL(-29....
Definition: fbtime.h:368
static const float FILM_24
-24.0f
Definition: fbtime.h:369
float GetFrameRate() const
Return the rate of the timecode.
double GetRawRate() const
Get the raw value for the rate.
static const float NTSC_FULL
-29.97f
Definition: fbtime.h:366
static const float FRAMES_30
-30.0f
Definition: fbtime.h:371
static const float FRAMES_5994
-59.94f
Definition: fbtime.h:372
FBString GetTimeCodeString(FBTime::ETimeFormats pFormat=FBTime::eDefaultFormat)
Get time as a string.
void SetTime(FBTime pTime)
Set TimeCode according to the given time.
bool operator!=(const FBTimeCode &pTimeCode) const
Inequality operator.
double GetRawFrame() const
Get the raw value for the frame.
static const float FRAMES_11988
-119.88f
Definition: fbtime.h:373
Time data structure.
Definition: fbtime.h:88
static const FBTime Infinity
Time constant: Infinity, the largest time value.
Definition: fbtime.h:257
void SetTimeString(const char *pTime)
Set time from string.
ETimeFormats
Different time format available.
Definition: fbtime.h:95
@ eDefaultFormat
Default Time format.
Definition: fbtime.h:98
@ eSMPTE
format as SMPTE
Definition: fbtime.h:96
@ eFrame
format as numeric frame
Definition: fbtime.h:97
double GetSecondDouble()
Get seconds as double.
static const FBTime OneHour
Time constant: One Hour.
Definition: fbtime.h:275
kLongLong GetMilliSeconds()
Get milliseconds for time.
const kLongLong & Get() const
Get time value (long)
kLongLong GetFrame(FBTimeMode pTimeMode=kFBTimeModeDefault)
Get the frame count.
static const FBTime OneMinute
Time constant: One Minute.
Definition: fbtime.h:272
bool GetTime(int &pHour, int &pMinute, int &pSecond, int &pFrame, int &pField, int &pMilliSecond, FBTimeMode pTimeMode=kFBTimeModeDefault)
Get time (filling separate values)
void SetFrame(kLongLong pFrames, FBTimeMode pTimeMode=kFBTimeModeDefault)
Set time in frame format.
static const FBTime Epsilon
Time constant: Epsilon, the smallest time increment.
Definition: fbtime.h:266
void SetMilliSeconds(kLongLong pMilliSeconds)
Set milliseconds time.
static const FBTime MinusInfinity
Time constant: Minus Infinity, the lowest negative time value.
Definition: fbtime.h:260
void Set(kLongLong pTime)
Set time value from a long.
static const FBTime Zero
Time constant: Zero.
Definition: fbtime.h:263
FBTime(int pHour, int pMinute, int pSecond=0, int pFrame=0, int pField=0, FBTimeMode pTimeMode=kFBTimeModeDefault)
Constructor.
kLongLong & Get()
Get time value (long)
void SetSecondDouble(double pTime)
Set seconds from double.
FBString GetTimeString(FBTimeMode pMode=kFBTimeModeDefault, ETimeFormats pFormat=eDefaultFormat)
Get time as a string.
static const FBTime OneSecond
Time constant: One Second.
Definition: fbtime.h:269
void SetTime(int pHour, int pMinute=0, int pSecond=0, int pFrame=0, int pField=0, FBTimeMode pTimeMode=kFBTimeModeDefault)
Set time (from separate values)
TimeSpan class.
Definition: fbtime.h:384
void Set(FBTime pStart, FBTime pStop)
Set the TimeSpan.
FBTimeSpan(FBTime pStart=0, FBTime pStop=0)
Constructor.
FBTime GetSignedDuration()
Get the signed duration value of a timespan.
FBTime GetDuration()
Get the unsigned duration value of a timespan.
int GetDirection()
Get the direction of the timespan.
FBTime & GetStart()
Get the start/stop time.
String class.
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
Definition: fbtime.h:49
FBTimeMode
Different time modes available.
Definition: fbtime.h:63
@ kFBTimeMode2997Frames_Drop
~29.97 drop
Definition: fbtime.h:76
@ kFBTimeMode30Frames
30
Definition: fbtime.h:75
@ kFBTimeMode11988Frames
~119.88
Definition: fbtime.h:67
@ kFBTimeMode50Frames
50
Definition: fbtime.h:73
@ kFBTimeMode100Frames
100
Definition: fbtime.h:68
@ kFBTimeModeCustom
Custom framerate.
Definition: fbtime.h:81
@ kFBTimeMode25Frames
25
Definition: fbtime.h:78
@ kFBTimeMode72Frames
72
Definition: fbtime.h:70
@ kFBTimeMode1000Frames
1000 : 1 millisecond
Definition: fbtime.h:65
@ kFBTimeMode5994Frames
~59.94
Definition: fbtime.h:72
@ kFBTimeMode24Frames
24
Definition: fbtime.h:79
@ kFBTimeMode96Frames
96
Definition: fbtime.h:69
@ kFBTimeMode60Frames
60
Definition: fbtime.h:71
@ kFBTimeMode2997Frames
~29.97 full
Definition: fbtime.h:77
@ kFBTimeMode23976Frames
~23.976
Definition: fbtime.h:80
@ kFBTimeModeDefault
Default Time Mode.
Definition: fbtime.h:64
@ kFBTimeMode120Frames
120
Definition: fbtime.h:66
@ kFBTimeMode48Frames
48
Definition: fbtime.h:74
#define FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:62