]> git.sesse.net Git - casparcg/blobdiff - core/video_channel_context.cpp
2.0 image_mixer: Refactored, core: Fixed destruction proxy usage.
[casparcg] / core / video_channel_context.cpp
index 677c1180e9696daddd86c3c9a33587aee8f9d07a..84806b2a3c8db3705a0aa7713026415c5fc90f10 100644 (file)
@@ -4,38 +4,58 @@
 \r
 namespace caspar { namespace core {\r
 \r
+struct video_channel_context::implementation\r
+{              \r
+       mutable tbb::spin_rw_mutex      mutex_;\r
+       const int                                       index_;\r
+       video_format_desc                       format_desc_;\r
+       executor                                        execution_;\r
+       executor                                        destruction_;\r
+       ogl_device&                                     ogl_;\r
+\r
+       implementation(int index, ogl_device& ogl, const video_format_desc& format_desc)\r
+               : index_(index)\r
+               , format_desc_(format_desc)\r
+               , execution_(print() + L"/execution")\r
+               , destruction_(print() + L"/destruction")\r
+               , ogl_(ogl)\r
+       {\r
+               execution_.set_priority_class(above_normal_priority_class);\r
+               destruction_.set_priority_class(below_normal_priority_class);\r
+       }\r
+\r
+       std::wstring print() const\r
+       {\r
+               return L"video_channel[" + boost::lexical_cast<std::wstring>(index_+1) + L"|" +  format_desc_.name + L"]";\r
+       }\r
+};\r
+\r
 video_channel_context::video_channel_context(int index, ogl_device& ogl, const video_format_desc& format_desc) \r
-       : index_(index)\r
-       , format_desc_(format_desc)\r
-       , execution_(print() + L"/execution")\r
-       , destruction_(print() + L"/destruction")\r
-       , ogl_(ogl)\r
+       : impl_(new implementation(index, ogl, format_desc))\r
 {\r
-       execution_.set_priority_class(above_normal_priority_class);\r
-       destruction_.set_priority_class(below_normal_priority_class);\r
 }\r
 \r
-const int video_channel_context::index() const {return index_;}\r
+const int video_channel_context::index() const {return impl_->index_;}\r
 \r
 video_format_desc video_channel_context::get_format_desc()\r
 {\r
-       tbb::spin_rw_mutex::scoped_lock lock(mutex_, false);\r
-       return format_desc_;\r
+       tbb::spin_rw_mutex::scoped_lock lock(impl_->mutex_, false);\r
+       return impl_->format_desc_;\r
 }\r
 \r
 void video_channel_context::set_format_desc(const video_format_desc& format_desc)\r
 {\r
-       tbb::spin_rw_mutex::scoped_lock lock(mutex_, true);\r
-       format_desc_ = format_desc;\r
+       tbb::spin_rw_mutex::scoped_lock lock(impl_->mutex_, true);\r
+       impl_->format_desc_ = format_desc;\r
 }\r
 \r
-executor& video_channel_context::execution() {return execution_;}\r
-executor& video_channel_context::destruction() {return destruction_;}\r
-ogl_device& video_channel_context::ogl() { return ogl_;}\r
+executor& video_channel_context::execution() {return impl_->execution_;}\r
+executor& video_channel_context::destruction() {return impl_->destruction_;}\r
+ogl_device& video_channel_context::ogl() { return impl_->ogl_;}\r
 \r
 std::wstring video_channel_context::print() const\r
 {\r
-       return L"video_channel[" + boost::lexical_cast<std::wstring>(index_+1) + L"|" +  format_desc_.name + L"]";\r
+       return impl_->print();\r
 }\r
 \r
 }}
\ No newline at end of file