TuttleOFX  1
TimeShiftPluginFactory.cpp
Go to the documentation of this file.
00001 #include "TimeShiftPluginFactory.hpp"
00002 #include "TimeShiftPlugin.hpp"
00003 #include "TimeShiftDefinitions.hpp"
00004 
00005 #include <ofxsImageEffect.h>
00006 
00007 namespace tuttle {
00008 namespace plugin {
00009 namespace timeShift {
00010 
00011 /**
00012  * @brief Function called to describe the plugin main features.
00013  * @param[in, out]   desc     Effect descriptor
00014  */
00015 void TimeShiftPluginFactory::describe( OFX::ImageEffectDescriptor& desc )
00016 {
00017         desc.setLabels( "TuttleTimeShift", "TimeShift",
00018                         "TimeShift" );
00019         desc.setPluginGrouping( "tuttle/image/process/time" );
00020 
00021         // add the supported contexts
00022         desc.addSupportedContext( OFX::eContextFilter );
00023         desc.addSupportedContext( OFX::eContextGeneral );
00024 
00025         // add supported pixel depths
00026         desc.addSupportedBitDepth( OFX::eBitDepthUByte );
00027         desc.addSupportedBitDepth( OFX::eBitDepthUShort );
00028         desc.addSupportedBitDepth( OFX::eBitDepthFloat );
00029 
00030         // plugin flags
00031         desc.setTemporalClipAccess( true ); // The identity state change the time
00032         desc.setSupportsTiles( true );
00033         desc.setRenderThreadSafety( OFX::eRenderFullySafe );
00034 }
00035 
00036 /**
00037  * @brief Function called to describe the plugin controls and features.
00038  * @param[in, out]   desc       Effect descriptor
00039  * @param[in]        context    Application context
00040  */
00041 void TimeShiftPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc,
00042                                                 OFX::EContext               context )
00043 {
00044         OFX::ClipDescriptor* srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName );
00045         srcClip->addSupportedComponent( OFX::ePixelComponentRGBA );
00046         srcClip->addSupportedComponent( OFX::ePixelComponentRGB );
00047         srcClip->addSupportedComponent( OFX::ePixelComponentAlpha );
00048         srcClip->setTemporalClipAccess( true );
00049 
00050         // Create the mandated output clip
00051         OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName );
00052         dstClip->addSupportedComponent( OFX::ePixelComponentRGBA );
00053         dstClip->addSupportedComponent( OFX::ePixelComponentRGB );
00054         dstClip->addSupportedComponent( OFX::ePixelComponentAlpha );
00055 
00056         switch( context )
00057         {
00058                 case OFX::eContextRetimer:
00059                 {
00060                         OFX::DoubleParamDescriptor* retimerParam = desc.defineDoubleParam( kOfxImageEffectRetimerParamName );
00061                         retimerParam->setLabel( "Source Time" );
00062                         retimerParam->setDefault( 0.0 );
00063                         break;
00064                 }
00065                 default:
00066                 {
00067                         OFX::DoubleParamDescriptor* offset = desc.defineDoubleParam( kParamOffset );
00068                         offset->setLabel( "Offset" );
00069                         offset->setDefault( 0.0 );
00070                         offset->setDisplayRange( -10, 10 );
00071                         break;
00072                 }
00073         }
00074 }
00075 
00076 /**
00077  * @brief Function called to create a plugin effect instance
00078  * @param[in] handle  effect handle
00079  * @param[in] context    Application context
00080  * @return  plugin instance
00081  */
00082 OFX::ImageEffect* TimeShiftPluginFactory::createInstance( OfxImageEffectHandle handle,
00083                                                           OFX::EContext        context )
00084 {
00085         return new TimeShiftPlugin( handle );
00086 }
00087 
00088 }
00089 }
00090 }