]> git.sesse.net Git - casparcg/commitdiff
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches...
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Tue, 11 Jan 2011 20:15:21 +0000 (20:15 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Tue, 11 Jan 2011 20:15:21 +0000 (20:15 +0000)
common/common.vcxproj
core/core.vcxproj
core/core.vcxproj.filters
core/processor/draw_frame.cpp
core/processor/draw_frame.h
core/processor/write_frame.cpp
core/producer/ffmpeg/audio/audio_decoder.cpp
core/producer/ffmpeg/ffmpeg_producer.cpp
shell/caspar.config
shell/shell.vcxproj

index 4c158dcf79b4b003ef2bbb8a8178d7f4ff936608..b0f850144f51606f0347efcb938807326039284e 100644 (file)
@@ -80,7 +80,7 @@
       <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
index 0e2fe4cdf60161974812d0763c1fdcf285cbf796..1bb5443e484f477f57b641007b58bb4034e1da17 100644 (file)
       <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
index 2d0c1e0b305b5ea190d766eb6c7196aabce119c7..dc3f57a2971e851d0d03a961213cccc5567fbc13 100644 (file)
     <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
index a12cfbcfecf79b52ad324b6987e03795c868815b..177be619f804bb5abc1cb8326be2ba09739beac3 100644 (file)
@@ -90,6 +90,8 @@ void draw_frame::translate(double x, double y){impl_->image_transform_.pos = boo
 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
index 2d13b83b81015bdb2007cbd36082a1c1586cd540..5e6f51aec7410374e7f17c4dd302a6daec37f0b4 100644 (file)
@@ -14,6 +14,9 @@
 #include <vector>\r
 \r
 namespace caspar { namespace core {\r
+\r
+struct image_transform;\r
+struct audio_transform;\r
                \r
 class draw_frame\r
 {\r
@@ -40,6 +43,9 @@ public:
        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
index 76519e6f79027174c5b1e256febd74f6838af9c7..131b0a2594b6632ffaa1880ddc512d1815382473 100644 (file)
@@ -17,23 +17,29 @@ namespace caspar { namespace core {
                                                                                                                                                                                                                                                                                                                        \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
@@ -51,8 +57,12 @@ public:
                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
index 59a3fb5651fc5abd0a059b9365a8e9d9fc6a9cf4..24a80447a642886b52a8cd9e7d22b4057dddfac1 100644 (file)
@@ -37,21 +37,14 @@ public:
        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
index a2cb23183014a47892051bb759f873c9aa82c9a8..1bece957ce2ccdce2a7be6a7908e32a07acfd509 100644 (file)
@@ -109,7 +109,7 @@ public:
                {\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
index 2a1cf1d5fc79c85e5d70d7a874eaeb919fc27639..d32fa799885ec504080231f98f68ea833242b315 100644 (file)
     <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
index ab5a544b75e57f350c35c80dc756da5f2365b93c..1aa428be4b600ec9c116bb03aba426fa668867c4 100644 (file)
       <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