3 #include <common/concurrency/executor.h>
\r
5 #include <core/mixer/gpu/ogl_device.h>
\r
6 #include <core/video_format.h>
\r
8 #include <tbb/spin_rw_mutex.h>
\r
10 #include <boost/noncopyable.hpp>
\r
11 #include <boost/lexical_cast.hpp>
\r
15 namespace caspar { namespace core {
\r
17 class video_channel_context
\r
19 mutable tbb::spin_rw_mutex mutex_;
\r
21 video_format_desc format_desc_;
\r
22 executor execution_;
\r
23 executor destruction_;
\r
27 video_channel_context(int index, ogl_device& ogl, const video_format_desc& format_desc)
\r
29 , format_desc_(format_desc)
\r
30 , execution_(print() + L"/execution")
\r
31 , destruction_(print() + L"/destruction")
\r
34 execution_.set_priority_class(above_normal_priority_class);
\r
35 destruction_.set_priority_class(below_normal_priority_class);
\r
38 const int index() const {return index_;}
\r
40 video_format_desc get_format_desc()
\r
42 tbb::spin_rw_mutex::scoped_lock lock(mutex_, false);
\r
43 return format_desc_;
\r
46 void set_format_desc(const video_format_desc& format_desc)
\r
48 tbb::spin_rw_mutex::scoped_lock lock(mutex_, true);
\r
49 format_desc_ = format_desc;
\r
52 executor& execution() {return execution_;}
\r
53 executor& destruction() {return destruction_;}
\r
54 ogl_device& ogl() { return ogl_;}
\r
56 std::wstring print() const
\r
58 return L"video_channel[" + boost::lexical_cast<std::wstring>(index_+1) + L"-" + format_desc_.name + L"]";
\r