TuttleOFX  1
OutputBufferPluginFactory.cpp
Go to the documentation of this file.
00001 #include "OutputBufferPluginFactory.hpp"
00002 #include "OutputBufferPlugin.hpp"
00003 #include "OutputBufferDefinitions.hpp"
00004 #include "ofxsImageEffect.h"
00005 
00006 #include <limits>
00007 
00008 namespace tuttle {
00009 namespace plugin {
00010 namespace outputBuffer {
00011 
00012 static const bool kSupportTiles = false;
00013 
00014 
00015 /**
00016  * @brief Function called to describe the plugin main features.
00017  * @param[in, out] desc Effect descriptor
00018  */
00019 void OutputBufferPluginFactory::describe( OFX::ImageEffectDescriptor& desc )
00020 {
00021         desc.setLabels(
00022                 "TuttleOutputBuffer",
00023                 "OutputBuffer",
00024                 "OutputBuffer" );
00025         desc.setPluginGrouping( "tuttle/image/io" );
00026 
00027         desc.setDescription(
00028                 "This is a DANGEROUS plugin dedicated to developers.\n"
00029                 "\n"
00030                 "WARNING: If you put a wrong value, you will crash your application.\n"
00031                 "\n"
00032                 "It allows users to read an image buffer directly from the graph." );
00033 
00034         // add the supported contexts, only filter at the moment
00035         desc.addSupportedContext( OFX::eContextWriter );
00036         desc.addSupportedContext( OFX::eContextGeneral );
00037 
00038         // add supported pixel depths
00039         desc.addSupportedBitDepth( OFX::eBitDepthUByte );
00040         desc.addSupportedBitDepth( OFX::eBitDepthUShort );
00041         desc.addSupportedBitDepth( OFX::eBitDepthFloat );
00042 
00043         // plugin flags
00044         desc.setSupportsTiles( kSupportTiles );
00045         desc.setRenderThreadSafety( OFX::eRenderFullySafe );
00046         desc.setSupportsMultipleClipDepths( true );
00047         desc.setSupportsMultiResolution( false );
00048         desc.setSupportsTiles( false );
00049 }
00050 
00051 /**
00052  * @brief Function called to describe the plugin controls and features.
00053  * @param[in, out]   desc       Effect descriptor
00054  * @param[in]        context    Application context
00055  */
00056 void OutputBufferPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc,
00057                                                   OFX::EContext context )
00058 {
00059         OFX::ClipDescriptor* srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName );
00060 
00061         srcClip->addSupportedComponent( OFX::ePixelComponentRGBA );
00062         srcClip->addSupportedComponent( OFX::ePixelComponentRGB );
00063         srcClip->addSupportedComponent( OFX::ePixelComponentAlpha );
00064         srcClip->setSupportsTiles( kSupportTiles );
00065 
00066         OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName );
00067         dstClip->addSupportedComponent( OFX::ePixelComponentRGBA );
00068         dstClip->addSupportedComponent( OFX::ePixelComponentRGB );
00069         dstClip->addSupportedComponent( OFX::ePixelComponentAlpha );
00070         dstClip->setSupportsTiles( kSupportTiles );
00071 
00072         OFX::StringParamDescriptor* callbackPointer = desc.defineStringParam( kParamOutputCallbackPointer );
00073         callbackPointer->setLabel( "Callback Pointer" );
00074         callbackPointer->setHint(
00075                 "This parameter represents a pointer to a function.\n"
00076                 "WARNING:\n"
00077                 " - Your application will crash if you set an invalid value here.\n"
00078                 );
00079         callbackPointer->setCacheInvalidation( OFX::eCacheInvalidateValueAll );
00080         callbackPointer->setIsPersistant( false );
00081         callbackPointer->setAnimates( false );
00082         callbackPointer->setDefault( "" );
00083         
00084         OFX::StringParamDescriptor* customData = desc.defineStringParam( kParamOutputCustomData );
00085         customData->setLabel( "Callback Custom Data Pointer" );
00086         customData->setHint(
00087                 "This parameter represent a pointer to a custom data which is given to the callback function.\n"
00088                 "WARNING:\n"
00089                 " - Your application could crash if you set an invalid value here.\n"
00090                 );
00091         customData->setCacheInvalidation( OFX::eCacheInvalidateValueAll );
00092         customData->setIsPersistant( false );
00093         customData->setAnimates( false );
00094         customData->setDefault( "" );
00095         
00096         OFX::StringParamDescriptor* callbackDestroyCustomData = desc.defineStringParam( kParamOutputCallbackDestroyCustomData );
00097         callbackDestroyCustomData->setLabel( "Callback Custom Data Pointer" );
00098         callbackDestroyCustomData->setHint(
00099                 "This parameter represents a pointer to a function.\n"
00100                 "WARNING:\n"
00101                 " - Your application could crash if you set an invalid value here.\n"
00102                 );
00103         callbackDestroyCustomData->setCacheInvalidation( OFX::eCacheInvalidateValueAll );
00104         callbackDestroyCustomData->setIsPersistant( false );
00105         callbackDestroyCustomData->setAnimates( false );
00106         callbackDestroyCustomData->setDefault( "" );
00107 
00108 
00109 }
00110 
00111 /**
00112  * @brief Function called to create a plugin effect instance
00113  * @param[in] handle  Effect handle
00114  * @param[in] context Application context
00115  * @return  plugin instance
00116  */
00117 OFX::ImageEffect* OutputBufferPluginFactory::createInstance( OfxImageEffectHandle handle,
00118                                                             OFX::EContext context )
00119 {
00120         return new OutputBufferPlugin( handle );
00121 }
00122 
00123 }
00124 }
00125 }
00126