3 #include "accelerator.h"
6 #include "cpu/image/image_mixer.h"
8 #include "ogl/image/image_mixer.h"
10 #include "ogl/util/device.h"
12 #include <common/env.h>
14 #include <tbb/mutex.h>
16 namespace caspar { namespace accelerator {
18 struct accelerator::impl
20 const std::wstring path_;
22 std::shared_ptr<ogl::device> ogl_device_;
24 impl(const std::wstring& path)
29 std::unique_ptr<core::image_mixer> create_image_mixer()
33 if(path_ == L"gpu" || path_ == L"ogl" || path_ == L"auto" || path_ == L"default")
35 tbb::mutex::scoped_lock lock(mutex_);
38 ogl_device_.reset(new ogl::device());
40 return std::unique_ptr<core::image_mixer>(new ogl::image_mixer(spl::make_shared_ptr(ogl_device_), env::properties().get(L"configuration.mixer.blend-modes", false)));
45 if(path_ == L"gpu" || path_ == L"ogl")
46 CASPAR_LOG_CURRENT_EXCEPTION();
49 return std::unique_ptr<core::image_mixer>(new cpu::image_mixer());
51 CASPAR_THROW_EXCEPTION(not_supported());
56 accelerator::accelerator(const std::wstring& path)
57 : impl_(new impl(path))
61 accelerator::~accelerator()
65 std::unique_ptr<core::image_mixer> accelerator::create_image_mixer()
67 return impl_->create_image_mixer();