3 #include "accelerator.h"
\r
5 #include "cpu/image/image_mixer.h"
\r
6 #include "ogl/image/image_mixer.h"
\r
8 #include "ogl/util/device.h"
\r
10 #include <tbb/mutex.h>
\r
12 namespace caspar { namespace accelerator {
\r
14 struct accelerator::impl
\r
16 const std::wstring path_;
\r
18 std::shared_ptr<ogl::device> ogl_device_;
\r
20 impl(const std::wstring& path)
\r
25 std::unique_ptr<core::image_mixer> create_image_mixer()
\r
29 if(path_ == L"gpu" || path_ == L"ogl" || path_ == L"auto" || path_ == L"default")
\r
31 tbb::mutex::scoped_lock lock(mutex_);
\r
34 ogl_device_.reset(new ogl::device());
\r
36 return std::unique_ptr<core::image_mixer>(new ogl::image_mixer(spl::make_shared_ptr(ogl_device_)));
\r
41 if(path_ == L"gpu" || path_ == L"ogl")
\r
42 CASPAR_LOG_CURRENT_EXCEPTION();
\r
45 return std::unique_ptr<core::image_mixer>(new cpu::image_mixer());
\r
49 accelerator::accelerator(const std::wstring& path)
\r
50 : impl_(new impl(path))
\r
54 accelerator::~accelerator()
\r
58 std::unique_ptr<core::image_mixer> accelerator::create_image_mixer()
\r
60 return impl_->create_image_mixer();
\r