TuttleOFX
1
|
00001 #ifndef _TUTTLE_PLUGIN_INPUTBUFFER_PLUGIN_HPP_ 00002 #define _TUTTLE_PLUGIN_INPUTBUFFER_PLUGIN_HPP_ 00003 00004 #include "InputBufferDefinitions.hpp" 00005 00006 #include <tuttle/plugin/ImageEffectGilPlugin.hpp> 00007 00008 00009 namespace tuttle { 00010 namespace plugin { 00011 namespace inputBuffer { 00012 00013 00014 struct InputBufferProcessParams 00015 { 00016 EParamInputMode _mode; 00017 00018 unsigned char* _inputBuffer; 00019 CallbackInputImagePtr _callbackPtr; 00020 CustomDataPtr _customDataPtr; 00021 CallbackDestroyCustomDataPtr _callbackDestroyPtr; 00022 00023 int _width; 00024 int _height; 00025 int _rowByteSize; 00026 double _pixelAspectRatio; 00027 double _framerate; 00028 OFX::EPixelComponent _pixelComponents; 00029 OFX::EBitDepth _bitDepth; 00030 OFX::EField _field; 00031 EParamOrientation _orientation; 00032 }; 00033 00034 /** 00035 * @brief InputBuffer plugin 00036 */ 00037 class InputBufferPlugin : public OFX::ImageEffect 00038 { 00039 public: 00040 typedef float Scalar; 00041 public: 00042 InputBufferPlugin( OfxImageEffectHandle handle ); 00043 ~InputBufferPlugin(); 00044 00045 public: 00046 InputBufferProcessParams getProcessParams( const OfxTime time ) const; 00047 00048 void changedParam( const OFX::InstanceChangedArgs &args, const std::string ¶mName ); 00049 00050 bool getTimeDomain( OfxRangeD& range ); 00051 void getClipPreferences( OFX::ClipPreferencesSetter& clipPreferences ); 00052 bool getRegionOfDefinition( const OFX::RegionOfDefinitionArguments& args, OfxRectD& rod ); 00053 00054 void render( const OFX::RenderArguments &args ); 00055 00056 public: 00057 OFX::Clip *_clipDst; ///< Destination image clip 00058 00059 OFX::ChoiceParam* _paramInputMode; 00060 OFX::StringParam* _paramInputBufferPointer; 00061 OFX::StringParam* _paramInputCallbackPointer; 00062 OFX::StringParam* _paramInputCallbackCustomData; 00063 OFX::StringParam* _paramInputCallbackDestroyCustomData; 00064 00065 OFX::Int2DParam* _paramSize; 00066 OFX::IntParam* _paramRowByteSize; 00067 OFX::DoubleParam* _paramPixelAspectRatio; 00068 OFX::DoubleParam* _paramFramerate; 00069 OFX::ChoiceParam* _paramPixelComponents; 00070 OFX::ChoiceParam* _paramBitDepth; 00071 OFX::ChoiceParam* _paramField; 00072 OFX::ChoiceParam* _paramOrientation; 00073 00074 OFX::Double2DParam* _paramTimeDomain; 00075 00076 private: 00077 CustomDataPtr _tempStoreCustomDataPtr; //< keep track of the previous value 00078 00079 /// @brief Store temporary values (between actions). 00080 /// We ensure that we call the get image callback only once, 00081 /// but we need the values multiple times. 00082 /// @{ 00083 OfxTime _callbackMode_time; 00084 OfxPointI _callbackMode_imgSize; 00085 int _callbackMode_rowSizeBytes; 00086 unsigned char* _callbackMode_imgPointer; 00087 /// @} 00088 00089 /** 00090 * @brief We call this function each time we need to know something about the image, 00091 * the size, the buffer, etc. And this function ensures to get valid values, 00092 * and is responsible to call the callback only once for a given input time. 00093 */ 00094 void callbackMode_updateImage( const OfxTime time, const InputBufferProcessParams& params ); 00095 }; 00096 00097 } 00098 } 00099 } 00100 00101 #endif