TuttleOFX
1
|
00001 #include "Jpeg2000WriterPluginFactory.hpp" 00002 #include "Jpeg2000WriterPlugin.hpp" 00003 #include "Jpeg2000WriterDefinitions.hpp" 00004 00005 #include <tuttle/plugin/context/WriterPluginFactory.hpp> 00006 00007 #include <openjpeg/J2KWriter.hpp> 00008 00009 namespace tuttle { 00010 namespace plugin { 00011 namespace jpeg2000 { 00012 namespace writer { 00013 00014 /** 00015 * @brief Function called to describe the plugin main features. 00016 * @param[in, out] desc Effect descriptor 00017 */ 00018 void Jpeg2000WriterPluginFactory::describe( OFX::ImageEffectDescriptor &desc ) 00019 { 00020 desc.setLabels( 00021 "TuttleJpeg2000Writer", 00022 "Jpeg2000Writer", 00023 "Jpeg 2000 image writer" ); 00024 desc.setPluginGrouping( "tuttle/image/io" ); 00025 00026 desc.setDescription( "Jpeg2000 writer\n" 00027 "plugin is used to output jpeg 2000 files.\n" 00028 "In the filename pattern, put @ where you want your incrementation to be." ); 00029 00030 // add the supported contexts 00031 desc.addSupportedContext( OFX::eContextWriter ); 00032 desc.addSupportedContext( OFX::eContextGeneral ); 00033 00034 // add supported pixel depths 00035 desc.addSupportedBitDepth( OFX::eBitDepthUByte ); 00036 desc.addSupportedBitDepth( OFX::eBitDepthUShort ); 00037 desc.addSupportedBitDepth( OFX::eBitDepthFloat ); 00038 00039 // add supported extensions 00040 desc.addSupportedExtension( "j2k" ); 00041 //desc.addSupportedExtension( "jp2" ); 00042 //desc.addSupportedExtension( "j2c" ); 00043 00044 // plugin flags 00045 desc.setRenderThreadSafety( OFX::eRenderFullySafe ); 00046 desc.setHostFrameThreading( false ); 00047 desc.setSupportsMultiResolution( false ); 00048 desc.setSupportsMultipleClipDepths( true ); 00049 desc.setSupportsTiles( kSupportTiles ); 00050 } 00051 00052 /** 00053 * @brief Function called to describe the plugin controls and features. 00054 * @param[in, out] desc Effect descriptor 00055 * @param[in] context Application context 00056 */ 00057 void Jpeg2000WriterPluginFactory::describeInContext( OFX::ImageEffectDescriptor &desc, 00058 OFX::EContext context ) 00059 { 00060 OFX::ClipDescriptor *srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName ); 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 describeWriterParamsInContext( desc, context ); 00073 00074 OFX::ChoiceParamDescriptor* channel = static_cast<OFX::ChoiceParamDescriptor*>( desc.getParamDescriptor( kTuttlePluginChannel ) ); 00075 channel->resetOptions(); 00076 channel->appendOption( kTuttlePluginChannelRGB ); 00077 channel->setDefault( 0 ); 00078 channel->setEnabled( false ); 00079 00080 OFX::ChoiceParamDescriptor* bitDepth = static_cast<OFX::ChoiceParamDescriptor*>( desc.getParamDescriptor( kTuttlePluginBitDepth ) ); 00081 bitDepth->resetOptions(); 00082 bitDepth->appendOption( kTuttlePluginBitDepthAuto ); 00083 bitDepth->appendOption( kTuttlePluginBitDepth8 ); 00084 bitDepth->appendOption( kTuttlePluginBitDepth12 ); 00085 bitDepth->appendOption( kTuttlePluginBitDepth16 ); 00086 #ifndef TUTTLE_PRODUCTION 00087 bitDepth->appendOption( kTuttlePluginBitDepth32 ); 00088 #endif 00089 bitDepth->setCacheInvalidation( OFX::eCacheInvalidateValueAll ); 00090 bitDepth->setDefault( eTuttlePluginBitDepthAuto ); 00091 00092 OFX::BooleanParamDescriptor* lossless = desc.defineBooleanParam( kParamLossless ); 00093 lossless->setLabel( "lossless" ); 00094 lossless->setHint("When no cinema profile is selected, set compression to lossless."); 00095 lossless->setDefault( false ); 00096 00097 OFX::ChoiceParamDescriptor* cineProfil = desc.defineChoiceParam( kParamCinemaProfil ); 00098 cineProfil->appendOption( kParamCinemaProfilNoDigit ); 00099 cineProfil->appendOption( kParamCinemaProfil2k24fps ); 00100 cineProfil->appendOption( kParamCinemaProfil2k48fps ); 00101 cineProfil->appendOption( kParamCinemaProfil4k24fps ); 00102 cineProfil->setDefault( 0 ); 00103 } 00104 00105 /** 00106 * @brief Function called to create a plugin effect instance 00107 * @param[in] handle effect handle 00108 * @param[in] context Application context 00109 * @return plugin instance 00110 */ 00111 OFX::ImageEffect* Jpeg2000WriterPluginFactory::createInstance( OfxImageEffectHandle handle, 00112 OFX::EContext context ) 00113 { 00114 return new Jpeg2000WriterPlugin(handle); 00115 } 00116 00117 } 00118 } 00119 } 00120 }