<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\r
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\r
<RuntimeTypeInfo>true</RuntimeTypeInfo>\r
- <WholeProgramOptimization>true</WholeProgramOptimization>\r
+ <WholeProgramOptimization>false</WholeProgramOptimization>\r
<TreatWarningAsError>true</TreatWarningAsError>\r
</ClCompile>\r
<Link>\r
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
<MultiProcessorCompilation>true</MultiProcessorCompilation>\r
<PreprocessorDefinitions>NDEBUG;_VC80_UPGRADE=0x0710;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <WholeProgramOptimization>true</WholeProgramOptimization>\r
+ <WholeProgramOptimization>false</WholeProgramOptimization>\r
<TreatWarningAsError>true</TreatWarningAsError>\r
<OmitFramePointers>true</OmitFramePointers>\r
</ClCompile>\r
<ClInclude Include="processor\write_frame.h">\r
<Filter>Source\channel\processor\frame</Filter>\r
</ClInclude>\r
- <ClInclude Include="processor\draw_frame.h">\r
- <Filter>Source\channel\processor\frame</Filter>\r
- </ClInclude>\r
<ClInclude Include="processor\image_kernel.h">\r
<Filter>Source\channel\processor\image</Filter>\r
</ClInclude>\r
<ClInclude Include="version.h">\r
<Filter>Source</Filter>\r
</ClInclude>\r
+ <ClInclude Include="processor\draw_frame.h">\r
+ <Filter>Source\channel\processor\frame</Filter>\r
+ </ClInclude>\r
</ItemGroup>\r
<ItemGroup>\r
<ClCompile Include="protocol\amcp\AMCPCommandQueue.cpp">\r
<ClCompile Include="processor\write_frame.cpp">\r
<Filter>Source\channel\processor\frame</Filter>\r
</ClCompile>\r
- <ClCompile Include="processor\draw_frame.cpp">\r
- <Filter>Source\channel\processor\frame</Filter>\r
- </ClCompile>\r
<ClCompile Include="processor\image_kernel.cpp">\r
<Filter>Source\channel\processor\image</Filter>\r
</ClCompile>\r
<ClCompile Include="configuration.cpp">\r
<Filter>Source</Filter>\r
</ClCompile>\r
+ <ClCompile Include="processor\draw_frame.cpp">\r
+ <Filter>Source\channel\processor\frame</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<Midl Include="consumer\decklink\DeckLinkAPI_v7_3.idl">\r
void draw_frame::texcoord(double left, double top, double right, double bottom){impl_->image_transform_.uv = boost::make_tuple(left, top, right, bottom);}\r
void draw_frame::video_mode(video_mode::type mode){impl_->image_transform_.mode = mode;}\r
void draw_frame::alpha(double value){impl_->image_transform_.alpha = value;}\r
+const image_transform& draw_frame::get_image_transform() const { return impl_->image_transform_;}\r
+const audio_transform& draw_frame::get_audio_transform() const { return impl_->audio_transform_;}\r
\r
safe_ptr<draw_frame> draw_frame::interlace(const safe_ptr<draw_frame>& frame1, const safe_ptr<draw_frame>& frame2, video_mode::type mode)\r
{ \r
#include <vector>\r
\r
namespace caspar { namespace core {\r
+\r
+struct image_transform;\r
+struct audio_transform;\r
\r
class draw_frame\r
{\r
void texcoord(double left, double top, double right, double bottom);\r
void video_mode(video_mode::type mode);\r
void alpha(double value);\r
+\r
+ const image_transform& get_image_transform() const;\r
+ const audio_transform& get_audio_transform() const;\r
\r
static safe_ptr<draw_frame> interlace(const safe_ptr<draw_frame>& frame1, const safe_ptr<draw_frame>& frame2, video_mode::type mode);\r
\r
\r
struct write_frame::implementation : boost::noncopyable\r
{ \r
+ write_frame& self_;\r
std::vector<safe_ptr<host_buffer>> buffers_;\r
std::vector<short> audio_data_;\r
const pixel_format_desc desc_;\r
\r
public:\r
- implementation(const pixel_format_desc& desc, std::vector<safe_ptr<host_buffer>> buffers) \r
- : desc_(desc)\r
+ implementation(write_frame& self, const pixel_format_desc& desc, std::vector<safe_ptr<host_buffer>> buffers) \r
+ : self_(self)\r
+ , desc_(desc)\r
, buffers_(buffers){}\r
\r
void process_image(image_processor& processor)\r
{\r
+ processor.begin(self_.get_image_transform());\r
processor.process(desc_, buffers_);\r
+ processor.end();\r
}\r
\r
void process_audio(audio_processor& processor)\r
{\r
+ processor.begin(self_.get_audio_transform());\r
processor.process(audio_data_);\r
+ processor.end();\r
}\r
\r
boost::iterator_range<unsigned char*> image_data(size_t index)\r
return boost::iterator_range<const unsigned char*>(ptr, ptr+buffers_[index]->size());\r
}\r
};\r
+\r
+#ifdef _MSC_VER\r
+#pragma warning(disable : 4355) // 'this' : used in base member initializer list\r
+#endif\r
\r
-write_frame::write_frame(const pixel_format_desc& desc, std::vector<safe_ptr<host_buffer>> buffers) : impl_(new implementation(desc, buffers)){}\r
+write_frame::write_frame(const pixel_format_desc& desc, std::vector<safe_ptr<host_buffer>> buffers) : impl_(new implementation(*this, desc, buffers)){}\r
write_frame::write_frame(write_frame&& other) : impl_(std::move(other.impl_)){}\r
void write_frame::swap(write_frame& other){impl_.swap(other.impl_);}\r
write_frame& write_frame::operator=(write_frame&& other)\r
explicit implementation(AVCodecContext* codec_context, double fps) \r
: codec_context_(codec_context)\r
, audio_buffer_(4*SAMPLE_RATE*2+FF_INPUT_BUFFER_PADDING_SIZE/2)\r
- , audio_frame_size_(static_cast<size_t>(static_cast<double>(SAMPLE_RATE) / fps) * N_CHANNELS)\r
- {\r
- if(codec_context_->sample_rate != SAMPLE_RATE)\r
- BOOST_THROW_EXCEPTION(file_read_error() << msg_info("Invalid sample rate. Expected 48000."));\r
-\r
- if(codec_context_->channels != 2)\r
- BOOST_THROW_EXCEPTION(file_read_error() << msg_info("Invalid channel count. Expected 2."));\r
- }\r
+ , audio_frame_size_(static_cast<size_t>(static_cast<double>(SAMPLE_RATE) / fps) * N_CHANNELS){}\r
\r
std::vector<std::vector<short>> execute(const aligned_buffer& audio_packet)\r
{ \r
int written_bytes = audio_buffer_.size()*2 - FF_INPUT_BUFFER_PADDING_SIZE;\r
const int result = avcodec_decode_audio2(codec_context_, audio_buffer_.data(), &written_bytes, audio_packet.data(), audio_packet.size());\r
\r
- if(result <= 0)\r
+ if(result <= 0 || codec_context_->sample_rate != SAMPLE_RATE || codec_context_->channels != 2)\r
return std::vector<std::vector<short>>();\r
\r
current_chunk_.insert(current_chunk_.end(), audio_buffer_.data(), audio_buffer_.data() + written_bytes/2);\r
{\r
result = std::move(ouput_channel_.front());\r
last_frame_ = draw_frame(result);\r
- last_frame_->audio_volume(0.0); // last_frame should not have audio\r
+ last_frame_->get_audio_transform().audio_volume = 0.0; // last_frame should not have audio\r
ouput_channel_.pop();\r
}\r
else if(input_.is_eof())\r
<channel>\r
<videomode>PAL</videomode>\r
<consumers>\r
- <!--ogl>\r
+ <ogl>\r
<device>0</device>\r
<stretch>uniform</stretch>\r
<windowed>true</windowed>\r
- </ogl-->\r
- <audio/>\r
+ </ogl>\r
+ <!--audio/-->\r
<!--decklink>\r
<device>1</device>\r
</decklink-->\r
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
<MultiProcessorCompilation>true</MultiProcessorCompilation>\r
<PreprocessorDefinitions>NDEBUG;_VC80_UPGRADE=0x0710;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <WholeProgramOptimization>true</WholeProgramOptimization>\r
+ <WholeProgramOptimization>false</WholeProgramOptimization>\r
<TreatWarningAsError>true</TreatWarningAsError>\r
</ClCompile>\r
<PreLinkEvent>\r