</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
<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
+++ /dev/null
-#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
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
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
\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
_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
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
\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
\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
\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
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
\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
#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
</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