]> 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>
Sat, 22 Oct 2011 23:41:16 +0000 (23:41 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Sat, 22 Oct 2011 23:41:16 +0000 (23:41 +0000)
common/common.vcxproj
common/common.vcxproj.filters
common/concurrency/com_context.h [deleted file]
core/mixer/audio/audio_mixer.cpp
core/mixer/mixer.cpp
modules/decklink/consumer/decklink_consumer.cpp
modules/decklink/producer/decklink_producer.cpp
modules/flash/producer/flash_producer.cpp
shell/casparcg.config

index db2b9a39a81722d94eb99246aa722e632e9fc309..83a81b32812978cac1c31304ecdffd07a58080d6 100644 (file)
   </ItemDefinitionGroup>\r
   <ItemGroup>\r
     <ClInclude Include="compiler\vs\disable_silly_warnings.h" />\r
-    <ClInclude Include="concurrency\com_context.h" />\r
     <ClInclude Include="concurrency\executor.h" />\r
     <ClInclude Include="concurrency\message.h" />\r
     <ClInclude Include="diagnostics\graph.h" />\r
index 505a3e1ae6f806b79023be930d23d37ecca5401d..ef626f0123b5f99ab987bceaeee22524d700c3fc 100644 (file)
     <ClInclude Include="os\windows\system_info.h">\r
       <Filter>source\os\windows</Filter>\r
     </ClInclude>\r
-    <ClInclude Include="concurrency\com_context.h">\r
-      <Filter>source\concurrency</Filter>\r
-    </ClInclude>\r
     <ClInclude Include="memory\memshfl.h">\r
       <Filter>source\memory</Filter>\r
     </ClInclude>\r
diff --git a/common/concurrency/com_context.h b/common/concurrency/com_context.h
deleted file mode 100644 (file)
index b3b985d..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-#pragma once\r
-\r
-#include "executor.h"\r
-\r
-#include "../log/log.h"\r
-#include "../exception/exceptions.h"\r
-\r
-#define NOMINMAX\r
-#define WIN32_LEAN_AND_MEAN\r
-\r
-#include <Windows.h>\r
-\r
-#include <boost/noncopyable.hpp>\r
-#include <boost/thread/future.hpp>\r
-\r
-#include <functional>\r
-\r
-namespace caspar {\r
-\r
-template<typename T>\r
-class com_context : public executor\r
-{\r
-       std::unique_ptr<T> instance_;\r
-public:\r
-       com_context(const std::wstring& name) : executor(name)\r
-       {\r
-               executor::begin_invoke([]\r
-               {\r
-                       ::CoInitialize(nullptr);\r
-               });\r
-       }\r
-\r
-       ~com_context()\r
-       {\r
-               if(!executor::begin_invoke([&]\r
-               {\r
-                       instance_.reset(nullptr);\r
-                       ::CoUninitialize();\r
-               }).timed_wait(boost::posix_time::milliseconds(500)))\r
-               {\r
-                       CASPAR_LOG(error) << L"[com_contex] Timer expired, deadlock detected and released, leaking resources.";\r
-               }\r
-       }\r
-       \r
-       void reset(const std::function<T*()>& factory = nullptr)\r
-       {\r
-               executor::invoke([&]\r
-               {\r
-                       instance_.reset();\r
-                       if(factory)\r
-                               instance_.reset(factory());\r
-               });\r
-       }\r
-\r
-       T& operator*() const \r
-       {\r
-               if(instance_ == nullptr)\r
-                       BOOST_THROW_EXCEPTION(invalid_operation() << msg_info("Tried to access null context."));\r
-\r
-               return *instance_.get();\r
-       }  // noexcept\r
-\r
-       T* operator->() const \r
-       {\r
-               if(instance_ == nullptr)\r
-                       BOOST_THROW_EXCEPTION(invalid_operation() << msg_info("Tried to access null context."));\r
-               return instance_.get();\r
-       }  // noexcept\r
-\r
-       T* get() const\r
-       {\r
-               return instance_.get();\r
-       }  // noexcept\r
-\r
-       operator bool() const {return get() != nullptr;}\r
-};\r
-\r
-}
\ No newline at end of file
index 798a144263cca882950de7a25c1a1bc36c1167ee..b0e0f5b5bb80c454e62d42321a9f24b1a91564ca 100644 (file)
@@ -41,7 +41,7 @@ struct audio_mixer::implementation
        std::stack<core::frame_transform>                               transform_stack_;\r
        std::map<const void*, core::frame_transform>    prev_frame_transforms_;\r
        const core::video_format_desc                                   format_desc_;\r
-       std::vector<audio_item>                                                 items;\r
+       std::vector<audio_item>                                                 items_;\r
 \r
 public:\r
        implementation(const core::video_format_desc& format_desc)\r
@@ -73,7 +73,7 @@ public:
                item.transform  = transform_stack_.top();\r
                item.audio_data = std::move(frame.audio_data());\r
 \r
-               items.push_back(item);          \r
+               items_.push_back(item);         \r
        }\r
 \r
        void begin(const core::frame_transform& transform)\r
@@ -94,7 +94,7 @@ public:
 \r
                std::map<const void*, core::frame_transform> next_frame_transforms;\r
                \r
