TuttleOFX
1
|
00001 #include "AVWriterPlugin.hpp" 00002 #include "AVWriterProcess.hpp" 00003 #include <boost/filesystem.hpp> 00004 00005 namespace tuttle { 00006 namespace plugin { 00007 namespace av { 00008 namespace writer { 00009 00010 template<class View> 00011 AVWriterProcess<View>::AVWriterProcess( AVWriterPlugin& instance ) 00012 : ImageGilFilterProcessor<View>( instance, eImageOrientationFromTopToBottom ) 00013 , _plugin( instance ) 00014 , _params( _plugin.getProcessParams() ) 00015 { 00016 this->setNoMultiThreading(); 00017 } 00018 00019 /** 00020 * @brief Function called by rendering thread each time a process must be done. 00021 * @param[in] procWindowRoW Processing window in RoW 00022 */ 00023 template<class View> 00024 void AVWriterProcess<View>::multiThreadProcessImages( const OfxRectI& procWindowRoW ) 00025 { 00026 using namespace terry; 00027 BOOST_ASSERT( procWindowRoW == this->_dstPixelRod ); 00028 00029 _plugin._writer.setWidth ( this->_srcView.width () ); 00030 _plugin._writer.setHeight( this->_srcView.height() ); 00031 00032 rgba8_image_t img ( this->_srcView.dimensions() ); 00033 rgba8_view_t vw ( view( img ) ); 00034 00035 // Convert pixels in PIX_FMT_RGB24 00036 copy_and_convert_pixels( this->_srcView, vw ); 00037 00038 // Convert pixels to destination 00039 copy_and_convert_pixels( this->_srcView, this->_dstView ); 00040 uint8_t* pixels = (uint8_t*)boost::gil::interleaved_view_get_raw_data( vw ); 00041 00042 // Execute writing 00043 _plugin._writer.execute( pixels, this->_srcView.width(), this->_srcView.height(), PIX_FMT_RGBA ); 00044 } 00045 00046 } 00047 } 00048 } 00049 }