\r
#include "../interop/DeckLinkAPI_h.h"\r
#include "../util/util.h"\r
+#include "../util/decklink_allocator.h"\r
\r
#include "../../ffmpeg/producer/filter/filter.h"\r
#include "../../ffmpeg/producer/util/util.h"\r
#include <common/concurrency/com_context.h>\r
#include <common/diagnostics/graph.h>\r
#include <common/exception/exceptions.h>\r
+#include <common/exception/win32_exception.h>\r
#include <common/log/log.h>\r
#include <common/memory/memclr.h>\r
\r
boost::timer tick_timer_;\r
boost::timer frame_timer_;\r
\r
+ std::unique_ptr<thread_safe_decklink_allocator> allocator_;\r
CComPtr<IDeckLink> decklink_;\r
CComQIPtr<IDeckLinkInput> input_;\r
CComQIPtr<IDeckLinkAttributes > attributes_;\r
diagnostics::register_graph(graph_);\r
\r
auto display_mode = get_display_mode(input_, format_desc_.format, bmdFormat8BitYUV, bmdVideoInputFlagDefault);\r
- \r
+ \r
+ allocator_.reset(new thread_safe_decklink_allocator(print()));\r
+\r
+ if(FAILED(input_->SetVideoInputFrameMemoryAllocator(allocator_.get()))) \r
+ BOOST_THROW_EXCEPTION(caspar_exception()\r
+ << msg_info(narrow(print()) + " Could not enable use of custom allocator.")\r
+ << boost::errinfo_api_function("SetVideoInputFrameMemoryAllocator"));\r
+\r
// NOTE: bmdFormat8BitARGB is currently not supported by any decklink card. (2011-05-08)\r
if(FAILED(input_->EnableVideoInput(display_mode, bmdFormat8BitYUV, bmdVideoInputFlagDefault))) \r
BOOST_THROW_EXCEPTION(caspar_exception() \r
\r
virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived(IDeckLinkVideoInputFrame* video, IDeckLinkAudioInputPacket* audio)\r
{ \r
+ win32_exception::ensure_handler_installed_for_thread("decklink-VideoInputFrameArrived");\r
if(!video)\r
return S_OK;\r
\r