-               BOOST_FOREACH(auto& item, items)\r
+               BOOST_FOREACH(auto& item, items_)\r
                {                       \r
                        const auto next = item.transform;\r
                        auto prev = next;\r
@@ -166,7 +166,7 @@ public:
                        _mm_stream_si128(result_128++, _mm_cvtps_epi32(xmm7));\r
                }\r
 \r
-               items.clear();\r
+               items_.clear();\r
                prev_frame_transforms_ = std::move(next_frame_transforms);      \r
 \r
                result.resize(format_desc_.audio_samples_per_frame);\r
index 8f4c39cca82070278e4838becba24a0cad783333..c0bb80189aac33be6b3a1e9aa352622b12852705 100644 (file)
@@ -87,8 +87,6 @@ public:
 struct mixer::implementation : boost::noncopyable\r
 {              \r
        critical_section                        mutex_;\r
-       Concurrency::transformer<safe_ptr<message<std::map<int, safe_ptr<basic_frame>>>>, \r
-                                                        safe_ptr<message<safe_ptr<core::read_frame>>>> mixer_;\r
 \r
        const video_format_desc format_desc_;\r
        ogl_device&                             ogl_;\r
@@ -101,7 +99,8 @@ struct mixer::implementation : boost::noncopyable
 \r
        std::queue<std::pair<boost::unique_future<safe_ptr<host_buffer>>, core::audio_buffer>> buffer_;\r
        \r
-\r
+       Concurrency::transformer<safe_ptr<message<std::map<int, safe_ptr<basic_frame>>>>, \r
+                                                        safe_ptr<message<safe_ptr<core::read_frame>>>> mixer_;\r
 public:\r
        implementation(mixer::source_t& source, mixer::target_t& target, const video_format_desc& format_desc, ogl_device& ogl) \r
                : format_desc_(format_desc)\r
index d86e86ff3e6e0a4782cb2edd50282908a19cc296..5757668e397de208326f317008e9843d3f74071f 100644 (file)
@@ -28,7 +28,6 @@
 \r
 #include <core/mixer/read_frame.h>\r
 \r
-#include <common/concurrency/com_context.h>\r
 #include <common/diagnostics/graph.h>\r
 #include <common/exception/exceptions.h>\r
 #include <common/memory/memcpy.h>\r
@@ -411,20 +410,24 @@ public:
 \r
 struct decklink_consumer_proxy : public core::frame_consumer\r
 {\r
-       const configuration                             config_;\r
-       com_context<decklink_consumer>  context_;\r
-       core::video_format_desc                 format_desc_;\r
+       const configuration                                     config_;\r
+       std::unique_ptr<decklink_consumer>      context_;\r
+       core::video_format_desc                         format_desc_;\r
 public:\r
 \r
        decklink_consumer_proxy(const configuration& config)\r
                : config_(config)\r
-               , context_(L"decklink_consumer[" + boost::lexical_cast<std::wstring>(config.device_index) + L"]")\r
        {\r
        }\r
 \r
        ~decklink_consumer_proxy()\r
        {\r
                auto str = print();\r
+               struct co_init\r
+               {\r
+                       co_init(){CoInitialize(nullptr);}\r
+                       ~co_init(){CoUninitialize();}\r
+               } init;         \r
                context_.reset();\r
                CASPAR_LOG(info) << str << L" Successfully Uninitialized.";     \r
        }\r
@@ -432,7 +435,12 @@ public:
        virtual void initialize(const core::video_format_desc& format_desc)\r
        {\r
                format_desc_ = format_desc;\r
-               context_.reset([&]{return new decklink_consumer(config_, format_desc_);});              \r
+               struct co_init\r
+               {\r
+                       co_init(){CoInitialize(nullptr);}\r
+                       ~co_init(){CoUninitialize();}\r
+               } init;         \r
+               context_.reset(new decklink_consumer(config_, format_desc_));           \r
                                \r
                CASPAR_LOG(info) << print() << L" Successfully Initialized.";   \r
        }\r
index 6cb6888d674285113126f699745f4d49af499f5c..6fa2e54d7ec88e08f8f0a4ecfb214dea62e2435a 100644 (file)
@@ -31,7 +31,6 @@
 \r
 #include <common/log/log.h>\r
 #include <common/diagnostics/graph.h>\r
-#include <common/concurrency/com_context.h>\r
 #include <common/exception/exceptions.h>\r
 #include <common/memory/memclr.h>\r
 \r
index 46c83700e7c29b17df3ef1e4175c5efdb5e2d296..6652165e472d0649e9c72a5e82cf594f451bc09c 100644 (file)
@@ -35,7 +35,6 @@
 #include <core/mixer/write_frame.h>\r
 \r
 #include <common/env.h>\r
-#include <common/concurrency/com_context.h>\r
 #include <common/diagnostics/graph.h>\r
 #include <common/memory/memcpy.h>\r
 #include <common/memory/memclr.h>\r
index a19056ea4b5b676314a59de4b0c54d9ad931af36..cbe9c3be9195ca649c4d763e4a4880438b217d04 100644 (file)
@@ -43,7 +43,7 @@
     </producers>\r
     <channels>\r
       <channel>\r
-        <video-mode>PAL</video-mode>\r
+        <video-mode>1080i5000</video-mode>\r
         <consumers>\r
           <decklink>\r
             <device>1</device>\r