From 07ffb51024fb0f48efd4ab92f95d98faf77b16ed Mon Sep 17 00:00:00 2001 From: ronag Date: Sun, 13 Nov 2011 18:38:21 +0000 Subject: [PATCH] git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.2@1565 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d --- shell/main.cpp | 139 +++++++++++++++++++++++++------------------------ 1 file changed, 70 insertions(+), 69 deletions(-) diff --git a/shell/main.cpp b/shell/main.cpp index 3761c41fe..caa1b27a2 100644 --- a/shell/main.cpp +++ b/shell/main.cpp @@ -210,91 +210,92 @@ int main(int argc, wchar_t* argv[]) try { - // Configure environment properties from configuration. - caspar::env::configure("casparcg.config"); + { + // Configure environment properties from configuration. + caspar::env::configure("casparcg.config"); - #ifdef _DEBUG - if(caspar::env::properties().get("configuration.debugging.remote", false)) - MessageBox(nullptr, TEXT("Now is the time to connect for remote debugging..."), TEXT("Debug"), MB_OK | MB_TOPMOST); - #endif + #ifdef _DEBUG + if(caspar::env::properties().get("configuration.debugging.remote", false)) + MessageBox(nullptr, TEXT("Now is the time to connect for remote debugging..."), TEXT("Debug"), MB_OK | MB_TOPMOST); + #endif - // Start logging to file. - caspar::log::add_file_sink(caspar::env::log_folder()); + // Start logging to file. + caspar::log::add_file_sink(caspar::env::log_folder()); - // Setup console window. - setup_console_window(); + // Setup console window. + setup_console_window(); - // Print environment information. - print_info(); + // Print environment information. + print_info(); - // Create server object which initializes channels, protocols and controllers. - caspar::server caspar_server; + // Create server object which initializes channels, protocols and controllers. + caspar::server caspar_server; - // Create a amcp parser for console commands. - caspar::protocol::amcp::AMCPProtocolStrategy amcp(caspar_server.get_channels()); + // Create a amcp parser for console commands. + caspar::protocol::amcp::AMCPProtocolStrategy amcp(caspar_server.get_channels()); - // Create a dummy client which prints amcp responses to console. - auto dummy = std::make_shared(); + // Create a dummy client which prints amcp responses to console. + auto dummy = std::make_shared(); - bool is_running = true; - while(is_running) - { - std::wstring wcmd; - std::getline(std::wcin, wcmd); // TODO: It's blocking... - - is_running = wcmd != L"exit" && wcmd != L"q"; - if(wcmd.substr(0, 1) == L"1") - wcmd = L"LOADBG 1-1 " + wcmd.substr(1, wcmd.length()-1) + L" SLIDE 100 LOOP \r\nPLAY 1-1"; - else if(wcmd.substr(0, 1) == L"2") - wcmd = L"MIXER 1-0 VIDEO IS_KEY 1"; - else if(wcmd.substr(0, 1) == L"3") - 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") + bool is_running = true; + while(is_running) { - 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; - std::wstring file; - try + std::wstring wcmd; + std::getline(std::wcin, wcmd); // TODO: It's blocking... + + is_running = wcmd != L"exit" && wcmd != L"q"; + if(wcmd.substr(0, 1) == L"1") + wcmd = L"LOADBG 1-1 " + wcmd.substr(1, wcmd.length()-1) + L" SLIDE 100 LOOP \r\nPLAY 1-1"; + else if(wcmd.substr(0, 1) == L"2") + wcmd = L"MIXER 1-0 VIDEO IS_KEY 1"; + else if(wcmd.substr(0, 1) == L"3") + 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") { - num = boost::lexical_cast(wcmd.substr(1, 2)); - file = wcmd.substr(4, wcmd.length()-1); + 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"; } - catch(...) + else if(wcmd.substr(0, 1) == L"X") { - num = boost::lexical_cast(wcmd.substr(1, 1)); - file = wcmd.substr(3, wcmd.length()-1); + int num = 0; + std::wstring file; + try + { + num = boost::lexical_cast(wcmd.substr(1, 2)); + file = wcmd.substr(4, wcmd.length()-1); + } + catch(...) + { + num = boost::lexical_cast(wcmd.substr(1, 1)); + file = wcmd.substr(3, wcmd.length()-1); + } + + int n = 0; + int num2 = num; + while(num2 > 0) + { + num2 >>= 1; + 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"; } - int n = 0; - int num2 = num; - while(num2 > 0) - { - num2 >>= 1; - 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"; + wcmd += L"\r\n"; + amcp.Parse(wcmd.c_str(), wcmd.length(), dummy); } - - wcmd += L"\r\n"; - amcp.Parse(wcmd.c_str(), wcmd.length(), dummy); } - - Sleep(100); // CAPSAR_LOG is asynchronous. Try to get text in correct order. + Sleep(200); // CAPSAR_LOG is asynchronous. Try to get text in correct order. system("pause"); } catch(boost::property_tree::file_parser_error&) -- 2.39.2