2 * copyright (c) 2010 Sveriges Television AB <info@casparcg.com>
\r
4 * This file is part of CasparCG.
\r
6 * CasparCG is free software: you can redistribute it and/or modify
\r
7 * it under the terms of the GNU General Public License as published by
\r
8 * the Free Software Foundation, either version 3 of the License, or
\r
9 * (at your option) any later version.
\r
11 * CasparCG is distributed in the hope that it will be useful,
\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 * GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License
\r
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
\r
23 #include <tbb/tbbmalloc_proxy.h>
\r
24 #include <tbb/task_scheduler_observer.h>
\r
27 #define _CRTDBG_MAP_ALLOC
\r
35 #include "protocol/amcp/AMCPProtocolStrategy.h"
\r
36 #include "../common/exception/win32_exception.h"
\r
38 using namespace caspar;
\r
39 using namespace caspar::core;
\r
40 using namespace caspar::common;
\r
42 class win32_handler_tbb_installer : public tbb::task_scheduler_observer
\r
45 win32_handler_tbb_installer() {observe(true);}
\r
46 void on_scheduler_entry(bool is_worker)
\r
48 CASPAR_LOG(debug) << L"Started TBB Worker Thread.";
\r
49 win32_exception::install_handler();
\r
53 int _tmain(int argc, _TCHAR* argv[])
\r
55 std::wstringstream str;
\r
56 str << "CasparCG " << CASPAR_VERSION_STR << " " << CASPAR_VERSION_TAG;
\r
57 SetConsoleTitle(str.str().c_str());
\r
59 CASPAR_LOG(info) << L"Starting CasparCG Video Playout Server Ver: " << CASPAR_VERSION_STR << " Tag: " << CASPAR_VERSION_TAG << std::endl;
\r
60 CASPAR_LOG(info) << L"Copyright (c) 2010 Sveriges Television AB <info@casparcg.com>\n\n" << std::endl;
\r
62 EnableMenuItem(GetSystemMenu(GetConsoleWindow(), FALSE), SC_CLOSE , MF_GRAYED);
\r
63 DrawMenuBar(GetConsoleWindow());
\r
64 MoveWindow(GetConsoleWindow(), 800, 0, 800, 1000, true);
\r
67 _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF );
\r
68 _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_DEBUG );
\r
69 _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_DEBUG );
\r
70 _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_DEBUG );
\r
72 MessageBox(nullptr, TEXT("Now is the time to connect for remote debugging..."), TEXT("Debug"), MB_OK | MB_TOPMOST);
\r
75 log::add_file_sink(server::log_folder());
\r
77 CASPAR_LOG(debug) << "Started Main Thread";
\r
79 win32_handler_tbb_installer win32_handler_tbb_installer;
\r
80 win32_exception::install_handler();
\r
84 server caspar_device;
\r
86 auto dummy = std::make_shared<IO::DummyClientInfo>();
\r
87 amcp::AMCPProtocolStrategy amcp(caspar_device.get_channels());
\r
88 bool is_running = true;
\r
92 std::getline(std::wcin, wcmd); // TODO: It's blocking...
\r
93 is_running = wcmd != L"exit" && wcmd != L"q";
\r
95 wcmd = L"LOADBG 1-1 DV SLIDE 100 LOOP AUTOPLAY";
\r
96 else if(wcmd == L"2")
\r
97 wcmd = L"LOADBG 1-1 DV PUSH 100 LOOP AUTOPLAY";
\r
98 else if(wcmd == L"3")
\r
99 wcmd = L"LOADBG 1-1 DV MIX 100 LOOP AUTOPLAY";
\r
100 else if(wcmd == L"4")
\r
101 wcmd = L"LOADBG 1-1 DV WIPE 100 LOOP AUTOPLAY";
\r
102 else if(wcmd == L"5")
\r
103 wcmd = L"LOADBG 1-1 DV CUT 100 LOOP AUTOPLAY";
\r
104 else if(wcmd == L"6")
\r
105 wcmd = L"CG 1-2 ADD 1 BBTELEFONARE 1";
\r
108 amcp.Parse(wcmd.c_str(), wcmd.length(), dummy);
\r
111 catch(const std::exception&)
\r
113 CASPAR_LOG(fatal) << "UNHANDLED EXCEPTION in main thread.";
\r
114 CASPAR_LOG_CURRENT_EXCEPTION();
\r
115 std::wcout << L"Press Any Key To Exit";
\r
118 CASPAR_LOG(debug) << "Ended Main Thread";
\r