TuttleOFX
1
|
00001 #ifndef _TUTTLE_PLUGIN_AV_WRITER_PLUGIN_HPP_ 00002 #define _TUTTLE_PLUGIN_AV_WRITER_PLUGIN_HPP_ 00003 00004 #include <libav/LibAVPresetDefinitions.hpp> 00005 #include <libav/LibAVVideoWriter.hpp> 00006 #include <libav/LibAVOptions.hpp> 00007 00008 #include <tuttle/plugin/context/WriterPlugin.hpp> 00009 00010 #include <boost/scoped_ptr.hpp> 00011 00012 #include <string> 00013 #include <vector> 00014 00015 namespace tuttle { 00016 namespace plugin { 00017 namespace av { 00018 namespace writer { 00019 00020 struct AVProcessParams 00021 { 00022 std::string _filepath; ///< Filepath 00023 int _format; ///< Format 00024 int _videoCodec; ///< Video codec 00025 int _audioCodec; ///< Audio codec 00026 00027 int _videoPreset; ///< video configuration (based on the video codec) 00028 int _audioPreset; ///< video configuration (based on the video codec) 00029 00030 PixelFormat _videoPixelFormat; /// videoPixelFormat 00031 }; 00032 00033 /** 00034 * @brief LibAV plugin 00035 */ 00036 class AVWriterPlugin : public AVOptionPlugin< WriterPlugin > 00037 { 00038 public: 00039 AVWriterPlugin( OfxImageEffectHandle handle ); 00040 00041 public: 00042 AVProcessParams getProcessParams(); 00043 00044 void disableAVOptionsForCodecOrFormat( const std::vector<AVPrivOption>& avPrivOpts, const std::string& codec ); 00045 void updatePixelFormat( const std::string& videoCodecName ); 00046 00047 void changedParam( const OFX::InstanceChangedArgs& args, const std::string& paramName ); 00048 void getClipPreferences( OFX::ClipPreferencesSetter& clipPreferences ); 00049 bool isIdentity( const OFX::RenderArguments& args, OFX::Clip*& identityClip, double& identityTime ); 00050 00051 void beginSequenceRender( const OFX::BeginSequenceRenderArguments& args ); 00052 void render( const OFX::RenderArguments& args ); 00053 void endSequenceRender( const OFX::EndSequenceRenderArguments& args ); 00054 00055 public: 00056 OFX::ChoiceParam* _paramFormat; 00057 OFX::ChoiceParam* _paramVideoCodec; 00058 OFX::ChoiceParam* _paramAudioCodec; 00059 00060 OFX::ChoiceParam* _paramMainPreset; 00061 OFX::ChoiceParam* _paramFormatPreset; 00062 OFX::ChoiceParam* _paramVideoCodecPreset; 00063 OFX::ChoiceParam* _paramAudioCodecPreset; 00064 00065 OFX::IntParam* _paramBitRate; 00066 OFX::BooleanParam* _paramUseCustomFps; 00067 OFX::DoubleParam* _paramCustomFps; 00068 OFX::ChoiceParam* _paramVideoPixelFormat; 00069 00070 LibAVVideoWriter _writer; 00071 bool _initWriter; 00072 }; 00073 00074 } 00075 } 00076 } 00077 } 00078 00079 #endif