\r
class destroy_producer_proxy : public frame_producer\r
{ \r
- std::shared_ptr<frame_producer>* producer_;\r
+ std::unique_ptr<std::shared_ptr<frame_producer>> producer_;\r
public:\r
destroy_producer_proxy(safe_ptr<frame_producer>&& producer) \r
: producer_(new std::shared_ptr<frame_producer>(std::move(producer)))\r
CASPAR_LOG(trace) << "Created destroyer: " << destroyer_count;\r
}\r
\r
- auto producer = producer_;\r
+ auto producer = producer_.release();\r
auto pool = destroyers;\r
destroyer->begin_invoke([=]\r
{\r
+ std::unique_ptr<std::shared_ptr<frame_producer>> producer2(producer);\r
+\r
+ auto str = (*producer2)->print();\r
try\r
{\r
if(!producer->unique())\r
- CASPAR_LOG(trace) << (*producer)->print() << L" Not destroyed on safe asynchronous destruction thread: " << producer->use_count();\r
+ CASPAR_LOG(trace) << str << L" Not destroyed on safe asynchronous destruction thread: " << producer->use_count();\r
else\r
- CASPAR_LOG(trace) << (*producer)->print() << L" Destroying on safe asynchronous destruction thread.";\r
+ CASPAR_LOG(trace) << str << L" Destroying on safe asynchronous destruction thread.";\r
}\r
catch(...){}\r
-\r
- delete producer;\r
+ \r
+ producer2.reset();\r
+ CASPAR_LOG(debug) << str << L" Destroyed.";\r
pool->push(destroyer);\r
}); \r
}\r
CASPAR_LOG_CURRENT_EXCEPTION();\r
try\r
{\r
- delete producer_;\r
+ auto str = (*producer_)->print();\r
+ producer_.reset();\r
+ CASPAR_LOG(debug) << str << L" Destroyed.";\r
}\r
catch(...){}\r
}\r
CComPtr<IDeckLinkIterator> pDecklinkIterator;\r
if(SUCCEEDED(pDecklinkIterator.CoCreateInstance(CLSID_CDeckLinkIterator)))\r
{ \r
- CComPtr<IDeckLink> decklink;\r
+ IDeckLink* decklink;\r
for(int n = 1; pDecklinkIterator->Next(&decklink) == S_OK; ++n) \r
{\r
BSTR model_name = L"Unknown";\r
decklink->GetModelName(&model_name);\r
+ decklink->Release();\r
devices.push_back(std::wstring(model_name) + L" [" + boost::lexical_cast<std::wstring>(n) + L"]"); \r
}\r
}\r
{\r
av_lockmgr_register(ffmpeg_lock_callback);\r
av_log_set_callback(log_callback);\r
+\r
avfilter_register_all();\r
//fix_yadif_filter_format_query();\r
av_register_all();\r
displayDevices.push_back(d_device);\r
\r
if(config_.screen_index >= displayDevices.size())\r
- BOOST_THROW_EXCEPTION(out_of_range() << arg_name_info("screen_index_") << wmsg_info(print()));\r
+ CASPAR_LOG(warning) << print() << L" Invalid screen-index: " << config_.screen_index;\r
\r
DEVMODE devmode = {};\r
if(!EnumDisplaySettings(displayDevices[config_.screen_index].DeviceName, ENUM_CURRENT_SETTINGS, &devmode))\r
- BOOST_THROW_EXCEPTION(invalid_operation() << arg_name_info("screen_index") << wmsg_info(print() + L" EnumDisplaySettings"));\r
+ CASPAR_LOG(warning) << print() << L" Could not find display settings for screen-index: " << config_.screen_index;\r
\r
screen_x_ = devmode.dmPosition.x;\r
screen_y_ = devmode.dmPosition.y;\r
return true;\r
}\r
catch(file_not_found&)\r
- {\r
- CASPAR_LOG_CURRENT_EXCEPTION();\r
+ { \r
+ std::wstring params2;\r
+ for(auto it = _parameters.begin(); it != _parameters.end(); ++it)\r
+ params2 += L" " + *it;\r
+ CASPAR_LOG(error) << L"File not found. No match found for parameters. Check syntax:" << params2;\r
SetReplyString(TEXT("404 LOADBG ERROR\r\n"));\r
return false;\r
}\r
// tbbmalloc_proxy: \r
// Replace the standard memory allocation routines in Microsoft* C/C++ RTL \r
// (malloc/free, global new/delete, etc.) with the TBB memory allocator. \r
-#include <tbb/tbbmalloc_proxy.h>\r
-\r
-#include "resource.h"\r
-\r
-#include "server.h"\r
\r
#ifdef _DEBUG\r
#define _CRTDBG_MAP_ALLOC\r
#include <stdlib.h>\r
#include <crtdbg.h>\r
+#else\r
+ #include <tbb/tbbmalloc_proxy.h>\r
#endif\r
\r
+#include "resource.h"\r
+\r
+#include "server.h"\r
+\r
#define NOMINMAX\r
#define WIN32_LEAN_AND_MEAN\r
\r
\r
// Set debug mode.\r
#ifdef _DEBUG\r
- _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF );\r
- _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_DEBUG );\r
- _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_DEBUG );\r
- _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_DEBUG );\r
+ HANDLE hLogFile;\r
+ hLogFile = CreateFile(L"crt_log.txt", GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);\r
+ std::shared_ptr<void> crt_log(nullptr, [](HANDLE h){::CloseHandle(h);});\r
+\r
+ _CrtSetDbgFlag (_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);\r
+ _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);\r
+ _CrtSetReportFile(_CRT_WARN, hLogFile);\r
+ _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);\r
+ _CrtSetReportFile(_CRT_ERROR, hLogFile);\r
+ _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);\r
+ _CrtSetReportFile(_CRT_ASSERT, hLogFile);\r
#endif\r
\r
// Increase process priotity.\r