X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=core%2Fvideo_channel_context.cpp;h=84806b2a3c8db3705a0aa7713026415c5fc90f10;hb=a486c25d5e6ce0ebe08e9a2d793a447ff3cb797a;hp=677c1180e9696daddd86c3c9a33587aee8f9d07a;hpb=8f091990c8e3c1997b4b2d89f97b319cb6ea889d;p=casparcg diff --git a/core/video_channel_context.cpp b/core/video_channel_context.cpp index 677c1180e..84806b2a3 100644 --- a/core/video_channel_context.cpp +++ b/core/video_channel_context.cpp @@ -4,38 +4,58 @@ namespace caspar { namespace core { +struct video_channel_context::implementation +{ + mutable tbb::spin_rw_mutex mutex_; + const int index_; + video_format_desc format_desc_; + executor execution_; + executor destruction_; + ogl_device& ogl_; + + implementation(int index, ogl_device& ogl, const video_format_desc& format_desc) + : index_(index) + , format_desc_(format_desc) + , execution_(print() + L"/execution") + , destruction_(print() + L"/destruction") + , ogl_(ogl) + { + execution_.set_priority_class(above_normal_priority_class); + destruction_.set_priority_class(below_normal_priority_class); + } + + std::wstring print() const + { + return L"video_channel[" + boost::lexical_cast(index_+1) + L"|" + format_desc_.name + L"]"; + } +}; + video_channel_context::video_channel_context(int index, ogl_device& ogl, const video_format_desc& format_desc) - : index_(index) - , format_desc_(format_desc) - , execution_(print() + L"/execution") - , destruction_(print() + L"/destruction") - , ogl_(ogl) + : impl_(new implementation(index, ogl, format_desc)) { - execution_.set_priority_class(above_normal_priority_class); - destruction_.set_priority_class(below_normal_priority_class); } -const int video_channel_context::index() const {return index_;} +const int video_channel_context::index() const {return impl_->index_;} video_format_desc video_channel_context::get_format_desc() { - tbb::spin_rw_mutex::scoped_lock lock(mutex_, false); - return format_desc_; + tbb::spin_rw_mutex::scoped_lock lock(impl_->mutex_, false); + return impl_->format_desc_; } void video_channel_context::set_format_desc(const video_format_desc& format_desc) { - tbb::spin_rw_mutex::scoped_lock lock(mutex_, true); - format_desc_ = format_desc; + tbb::spin_rw_mutex::scoped_lock lock(impl_->mutex_, true); + impl_->format_desc_ = format_desc; } -executor& video_channel_context::execution() {return execution_;} -executor& video_channel_context::destruction() {return destruction_;} -ogl_device& video_channel_context::ogl() { return ogl_;} +executor& video_channel_context::execution() {return impl_->execution_;} +executor& video_channel_context::destruction() {return impl_->destruction_;} +ogl_device& video_channel_context::ogl() { return impl_->ogl_;} std::wstring video_channel_context::print() const { - return L"video_channel[" + boost::lexical_cast(index_+1) + L"|" + format_desc_.name + L"]"; + return impl_->print(); } }} \ No newline at end of file