TuttleOFX  1
TurboJpegReaderPluginFactory.cpp
Go to the documentation of this file.
00001 #include "TurboJpegReaderPluginFactory.hpp"
00002 #include "TurboJpegReaderPlugin.hpp"
00003 #include "TurboJpegReaderDefinitions.hpp"
00004 #include "ofxsImageEffect.h"
00005 
00006 #include <tuttle/plugin/context/ReaderPluginFactory.hpp>
00007 #include <boost/algorithm/string/join.hpp>
00008 #include <boost/assign/std/vector.hpp>
00009 
00010 
00011 namespace tuttle {
00012 namespace plugin {
00013 namespace turboJpeg {
00014 namespace reader {
00015 
00016 static const bool kSupportTiles = false;
00017 
00018 
00019 /**
00020  * @brief Function called to describe the plugin main features.
00021  * @param[in, out] desc Effect descriptor
00022  */
00023 void TurboJpegReaderPluginFactory::describe( OFX::ImageEffectDescriptor& desc )
00024 {
00025         desc.setLabels(
00026                 "TuttleTurboJpegReader",
00027                 "TurboJpegReader",
00028                 "Turbo Jpeg file reader" );
00029         desc.setPluginGrouping( "tuttle/image/io" );
00030 
00031         using namespace boost::assign;
00032         std::vector<std::string> supportedExtensions;
00033         supportedExtensions += "jpeg", "jpg", "jpe", "jfif", "jfi";
00034 
00035         desc.setDescription( "Optimized JPEG File reader\n"
00036                          "Plugin is used to read jpeg files.\n\n"
00037                          "supported extensions: \n" +
00038                          boost::algorithm::join( supportedExtensions, ", " )
00039         );
00040 
00041         // add the supported contexts, only filter at the moment
00042         desc.addSupportedContext( OFX::eContextReader );
00043         desc.addSupportedContext( OFX::eContextGenerator );
00044         desc.addSupportedContext( OFX::eContextGeneral );
00045 
00046         // add supported pixel depths
00047         desc.addSupportedBitDepth( OFX::eBitDepthUByte );
00048         desc.addSupportedBitDepth( OFX::eBitDepthUShort );
00049         desc.addSupportedBitDepth( OFX::eBitDepthFloat );
00050 
00051         // add supported extensions
00052         desc.addSupportedExtensions( supportedExtensions );
00053         
00054         // plugin flags
00055         desc.setSupportsTiles( kSupportTiles );
00056         desc.setRenderThreadSafety( OFX::eRenderFullySafe );
00057         desc.setHostFrameThreading( false );
00058         desc.setSupportsMultiResolution( false );
00059         desc.setSupportsMultipleClipDepths( true );
00060 }
00061 
00062 /**
00063  * @brief Function called to describe the plugin controls and features.
00064  * @param[in, out]   desc       Effect descriptor
00065  * @param[in]        context    Application context
00066  */
00067 void TurboJpegReaderPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc,
00068                                                   OFX::EContext context )
00069 {
00070         // Create the mandated output clip
00071         OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName );
00072         dstClip->addSupportedComponent( OFX::ePixelComponentRGBA );
00073         dstClip->addSupportedComponent( OFX::ePixelComponentRGB );
00074         dstClip->addSupportedComponent( OFX::ePixelComponentAlpha );
00075         dstClip->setSupportsTiles( kSupportTiles );
00076         
00077         describeReaderParamsInContext( desc, context );
00078         
00079         OFX::ChoiceParamDescriptor* optimization = desc.defineChoiceParam( kParamOptimization );
00080         optimization->setLabel( kParamOptimizationLabel );
00081         optimization->setHint( kParamOptimizationHint );
00082         optimization->appendOption( kTurboJpegOptimizationNone );
00083         optimization->appendOption( kTurboJpegOptimizationMMX );
00084         optimization->appendOption( kTurboJpegOptimizationSSE );
00085         optimization->appendOption( kTurboJpegOptimizationSSE2 );
00086         optimization->appendOption( kTurboJpegOptimizationSSE3 );
00087         optimization->setDefault( eTurboJpegOptimizationSSE3 );
00088         
00089         OFX::BooleanParamDescriptor* fastupsampling = desc.defineBooleanParam( kParamFastUpsampling );
00090         fastupsampling->setLabel( kParamFastUpsamplingLabel );
00091         fastupsampling->setHint( kParamFastUpsamplingHint );
00092         fastupsampling->setDefault( false );
00093 }
00094 
00095 /**
00096  * @brief Function called to create a plugin effect instance
00097  * @param[in] handle  Effect handle
00098  * @param[in] context Application context
00099  * @return  plugin instance
00100  */
00101 OFX::ImageEffect* TurboJpegReaderPluginFactory::createInstance( OfxImageEffectHandle handle,
00102                                                             OFX::EContext context )
00103 {
00104         return new TurboJpegReaderPlugin( handle );
00105 }
00106 
00107 }
00108 }
00109 }
00110 }
00111