fbtime.h

Go to the documentation of this file.
00001 #ifndef __FBTIME_H__
00002 #define __FBTIME_H__
00003 /**************************************************************************
00004  Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
00005  All Rights Reserved.
00006  
00007  The coded instructions, statements, computer programs, and/or related 
00008  material (collectively the "Data") in these files contain unpublished 
00009  information proprietary to Autodesk, Inc. and/or its licensors, which is 
00010  protected by Canada and United States of America federal copyright law 
00011  and by international treaties.
00012  
00013  The Data may not be disclosed or distributed to third parties, in whole 
00014  or in part, without the prior written consent of Autodesk, Inc. 
00015  ("Autodesk").
00016  
00017  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00018  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO 
00019  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR 
00020  ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES 
00021  OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR 
00022  PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT 
00023  WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR 
00024  FREE.
00025  
00026  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS 
00027  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR 
00028  EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE 
00029  DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS 
00030  OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR 
00031  DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF 
00032  LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT 
00033  LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE 
00034  DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS 
00035  BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
00036  
00037 **************************************************************************/
00038 
00043 #include <kaydaradef.h>
00044 
00045 #ifndef FBSDK_DLL
00046 
00049   #define FBSDK_DLL K_DLLIMPORT
00050 #endif
00051 
00052 #include <fbsdk/fbstring.h>
00053 
00054 #ifdef FBSDKUseNamespace
00055     namespace FBSDKNamespace {
00056 #endif
00057 
00059 // FBTime
00061 
00063 enum FBTimeMode {   
00064     kFBTimeModeDefault,         
00065     kFBTimeModeCinema,          
00066     kFBTimeModePAL,             
00067     kFBTimeMode30Frames,        
00068     kFBTimeModeNTSC_Drop,       
00069     kFBTimeMode50Frames,        
00070     kFBTimeMode60Frames,        
00071     kFBTimeMode100Frames,       
00072     kFBTimeMode120Frames,       
00073     kFBTimeModeFullFrame,       
00074     kFBTimeModeCinemaND,            
00075     kFBTimeModeCustom           
00076 };
00077 
00078 FB_FORWARD( FBTime );
00079 
00081 class FBSDK_DLL FBTime 
00082 {
00083   private:
00084     kLongLong   mTime;          
00085   public:
00086     /*  Constructor.
00087     *   \param  pTime   Time to initialize with(default=0).
00088     */
00089     FBTime( kLongLong pTime=0);
00090 
00100     FBTime (int pHour,int pMinute,int pSecond=0,int pFrame=0,int pField=0, FBTimeMode pTimeMode=kFBTimeModeDefault, double pFramerate = 0.0);
00101 
00105     FBString GetTimeString();
00106 
00110     void SetTimeString(char *pTime);
00111 
00123     bool        GetTime(kLongLong &pHour,  kLongLong &pMinute, kLongLong &pSecond, kLongLong &pFrame, kLongLong &pField,  kLongLong &pMilliSecond, FBTimeMode pTimeMode=kFBTimeModeDefault, double pFramerate =0.0 );
00127     kLongLong   GetMilliSeconds();
00128 
00132     void        SetMilliSeconds(kLongLong pMilliSeconds);
00133 
00137     kLongLong&  Get();
00138 
00142     const kLongLong& Get() const;
00143 
00147     void        Set( kLongLong pTime );
00148 
00152     double      GetSecondDouble();
00153 
00157     void        SetSecondDouble(double pTime);
00158 
00168     void        SetTime (int pHour,int pMinute=0,int pSecond=0,int pFrame=0,int pField=0, FBTimeMode pTimeMode=kFBTimeModeDefault, double pFramerate = 0.0);
00169 
00171 
00175     FBTime& operator=   (const FBTime& pTime);
00176     FBTime& operator+=  (const FBTime& pTime);
00177     FBTime& operator-=  (const FBTime& pTime);
00178     FBTime& operator*=  (const FBTime& pTime);
00179     FBTime& operator/=  (const FBTime& pTime);
00181 
00183 
00187     FBTime& operator=   (double pConstant);
00188     FBTime& operator+=  (double pConstant);
00189     FBTime& operator-=  (double pConstant);
00190     FBTime& operator*=  (double pConstant);
00191     FBTime& operator/=  (double pConstant);
00193 
00195 
00199     FBTime  operator- (const FBTime &pTime);
00200     FBTime  operator+ (const FBTime &pTime);
00201     FBTime  operator/ (const FBTime &pTime);
00202     FBTime  operator* (const FBTime &pTime);
00204 
00206 
00210     FBTime  operator- (double pConstant);
00211     FBTime  operator+ (double pConstant);
00212     FBTime  operator/ (double pConstant);
00213     FBTime  operator* (double pConstant);
00215 
00217 
00221     bool    operator==  (const FBTime& pTime);
00222     bool    operator!=  (const FBTime& pTime);
00223     bool    operator>=  (const FBTime& pTime);
00224     bool    operator<=  (const FBTime& pTime);
00225     bool    operator>   (const FBTime& pTime);
00226     bool    operator<   (const FBTime& pTime);
00228 
00236     kLongLong   GetFrame(bool pCummul=false, FBTimeMode pTimeMode=kFBTimeModeDefault, double pFramerate=0.0);
00237 
00239     static const FBTime Infinity;
00240 
00242     static const FBTime MinusInfinity;
00243 
00245     static const FBTime Zero;
00246 
00248     static const FBTime Epsilon;
00249 
00251     static const FBTime OneSecond;
00252 
00254     static const FBTime OneMinute;
00255 
00257     static const FBTime OneHour;
00258 };
00259 
00260 FB_FORWARD( FBTimeCode );
00261 
00263 class FBSDK_DLL FBTimeCode 
00264 {
00265   private:
00266     double mSecond; 
00267     double mFrame;  
00268     double mRate;   
00269   public:
00270     /*  Constructor.
00271     *   \param  pTime   Time to initialize with(default=0).
00272     */
00273     FBTimeCode();
00274 
00282     FBTimeCode(int pHour,int pMinute=0,int pSecond=0,float pFrame=0,float pRate=0);
00283 
00287     FBString GetTimeCodeString();
00288 
00292     void SetTimeCodeString(char *pTime);
00293 
00296     FBTime GetTime() const;
00297 
00302     void SetTime(FBTime pTime, float pFrameRate = 0);
00303 
00305     static const float NTSC_DROP;
00306     static const float NTSC_FULL;
00307     static const float PAL25;
00308     static const float MPAL_30;     
00309     static const float FILM_24;
00310     static const float FILM_23976;
00311 };
00312 
00314 // FBTimeSpan
00316 
00317 FB_FORWARD( FBTimeSpan )
00318 
00319 
00320 class FBSDK_DLL FBTimeSpan 
00321 {
00322   private:
00323     FBTime       mStart;        
00324     FBTime       mStop;         
00325   public:
00330     FBTimeSpan( FBTime pStart=0,FBTime pStop=0);
00331 
00333 
00336     FBTime& GetStart();
00337     FBTime& GetStop();
00338     const FBTime& GetStart() const;
00339     const FBTime& GetStop() const;
00341 
00346     void    Set( FBTime pStart, FBTime pStop );
00347 
00351     FBTime  GetDuration();      
00352 
00356     FBTime  GetSignedDuration(); 
00357 
00362     int     GetDirection();
00363 
00368     bool    operator& (FBTime &pTime);
00369     
00373     FBTimeSpan operator& (FBTimeSpan &pTimeSpan);   
00374 };
00376 // Global
00378 #ifdef FBSDKUseNamespace
00379     }
00380 #endif
00381 
00382 #endif
00383