TuttleOFX
1
|
00001 #include "OfxhTimelineSuite.hpp" 00002 #include "OfxhIObject.hpp" 00003 #include "OfxhTimeline.hpp" 00004 #include "OfxhException.hpp" 00005 00006 namespace tuttle { 00007 namespace host { 00008 namespace ofx { 00009 00010 namespace { 00011 00012 /** 00013 * timeline suite function 00014 */ 00015 OfxStatus TimelineGetTime( void* effectInstance, double* time ) 00016 { 00017 try 00018 { 00019 OfxhITimeline* me = dynamic_cast<OfxhITimeline*>( reinterpret_cast<OfxhIObject*>( effectInstance ) ); 00020 if( !me ) 00021 return kOfxStatErrBadHandle; 00022 00023 *time = me->timelineGetTime(); 00024 00025 return kOfxStatOK; 00026 } 00027 catch( OfxhException& e ) 00028 { 00029 return e.getStatus(); 00030 } 00031 catch(... ) 00032 { 00033 return kOfxStatErrUnknown; 00034 } 00035 } 00036 00037 /** 00038 * timeline suite function 00039 */ 00040 OfxStatus TimelineGotoTime( void* effectInstance, double time ) 00041 { 00042 try 00043 { 00044 OfxhITimeline* me = dynamic_cast<OfxhITimeline*>( reinterpret_cast<OfxhIObject*>( effectInstance ) ); 00045 if( !me ) 00046 return kOfxStatErrBadHandle; 00047 00048 me->timelineGotoTime( time ); 00049 00050 return kOfxStatOK; 00051 } 00052 catch( OfxhException& e ) 00053 { 00054 return e.getStatus(); 00055 } 00056 catch(... ) 00057 { 00058 return kOfxStatErrUnknown; 00059 } 00060 } 00061 00062 /** 00063 * timeline suite function 00064 */ 00065 OfxStatus TimelineGetBounds( void* effectInstance, double* firstTime, double* lastTime ) 00066 { 00067 try 00068 { 00069 OfxhITimeline* me = dynamic_cast<OfxhITimeline*>( reinterpret_cast<OfxhIObject*>( effectInstance ) ); 00070 if( !me ) 00071 return kOfxStatErrBadHandle; 00072 00073 me->timelineGetBounds( *firstTime, *lastTime ); 00074 00075 return kOfxStatOK; 00076 } 00077 catch( OfxhException& e ) 00078 { 00079 return e.getStatus(); 00080 } 00081 catch(... ) 00082 { 00083 return kOfxStatErrUnknown; 00084 } 00085 } 00086 00087 /** 00088 * our progress suite 00089 */ 00090 struct OfxTimeLineSuiteV1 gTimelineSuite = 00091 { 00092 TimelineGetTime, 00093 TimelineGotoTime, 00094 TimelineGetBounds 00095 }; 00096 00097 } 00098 00099 void* getTimelineSuite( const int version ) 00100 { 00101 if( version == 1 ) 00102 return &gTimelineSuite; 00103 return NULL; 00104 } 00105 00106 } 00107 } 00108 } 00109