X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=shell%2Fmain.cpp;h=97c9760b1420fa0ff102db8a7a8f8eb31bd00f42;hb=ac7b3acb915f90de6b224e54a2240023fc221e5a;hp=78e82875f545438a57ad6e873cd784ce8657df4c;hpb=fe6400521853f4d44fc2aba573d291a1aa2e0299;p=casparcg diff --git a/shell/main.cpp b/shell/main.cpp index 78e82875f..97c9760b1 100644 --- a/shell/main.cpp +++ b/shell/main.cpp @@ -17,15 +17,16 @@ * along with CasparCG. If not, see . * */ -#include "resource.h" - -#include "server.h" // tbbmalloc_proxy: // Replace the standard memory allocation routines in Microsoft* C/C++ RTL // (malloc/free, global new/delete, etc.) with the TBB memory allocator. #include +#include "resource.h" + +#include "server.h" + #ifdef _DEBUG #define _CRTDBG_MAP_ALLOC #include @@ -33,12 +34,13 @@ #endif #define NOMINMAX +#define WIN32_LEAN_AND_MEAN #include +#include +#include #include -#include - #include #include @@ -54,14 +56,16 @@ #include #include #include -#include -#include +#include + #include +#include -#include #include +#include + // NOTE: This is needed in order to make CComObject work since this is not a real ATL project. CComModule _AtlModule; extern __declspec(selectany) CAtlModule* _pAtlModule = &_AtlModule; @@ -118,34 +122,55 @@ void print_info() CASPAR_LOG(info) << L"on " << caspar::get_win_product_name() << L" " << caspar::get_win_sp_version(); CASPAR_LOG(info) << caspar::get_cpu_info(); CASPAR_LOG(info) << caspar::get_system_product_name(); - CASPAR_LOG(info) << L"Flash " << caspar::get_flash_version(); - CASPAR_LOG(info) << L"Flash-Template-Host " << caspar::get_cg_version(); - CASPAR_LOG(info) << L"FreeImage " << caspar::get_image_version(); + CASPAR_LOG(info) << L"Flash " << caspar::flash::get_version(); + CASPAR_LOG(info) << L"Flash-Template-Host " << caspar::flash::get_cg_version(); + CASPAR_LOG(info) << L"FreeImage " << caspar::image::get_version(); - CASPAR_LOG(info) << L"Decklink " << caspar::get_decklink_version(); - BOOST_FOREACH(auto& device, caspar::get_decklink_device_list()) + CASPAR_LOG(info) << L"Decklink " << caspar::decklink::get_version(); + auto deck = caspar::decklink::get_device_list(); + std::for_each(deck.begin(), deck.end(), [](const std::wstring& device) + { CASPAR_LOG(info) << device; + }); - CASPAR_LOG(info) << L"Bluefish " << caspar::get_bluefish_version(); - BOOST_FOREACH(auto& device, caspar::get_bluefish_device_list()) + auto blue = caspar::bluefish::get_device_list(); + std::for_each(blue.begin(), blue.end(), [](const std::wstring& device) + { CASPAR_LOG(info) << device; - - CASPAR_LOG(info) << L"FFMPEG-avcodec " << caspar::get_avcodec_version(); - CASPAR_LOG(info) << L"FFMPEG-avformat " << caspar::get_avformat_version(); - CASPAR_LOG(info) << L"FFMPEG-avfilter " << caspar::get_avfilter_version(); - CASPAR_LOG(info) << L"FFMPEG-avutil " << caspar::get_avutil_version(); - CASPAR_LOG(info) << L"FFMPEG-swscale " << caspar::get_swscale_version(); + }); + + CASPAR_LOG(info) << L"FFMPEG-avcodec " << caspar::ffmpeg::get_avcodec_version(); + CASPAR_LOG(info) << L"FFMPEG-avformat " << caspar::ffmpeg::get_avformat_version(); + CASPAR_LOG(info) << L"FFMPEG-avfilter " << caspar::ffmpeg::get_avfilter_version(); + CASPAR_LOG(info) << L"FFMPEG-avutil " << caspar::ffmpeg::get_avutil_version(); + CASPAR_LOG(info) << L"FFMPEG-swscale " << caspar::ffmpeg::get_swscale_version(); CASPAR_LOG(info) << L"OpenGL " << caspar::core::ogl_device::get_version() << "\n\n"; } - + +LONG WINAPI UserUnhandledExceptionFilter(EXCEPTION_POINTERS* info) +{ + try + { + CASPAR_LOG(fatal) << L"#######################\n UNHANDLED EXCEPTION: \n" + << L"Adress:" << info->ExceptionRecord->ExceptionAddress << L"\n" + << L"Code:" << info->ExceptionRecord->ExceptionCode << L"\n" + << L"Flag:" << info->ExceptionRecord->ExceptionFlags << L"\n" + << L"Info:" << info->ExceptionRecord->ExceptionInformation << L"\n" + << L"Continuing execution. \n#######################"; + } + catch(...){} + + return EXCEPTION_CONTINUE_EXECUTION; +} + int main(int argc, wchar_t* argv[]) { static_assert(sizeof(void*) == 4, "64-bit code generation is not supported."); - CASPAR_LOG(info) << L"Type \"q\" to close application"; - - CASPAR_LOG(info) << L"THIS IS AN ALPHA BUILD"; + SetUnhandledExceptionFilter(UserUnhandledExceptionFilter); + CASPAR_LOG(info) << L"Type \"q\" to close application"; + // Set debug mode. #ifdef _DEBUG _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF ); @@ -173,10 +198,12 @@ int main(int argc, wchar_t* argv[]) tbb_thread_installer(){observe(true);} void on_scheduler_entry(bool is_worker) { - caspar::detail::SetThreadName(GetCurrentThreadId(), "tbb-worker-thread"); + //caspar::detail::SetThreadName(GetCurrentThreadId(), "tbb-worker-thread"); caspar::win32_exception::install_handler(); } } tbb_thread_installer; + + tbb::task_scheduler_init init; try { @@ -221,6 +248,16 @@ int main(int argc, wchar_t* argv[]) wcmd = L"CG 1-2 ADD 1 BBTELEFONARE 1"; else if(wcmd.substr(0, 1) == L"4") wcmd = L"PLAY 1-1 DV FILTER yadif=1:-1 LOOP"; + else if(wcmd.substr(0, 1) == L"5") + { + auto file = wcmd.substr(2, wcmd.length()-1); + wcmd = L"PLAY 1-1 " + file + L" LOOP\r\n" + L"PLAY 1-2 " + file + L" LOOP\r\n" + L"PLAY 1-3 " + file + L" LOOP\r\n" + L"PLAY 2-1 " + file + L" LOOP\r\n" + L"PLAY 2-2 " + file + L" LOOP\r\n" + L"PLAY 2-3 " + file + L" LOOP\r\n"; + } else if(wcmd.substr(0, 1) == L"X") { int num = 0; @@ -244,7 +281,7 @@ int main(int argc, wchar_t* argv[]) n++; } - wcmd = L"MIXER 1 VIDEO GRID " + boost::lexical_cast(n); + wcmd = L"MIXER 1 GRID " + boost::lexical_cast(n); for(int i = 1; i <= num; ++i) wcmd += L"\r\nPLAY 1-" + boost::lexical_cast(i) + L" " + file + L" LOOP";// + L" SLIDE 100 LOOP"; @@ -262,7 +299,6 @@ int main(int argc, wchar_t* argv[]) catch(caspar::gl::ogl_exception&) { CASPAR_LOG_CURRENT_EXCEPTION(); - CASPAR_LOG(fatal) << L"Unhandled OpenGL Error in main thread. Please try to update graphics drivers in order to receive full OpenGL 3.1+ Support."; } catch(...)