- CASPAR_LOG(info) << L"Copyright (c) 2010 Sveriges Television AB, www.casparcg.com, <info@casparcg.com>";\r
- CASPAR_LOG(info) << L"Starting CasparCG Video Playout Server.";\r
- CASPAR_LOG(info) << L"Server Version: " << env::version();\r
- CASPAR_LOG(info) << L"Flash Version: " << flash::flash_producer::version();\r
- CASPAR_LOG(info) << L"Template-Host Version: " << flash::cg_producer::version();\r
- \r
- log::add_file_sink(env::log_folder());\r
+ // Increase process priotity.\r
+ SetPriorityClass(GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS);\r
+\r
+ // Install structured exception handler.\r
+ caspar::win32_exception::install_handler();\r
+ \r
+ // Increase time precision. This will increase accuracy of function like Sleep(1) from 10 ms to 1 ms.\r
+ struct inc_prec\r
+ {\r
+ inc_prec(){timeBeginPeriod(1);}\r
+ ~inc_prec(){timeEndPeriod(1);}\r
+ } inc_prec; \r
+\r
+ // Install unstructured exception handlers into all tbb threads.\r
+ struct tbb_thread_installer : public tbb::task_scheduler_observer\r
+ {\r
+ tbb_thread_installer(){observe(true);}\r
+ void on_scheduler_entry(bool is_worker)\r
+ {\r
+ //caspar::detail::SetThreadName(GetCurrentThreadId(), "tbb-worker-thread");\r
+ caspar::win32_exception::install_handler();\r
+ }\r
+ } tbb_thread_installer;\r
+\r
+ tbb::task_scheduler_init init;\r
+ \r
+ try \r
+ {\r
+ // Configure environment properties from configuration.\r
+ caspar::env::configure("casparcg.config");\r
+\r
+ #ifdef _DEBUG\r
+ if(caspar::env::properties().get("configuration.debugging.remote", false))\r
+ MessageBox(nullptr, TEXT("Now is the time to connect for remote debugging..."), TEXT("Debug"), MB_OK | MB_TOPMOST);\r
+ #endif \r
+\r
+ // Start logging to file.\r
+ caspar::log::add_file_sink(caspar::env::log_folder());\r
+ \r
+ // Setup console window.\r
+ setup_console_window();\r
+\r
+ // Print environment information.\r
+ print_info();\r