TuttleOFX  1
JpegReaderPluginFactory.cpp
Go to the documentation of this file.
00001 #include "JpegReaderPluginFactory.hpp"
00002 #include "JpegReaderDefinitions.hpp"
00003 #include "JpegReaderPlugin.hpp"
00004 
00005 #include <tuttle/plugin/context/ReaderPluginFactory.hpp>
00006 
00007 #include <boost/algorithm/string/join.hpp>
00008 #include <boost/assign/std/vector.hpp>
00009 
00010 #include <string>
00011 #include <vector>
00012 
00013 namespace tuttle {
00014 namespace plugin {
00015 namespace jpeg {
00016 namespace reader {
00017 
00018 /**
00019  * @brief Function called to describe the plugin main features.
00020  * @param[in, out]   desc     Effect descriptor
00021  */
00022 void JpegReaderPluginFactory::describe( OFX::ImageEffectDescriptor& desc )
00023 {
00024         desc.setLabels( "TuttleJpegReader", "JpegReader",
00025                     "Jpeg file reader" );
00026         desc.setPluginGrouping( "tuttle/image/io" );
00027 
00028         using namespace boost::assign;
00029         std::vector<std::string> supportedExtensions;
00030         supportedExtensions += "jpeg", "jpg", "jpe", "jfif", "jfi";
00031 
00032         desc.setDescription( "JPEG File reader\n"
00033                          "Plugin is used to read jpeg files.\n\n"
00034                          "supported extensions: \n" +
00035                          boost::algorithm::join( supportedExtensions, ", " )
00036         );
00037 
00038         // add the supported contexts
00039         desc.addSupportedContext( OFX::eContextReader );
00040         desc.addSupportedContext( OFX::eContextGenerator );
00041         desc.addSupportedContext( OFX::eContextGeneral );
00042 
00043         // add supported pixel depths
00044         desc.addSupportedBitDepth( OFX::eBitDepthFloat );
00045         desc.addSupportedBitDepth( OFX::eBitDepthUByte );
00046         desc.addSupportedBitDepth( OFX::eBitDepthUShort );
00047 
00048         // add supported extensions
00049         desc.addSupportedExtensions( supportedExtensions );
00050 
00051         // plugin flags
00052         desc.setRenderThreadSafety( OFX::eRenderFullySafe );
00053         desc.setHostFrameThreading( false );
00054         desc.setSupportsMultiResolution( false );
00055         desc.setSupportsMultipleClipDepths( true );
00056         desc.setSupportsTiles( kSupportTiles );
00057 }
00058 
00059 /**
00060  * @brief Function called to describe the plugin controls and features.
00061  * @param[in, out]   desc       Effect descriptor
00062  * @param[in]        context    Application context
00063  */
00064 void JpegReaderPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc,
00065                                                  OFX::EContext               context )
00066 {
00067         OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName );
00068         dstClip->addSupportedComponent( OFX::ePixelComponentAlpha );
00069         dstClip->addSupportedComponent( OFX::ePixelComponentRGB );
00070         dstClip->addSupportedComponent( OFX::ePixelComponentRGBA );
00071         dstClip->setSupportsTiles( kSupportTiles );
00072 
00073         describeReaderParamsInContext( desc, context );
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* JpegReaderPluginFactory::createInstance( OfxImageEffectHandle handle,
00083                                                            OFX::EContext        context )
00084 {
00085         return new JpegReaderPlugin( handle );
00086 }
00087 
00088 }
00089 }
00090 }
00091 }