namespace caspar { namespace core { namespace decklink{\r
\r
struct decklink_consumer::implementation : public IDeckLinkVideoOutputCallback, public IDeckLinkAudioOutputCallback, boost::noncopyable\r
-{ \r
+{ \r
struct co_init\r
{\r
- co_init()\r
- {\r
- if(FAILED(CoInitialize(nullptr))) \r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info("DECKLINK: Initialization of COM failed.")); \r
- }\r
- ~co_init()\r
- {\r
- CoUninitialize();\r
- }\r
+ co_init(){CoInitialize(nullptr);}\r
+ ~co_init(){CoUninitialize();}\r
} co_;\r
\r
std::array<std::pair<void*, CComPtr<IDeckLinkMutableVideoFrame>>, 3> reserved_frames_;\r
\r
#include <boost/range/algorithm_ext/erase.hpp>\r
#include <boost/range/algorithm.hpp>\r
+#include <boost/circular_buffer.hpp>\r
\r
namespace caspar { namespace core {\r
\r
timer clock_;\r
executor executor_; \r
\r
- size_t depth_;\r
- std::deque<safe_ptr<const read_frame>> buffer_; \r
+ boost::circular_buffer<safe_ptr<const read_frame>> buffer_;\r
\r
std::vector<safe_ptr<frame_consumer>> consumers_;\r
\r
\r
std::vector<size_t> depths;\r
boost::range::transform(consumers_, std::back_inserter(depths), std::mem_fn(&frame_consumer::buffer_depth));\r
- depth_ = *boost::range::max_element(depths);\r
+ buffer_.set_capacity(*boost::range::max_element(depths));\r
executor_.set_capacity(3);\r
executor_.start();\r
}\r
{\r
buffer_.push_back(frame);\r
\r
- if(buffer_.size() < depth_)\r
+ if(!buffer_.full())\r
return;\r
\r
boost::range::for_each(consumers_, [&](const safe_ptr<frame_consumer>& consumer)\r
CASPAR_LOG(warning) << "Removed consumer from frame_consumer_device.";\r
}\r
});\r
-\r
- buffer_.pop_front();\r
\r
clock_.wait(fmt_.fps);\r
});\r
{\r
struct co_init\r
{\r
- co_init()\r
- {\r
- if(FAILED(CoInitialize(nullptr))) \r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info("DECKLINK: Initialization of COM failed.")); \r
- }\r
- ~co_init()\r
- {\r
- CoUninitialize();\r
- }\r
+ co_init(){CoInitialize(nullptr);}\r
+ ~co_init(){CoUninitialize();}\r
} co_;\r
\r
const video_format_desc format_desc_;\r
\r
#include <common/log/log.h>\r
\r
+#if defined(_MSC_VER)\r
+#pragma warning (push, 2) // TODO\r
+#endif\r
+\r
using namespace ATL;\r
\r
namespace caspar { namespace flash {\r
{\r
struct co_init\r
{\r
- co_init()\r
- {\r
- if(FAILED(CoInitialize(nullptr))) \r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info("Initialization of COM failed.")); \r
- }\r
- ~co_init()\r
- {\r
- CoUninitialize();\r
- }\r
+ co_init(){CoInitialize(nullptr);}\r
+ ~co_init(){CoUninitialize();}\r
} co_;\r
\r
const std::wstring filename_;\r
void preview(const safe_ptr<frame_producer>& frame_producer)\r
{\r
stop();\r
- load(frame_producer, false); \r
+ load(frame_producer, false); \r
try\r
{\r
last_frame_ = frame_producer->receive();\r
catch(...)\r
{\r
CASPAR_LOG_CURRENT_EXCEPTION();\r
- CASPAR_LOG(warning) << print() << L" empty => background";\r
- background_ = frame_producer::empty();\r
+ clear();\r
}\r
}\r
\r
\r
void stop()\r
{\r
- is_paused_ = false;\r
+ pause();\r
last_frame_ = draw_frame::empty();\r
foreground_ = frame_producer::empty();\r
+ CASPAR_LOG(warning) << print() << L" empty => foreground";\r
}\r
\r
void clear()\r
{\r
- is_paused_ = false;\r
- last_frame_ = draw_frame::empty();\r
- foreground_ = frame_producer::empty();\r
+ stop();\r
background_ = frame_producer::empty();\r
+ CASPAR_LOG(warning) << print() << L" empty => background";\r
}\r
\r
safe_ptr<draw_frame> receive()\r
catch(...)\r
{\r
CASPAR_LOG_CURRENT_EXCEPTION();\r
- foreground_ = frame_producer::empty();\r
- last_frame_ = draw_frame::empty();\r
- CASPAR_LOG(warning) << print() << L" empty => foreground";\r
+ stop();\r
}\r
\r
return last_frame_;\r
wcmd = L"LOAD 1-1 720p2500";\r
else if(wcmd.substr(0, 1) == L"8")\r
wcmd = L"LOAD 1-1 #FFFFFFFF AUTOPLAY";\r
+ else if(wcmd.substr(0, 1) == L"9")\r
+ wcmd = L"LOADBG 1-2 " + wcmd.substr(1, wcmd.length()-1) + L" [1.0-2.0] LOOP AUTOPLAY";\r
\r
wcmd += L"\r\n";\r
amcp.Parse(wcmd.c_str(), wcmd.length(), dummy);\r