Open Reality Reference Guide
 
Loading...
Searching...
No Matches
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 );
139
143 kLongLong GetMilliSeconds();
144
148 void SetMilliSeconds(kLongLong pMilliSeconds);
149
153 kLongLong& Get();
154
158 const kLongLong& Get() const;
159
163 void Set( kLongLong pTime );
164
169
173 void SetSecondDouble(double pTime);
174
183 void SetTime (int pHour,int pMinute=0,int pSecond=0,int pFrame=0,int pField=0, FBTimeMode pTimeMode=kFBTimeModeDefault);
184
209
211
215 FBTime& operator= (const FBTime& pTime);
216 FBTime& operator+= (const FBTime& pTime);
217 FBTime& operator-= (const FBTime& pTime);
218 FBTime& operator*= (const FBTime& pTime);
219 FBTime& operator/= (const FBTime& pTime);
221
223
227 FBTime& operator= (double pConstant);
228 FBTime& operator+= (double pConstant);
229 FBTime& operator-= (double pConstant);
230 FBTime& operator*= (double pConstant);
231 FBTime& operator/= (double pConstant);
233
235
239 FBTime operator- (const FBTime &pTime);
240 FBTime operator+ (const FBTime &pTime);
241 FBTime operator/ (const FBTime &pTime);
242 FBTime operator* (const FBTime &pTime);
244
246
250 FBTime operator- (double pConstant);
251 FBTime operator+ (double pConstant);
252 FBTime operator/ (double pConstant);
253 FBTime operator* (double pConstant);
255
257
261 bool operator== (const FBTime& pTime);
262 bool operator!= (const FBTime& pTime);
263 bool operator>= (const FBTime& pTime);
264 bool operator<= (const FBTime& pTime);
265 bool operator> (const FBTime& pTime);
266 bool operator< (const FBTime& pTime);
268
275
280 void SetFrame(kLongLong pFrames, FBTimeMode pTimeMode=kFBTimeModeDefault);
281
283 static const FBTime Infinity;
284
286 static const FBTime MinusInfinity;
287
289 static const FBTime Zero;
290
292 static const FBTime Epsilon;
293
295 static const FBTime OneSecond;
296
298 static const FBTime OneMinute;
299
301 static const FBTime OneHour;
302};
303
305
308{
309 private:
310 double mSecond;
311 double mFrame;
312 double mRate;
313 public:
314
318 FBTimeCode(float pRate=FRAMES_30);
319
326 void SetTimeCode(int pHour,int pMinute=0,int pSecond=0,float pFrame=0);
327
333
339
343
347 void SetTime(FBTime pTime);
348
351 double GetFrame() const;
352
356 void SetFrame(double pFrame);
357
360 float GetFrameRate() const;
361
365 double GetRawSecond() const;
366
370 double GetRawFrame() const;
371
375 double GetRawRate() const;
376
381 bool operator==(const FBTimeCode& pTimeCode)const;
382
387 bool operator!=(const FBTimeCode& pTimeCode)const;
388
389
391 static const float NTSC_DROP;
392 static const float NTSC_FULL;
393 static const float PAL_25;
394 static const float MPAL_30;
395 static const float FILM_24;
396 static const float FILM_23976;
397 static const float FRAMES_30;
398 static const float FRAMES_5994;
399 static const float FRAMES_11988;
400};
401
403// FBTimeSpan
405
407
410{
411 private:
412 FBTime mStart;
413 FBTime mStop;
414 public:
419 FBTimeSpan( FBTime pStart=0,FBTime pStop=0);
420
422
426 FBTime& GetStop();
427 const FBTime& GetStart() const;
428 const FBTime& GetStop() const;
430
435 void Set( FBTime pStart, FBTime pStop );
436
441
446
452
457 bool operator& (FBTime &pTime);
458
462 FBTimeSpan operator& (FBTimeSpan &pTimeSpan);
463};
465// Global
467#ifdef FBSDKUseNamespace
468 }
469#endif
470
471#endif
472
Basic string class.
Definition fbstring.h:67
TimeCode data structure.
Definition fbtime.h:308
FBTime GetTime() const
Return a Time corresponding to the timecode.
static const float PAL_25
-25.0f
Definition fbtime.h:393
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:396
void SetTimeCodeString(const char *pTime, FBTime::ETimeFormats pFormat=FBTime::eDefaultFormat)
Set time from string.
static const float NTSC_DROP
Rates.
Definition fbtime.h:391
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:394
static const float FILM_24
-24.0f
Definition fbtime.h:395
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:392
static const float FRAMES_30
-30.0f
Definition fbtime.h:397
static const float FRAMES_5994
-59.94f
Definition fbtime.h:398
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:399
Time data structure.
Definition fbtime.h:88
static const FBTime Infinity
Time constant: Infinity, the largest time value.
Definition fbtime.h:283
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:301
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:298
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:292
void SetMilliSeconds(kLongLong pMilliSeconds)
Set milliseconds time.
static const FBTime MinusInfinity
Time constant: Minus Infinity, the lowest negative time value.
Definition fbtime.h:286
void Set(kLongLong pTime)
Set time value from a long.
static const FBTime Zero
Time constant: Zero.
Definition fbtime.h:289
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.
bool IsExactlyOnFrame(FBTimeMode pTimeMode=kFBTimeModeDefault)
Is the time falling exactly on a frame?
FBString GetTimeString(FBTimeMode pMode=kFBTimeModeDefault, ETimeFormats pFormat=eDefaultFormat)
Get time as a string.
static const FBTime OneSecond
Time constant: One Second.
Definition fbtime.h:295
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:410
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.
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
String class.
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