TuttleOFX
1
|
00001 #include "Jpeg2000WriterPlugin.hpp" 00002 #include "Jpeg2000WriterProcess.hpp" 00003 #include "Jpeg2000WriterDefinitions.hpp" 00004 00005 #include <openjpeg/J2KWriter.hpp> 00006 00007 #include <tuttle/plugin/global.hpp> 00008 00009 #include <ofxsImageEffect.h> 00010 #include <ofxsMultiThread.h> 00011 #include <ofxsImageEffect.h> 00012 00013 #include <boost/gil/gil_all.hpp> 00014 #include <boost/filesystem.hpp> 00015 00016 00017 namespace tuttle { 00018 namespace plugin { 00019 namespace jpeg2000 { 00020 namespace writer { 00021 00022 using namespace boost::filesystem; 00023 using namespace tuttle::io; 00024 using namespace boost::gil; 00025 00026 Jpeg2000WriterPlugin::Jpeg2000WriterPlugin( OfxImageEffectHandle handle ) 00027 : WriterPlugin( handle ) 00028 { 00029 _paramCineProfil = fetchChoiceParam( kParamCinemaProfil ); 00030 _paramLossless = fetchBooleanParam( kParamLossless ); 00031 } 00032 00033 Jpeg2000ProcessParams Jpeg2000WriterPlugin::getProcessParams(const OfxTime time) 00034 { 00035 Jpeg2000ProcessParams params; 00036 params._filepath = getAbsoluteFilenameAt(time); 00037 params._bitDepth = ( ETuttlePluginBitDepth ) this->_paramBitDepth->getValue(); 00038 params._cineProfil = _paramCineProfil->getValue(); 00039 params._lossless = _paramLossless->getValue(); 00040 00041 return params; 00042 } 00043 00044 void Jpeg2000WriterPlugin::changedParam( const OFX::InstanceChangedArgs &args, const std::string ¶mName ) 00045 { 00046 WriterPlugin::changedParam( args, paramName ); 00047 if( paramName == kParamCinemaProfil && args.reason == OFX::eChangeUserEdit ) 00048 { 00049 if (_paramCineProfil->getValue() != 0) 00050 { 00051 _paramLossless->setEnabled(false); 00052 // DCI needs 12b 00053 _paramBitDepth->setValue(1); 00054 _paramBitDepth->setEnabled(false); 00055 } 00056 else 00057 { 00058 _paramLossless->setEnabled(true); 00059 _paramBitDepth->setEnabled(true); 00060 } 00061 } 00062 } 00063 00064 /** 00065 * @brief The overridden render function 00066 * @param[in] args Rendering parameters 00067 */ 00068 void Jpeg2000WriterPlugin::render( const OFX::RenderArguments &args ) 00069 { 00070 WriterPlugin::render( args ); 00071 00072 doGilRender<Jpeg2000WriterProcess>( *this, args ); 00073 } 00074 00075 } 00076 } 00077 } 00078 }