TuttleOFX
1
|
00001 #include "DPXWriterPluginFactory.hpp" 00002 #include "DPXWriterPlugin.hpp" 00003 #include "DPXWriterDefinitions.hpp" 00004 00005 #include <tuttle/plugin/context/WriterPluginFactory.hpp> 00006 00007 namespace tuttle { 00008 namespace plugin { 00009 namespace dpx { 00010 namespace writer { 00011 00012 /** 00013 * @brief Function called to describe the plugin main features. 00014 * @param[in, out] desc Effect descriptor 00015 */ 00016 void DPXWriterPluginFactory::describe( OFX::ImageEffectDescriptor& desc ) 00017 { 00018 desc.setLabels( "TuttleDpxWriter", "DpxWriter", 00019 "Dpx file writer" ); 00020 desc.setPluginGrouping( "tuttle/image/io" ); 00021 00022 desc.setDescription( "Digital Picture Exchange (DPX), ANSI/SMPTE standard (268M-2003)" ); 00023 00024 // add the supported contexts 00025 desc.addSupportedContext( OFX::eContextWriter ); 00026 desc.addSupportedContext( OFX::eContextGeneral ); 00027 00028 // add supported pixel depths 00029 desc.addSupportedBitDepth( OFX::eBitDepthUByte ); 00030 desc.addSupportedBitDepth( OFX::eBitDepthUShort ); 00031 desc.addSupportedBitDepth( OFX::eBitDepthFloat ); 00032 00033 // add supported extensions 00034 desc.addSupportedExtension( "dpx" ); 00035 00036 // plugin flags 00037 desc.setRenderThreadSafety( OFX::eRenderFullySafe ); 00038 desc.setHostFrameThreading( false ); 00039 desc.setSupportsMultiResolution( false ); 00040 desc.setSupportsMultipleClipDepths( true ); 00041 desc.setSupportsTiles( kSupportTiles ); 00042 } 00043 00044 /** 00045 * @brief Function called to describe the plugin controls and features. 00046 * @param[in, out] desc Effect descriptor 00047 * @param[in] context Application context 00048 */ 00049 void DPXWriterPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc, 00050 OFX::EContext context ) 00051 { 00052 OFX::ClipDescriptor* srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName ); 00053 srcClip->addSupportedComponent( OFX::ePixelComponentRGBA ); 00054 srcClip->addSupportedComponent( OFX::ePixelComponentRGB ); 00055 srcClip->addSupportedComponent( OFX::ePixelComponentAlpha ); 00056 srcClip->setSupportsTiles( kSupportTiles ); 00057 00058 OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName ); 00059 dstClip->addSupportedComponent( OFX::ePixelComponentRGBA ); 00060 dstClip->addSupportedComponent( OFX::ePixelComponentRGB ); 00061 dstClip->addSupportedComponent( OFX::ePixelComponentAlpha ); 00062 dstClip->setSupportsTiles( kSupportTiles ); 00063 00064 // Controls 00065 00066 describeWriterParamsInContext( desc, context ); 00067 00068 OFX::ChoiceParamDescriptor* bitDepth = static_cast<OFX::ChoiceParamDescriptor*>( desc.getParamDescriptor( kTuttlePluginBitDepth ) ); 00069 bitDepth->resetOptions(); 00070 bitDepth->appendOption( kTuttlePluginBitDepth8 ); 00071 bitDepth->appendOption( kTuttlePluginBitDepth10 ); 00072 bitDepth->appendOption( kTuttlePluginBitDepth12 ); 00073 bitDepth->appendOption( kTuttlePluginBitDepth16 ); 00074 bitDepth->appendOption( kTuttlePluginBitDepth32 ); 00075 bitDepth->appendOption( kTuttlePluginBitDepth64 ); 00076 bitDepth->setDefault( eTuttlePluginBitDepth10 ); 00077 00078 OFX::ChoiceParamDescriptor* descriptor = static_cast<OFX::ChoiceParamDescriptor*>( desc.getParamDescriptor( kTuttlePluginChannel ) ); 00079 descriptor->resetOptions(); 00080 descriptor->appendOption( kParamDescriptorUserDefinedDescriptor ); 00081 descriptor->appendOption( kParamDescriptorRed ); 00082 descriptor->appendOption( kParamDescriptorGreen ); 00083 descriptor->appendOption( kParamDescriptorBlue ); 00084 descriptor->appendOption( kParamDescriptorAlpha ); 00085 descriptor->appendOption( kParamDescriptorLuma ); 00086 descriptor->appendOption( kParamDescriptorColorDifference ); 00087 descriptor->appendOption( kParamDescriptorDepth ); 00088 descriptor->appendOption( kParamDescriptorCompositeVideo ); 00089 descriptor->appendOption( kParamDescriptorRGB ); 00090 descriptor->appendOption( kParamDescriptorRGBA ); 00091 descriptor->appendOption( kParamDescriptorABGR ); 00092 descriptor->appendOption( kParamDescriptorCbYCrY ); 00093 descriptor->appendOption( kParamDescriptorCbYACrYA ); 00094 descriptor->appendOption( kParamDescriptorCbYCr ); 00095 descriptor->appendOption( kParamDescriptorCbYCrA ); 00096 descriptor->appendOption( kParamDescriptorUserDefined2Comp ); 00097 descriptor->appendOption( kParamDescriptorUserDefined3Comp ); 00098 descriptor->appendOption( kParamDescriptorUserDefined4Comp ); 00099 descriptor->appendOption( kParamDescriptorUserDefined5Comp ); 00100 descriptor->appendOption( kParamDescriptorUserDefined6Comp ); 00101 descriptor->appendOption( kParamDescriptorUserDefined7Comp ); 00102 descriptor->appendOption( kParamDescriptorUserDefined8Comp ); 00103 descriptor->appendOption( kParamDescriptorUndefinedDescriptor ); 00104 descriptor->appendOption( kParamDescriptorAuto ); 00105 descriptor->setDefault( 9 ); // rgb 00106 00107 OFX::ChoiceParamDescriptor* transfer = desc.defineChoiceParam( kParamTransfer ); 00108 transfer->setLabel( kParamTransferLabel ); 00109 transfer->setHint( kParamTransferHint ); 00110 transfer->appendOption( kParamCharacteristicUserDefined ); 00111 transfer->appendOption( kParamCharacteristicPrintingDensity ); 00112 transfer->appendOption( kParamCharacteristicLinear ); 00113 transfer->appendOption( kParamCharacteristicLogarithmic ); 00114 transfer->appendOption( kParamCharacteristicUnspecifiedVideo ); 00115 transfer->appendOption( kParamCharacteristicSMPTE274M ); 00116 transfer->appendOption( kParamCharacteristicITUR709 ); 00117 transfer->appendOption( kParamCharacteristicITUR601 ); 00118 transfer->appendOption( kParamCharacteristicITUR602 ); 00119 transfer->appendOption( kParamCharacteristicNTSCCompositeVideo ); 00120 transfer->appendOption( kParamCharacteristicPALCompositeVideo ); 00121 transfer->appendOption( kParamCharacteristicZLinear ); 00122 transfer->appendOption( kParamCharacteristicZHomogeneous ); 00123 transfer->appendOption( kParamCharacteristicUndefinedCharacteristic ); 00124 transfer->setDefault( 2 ); // Linear 00125 00126 OFX::ChoiceParamDescriptor* colorimetric = desc.defineChoiceParam( kParamColorimetric ); 00127 colorimetric->setLabel( kParamColorimetricLabel ); 00128 colorimetric->setHint( kParamColorimetricHint ); 00129 colorimetric->appendOption( kParamCharacteristicUserDefined ); 00130 colorimetric->appendOption( kParamCharacteristicPrintingDensity ); 00131 colorimetric->appendOption( kParamCharacteristicLinear ); 00132 colorimetric->appendOption( kParamCharacteristicLogarithmic ); 00133 colorimetric->appendOption( kParamCharacteristicUnspecifiedVideo ); 00134 colorimetric->appendOption( kParamCharacteristicSMPTE274M ); 00135 colorimetric->appendOption( kParamCharacteristicITUR709 ); 00136 colorimetric->appendOption( kParamCharacteristicITUR601 ); 00137 colorimetric->appendOption( kParamCharacteristicITUR602 ); 00138 colorimetric->appendOption( kParamCharacteristicNTSCCompositeVideo ); 00139 colorimetric->appendOption( kParamCharacteristicPALCompositeVideo ); 00140 colorimetric->appendOption( kParamCharacteristicZLinear ); 00141 colorimetric->appendOption( kParamCharacteristicZHomogeneous ); 00142 colorimetric->appendOption( kParamCharacteristicUndefinedCharacteristic ); 00143 colorimetric->setDefault( 2 ); // Linear 00144 00145 OFX::ChoiceParamDescriptor* packed = desc.defineChoiceParam( kParamPacked ); 00146 packed->setLabel( kParamPackedLabel ); 00147 packed->setHint( kParamPackedHint ); 00148 packed->appendOption( kParamPackedPacked ); 00149 packed->appendOption( kParamPackedMethodA ); 00150 packed->appendOption( kParamPackedMethodB ); 00151 packed->setDefault( 1 ); 00152 00153 OFX::BooleanParamDescriptor* swapEndian = desc.defineBooleanParam( kParamSwapEndian ); 00154 swapEndian->setLabel( kParamSwapEndianLabel ); 00155 swapEndian->setHint( kParamSwapEndianHint ); 00156 swapEndian->setDefault( true ); 00157 00158 OFX::ChoiceParamDescriptor* encoding = desc.defineChoiceParam( kParamEncoding ); 00159 encoding->setLabel( kParamEncodingLabel ); 00160 encoding->setHint( kParamEncodingHint ); 00161 encoding->appendOption( kParamEncodingNone ); 00162 encoding->appendOption( kParamEncodingRle ); 00163 encoding->setDefault( 0 ); 00164 00165 OFX::ChoiceParamDescriptor* orientation = desc.defineChoiceParam( kParamOrientation ); 00166 orientation->setLabel( kParamOrientationLabel ); 00167 orientation->setHint( kParamOrientationHint ); 00168 orientation->appendOption( kParamOrientationLeftToRightTopToBottom ); 00169 orientation->appendOption( kParamOrientationRightToLeftTopToBottom ); 00170 orientation->appendOption( kParamOrientationLeftToRightBottomToTop ); 00171 orientation->appendOption( kParamOrientationRightToLeftBottomToTop ); 00172 orientation->appendOption( kParamOrientationTopToBottomLeftToRight ); 00173 orientation->appendOption( kParamOrientationTopToBottomRightToLeft ); 00174 orientation->appendOption( kParamOrientationBottomToTopLeftToRight ); 00175 orientation->appendOption( kParamOrientationBottomToTopRightToLeft ); 00176 orientation->appendOption( kParamOrientationUndefinedOrientation ); 00177 orientation->setDefault( 0 ); 00178 00179 OFX::StringParamDescriptor* project = desc.defineStringParam( kParamProject ); 00180 project->setDefault( "" ); 00181 OFX::StringParamDescriptor* copyright = desc.defineStringParam( kParamCopyright ); 00182 copyright->setDefault( "" ); 00183 00184 } 00185 00186 /** 00187 * @brief Function called to create a plugin effect instance 00188 * @param[in] handle effect handle 00189 * @param[in] context Application context 00190 * @return plugin instance 00191 */ 00192 OFX::ImageEffect* DPXWriterPluginFactory::createInstance( OfxImageEffectHandle handle, 00193 OFX::EContext context ) 00194 { 00195 return new DPXWriterPlugin( handle ); 00196 } 00197 00198 } 00199 } 00200 } 00201 }