X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=protocol%2Famcp%2FAMCPCommandsImpl.cpp;h=a81b48648b77748856ec7364f4f3e0c646f81ba2;hb=a8574ad240b20f538e6bde57dff4dbffe26e2a5a;hp=a5e1d837743262216a9149f23690febb9b7df0bf;hpb=a486c25d5e6ce0ebe08e9a2d793a447ff3cb797a;p=casparcg diff --git a/protocol/amcp/AMCPCommandsImpl.cpp b/protocol/amcp/AMCPCommandsImpl.cpp index a5e1d8377..a81b48648 100644 --- a/protocol/amcp/AMCPCommandsImpl.cpp +++ b/protocol/amcp/AMCPCommandsImpl.cpp @@ -1,21 +1,22 @@ /* -* copyright (c) 2010 Sveriges Television AB +* Copyright (c) 2011 Sveriges Television AB * -* This file is part of CasparCG. +* This file is part of CasparCG (www.casparcg.com). * -* CasparCG is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. +* CasparCG is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. * -* CasparCG is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . +* CasparCG is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with CasparCG. If not, see . * +* Author: Nicklas P Andersson */ #include "../StdAfx.h" @@ -29,21 +30,31 @@ #include -#include +#include +#include +#include +#include #include #include -#include #include -#include +#include #include #include #include #include +#include +#include +#include #include +#include #include -#include +#include +#include +#include +#include +#include #include #include @@ -56,6 +67,9 @@ #include #include #include +#include + +#include /* Return codes @@ -83,52 +97,54 @@ namespace caspar { namespace protocol { using namespace core; -std::wstring ListMedia() -{ - std::wstringstream replyString; - for (boost::filesystem::wrecursive_directory_iterator itr(env::media_folder()), end; itr != end; ++itr) - { - if(boost::filesystem::is_regular_file(itr->path())) - { - std::wstring clipttype = TEXT(" N/A "); - std::wstring extension = boost::to_upper_copy(itr->path().extension()); - if(extension == TEXT(".TGA") || extension == TEXT(".COL") || extension == L".PNG" || extension == L".JPEG" || extension == L".JPG" || - extension == L"GIF" || extension == L"BMP") - clipttype = TEXT(" STILL "); - else if(extension == TEXT(".SWF") || extension == TEXT(".DV") || extension == TEXT(".MOV") || extension == TEXT(".MPG") || - extension == TEXT(".AVI") || extension == TEXT(".FLV") || extension == TEXT(".F4V") || extension == TEXT(".MP4") || - extension == L".M2V" || extension == L".H264" || extension == L".MKV" || extension == L".WMV" || extension == L".DIVX" || - extension == L".XVID" || extension == L".OGG") - clipttype = TEXT(" MOVIE "); - else if(extension == TEXT(".WAV") || extension == TEXT(".MP3")) - clipttype = TEXT(" STILL "); - - if(clipttype != TEXT(" N/A ")) - { - auto is_not_digit = [](char c){ return std::isdigit(c) == 0; }; - - auto relativePath = boost::filesystem::wpath(itr->path().file_string().substr(env::media_folder().size()-1, itr->path().file_string().size())); - - auto writeTimeStr = boost::posix_time::to_iso_string(boost::posix_time::from_time_t(boost::filesystem::last_write_time(itr->path()))); - writeTimeStr.erase(std::remove_if(writeTimeStr.begin(), writeTimeStr.end(), is_not_digit), writeTimeStr.end()); - auto writeTimeWStr = std::wstring(writeTimeStr.begin(), writeTimeStr.end()); +std::wstring MediaInfo(const boost::filesystem::path& path) +{ + if(boost::filesystem::is_regular_file(path)) + { + std::wstring clipttype = TEXT(" N/A "); + std::wstring extension = boost::to_upper_copy(path.extension().wstring()); + if(extension == TEXT(".TGA") || extension == TEXT(".COL") || extension == L".PNG" || extension == L".JPEG" || extension == L".JPG" || + extension == L"GIF" || extension == L"BMP") + clipttype = TEXT(" STILL "); + else if(extension == TEXT(".WAV") || extension == TEXT(".MP3")) + clipttype = TEXT(" STILL "); + else if(caspar::ffmpeg::is_valid_file(path.wstring()) || extension == L".CT") + clipttype = TEXT(" MOVIE "); + + if(clipttype != TEXT(" N/A ")) + { + auto is_not_digit = [](char c){ return std::isdigit(c) == 0; }; + + auto relativePath = boost::filesystem::path(path.wstring().substr(env::media_folder().size()-1, path.wstring().size())); + + auto writeTimeStr = boost::posix_time::to_iso_string(boost::posix_time::from_time_t(boost::filesystem::last_write_time(path))); + writeTimeStr.erase(std::remove_if(writeTimeStr.begin(), writeTimeStr.end(), is_not_digit), writeTimeStr.end()); + auto writeTimeWStr = std::wstring(writeTimeStr.begin(), writeTimeStr.end()); - auto sizeStr = boost::lexical_cast(boost::filesystem::file_size(itr->path())); - sizeStr.erase(std::remove_if(sizeStr.begin(), sizeStr.end(), is_not_digit), sizeStr.end()); - auto sizeWStr = std::wstring(sizeStr.begin(), sizeStr.end()); + auto sizeStr = boost::lexical_cast(boost::filesystem::file_size(path)); + sizeStr.erase(std::remove_if(sizeStr.begin(), sizeStr.end(), is_not_digit), sizeStr.end()); + auto sizeWStr = std::wstring(sizeStr.begin(), sizeStr.end()); - auto str = relativePath.replace_extension(TEXT("")).external_file_string(); - if(str[0] == '\\' || str[0] == '/') - str = std::wstring(str.begin() + 1, str.end()); - - replyString << TEXT("\"") << str - << TEXT("\" ") << clipttype - << TEXT(" ") << sizeStr - << TEXT(" ") << writeTimeWStr - << TEXT("\r\n"); - } - } + auto str = relativePath.replace_extension(TEXT("")).native(); + while(str.size() > 0 && (str[0] == '\\' || str[0] == '/')) + str = std::wstring(str.begin() + 1, str.end()); + + return std::wstring() + TEXT("\"") + str + + + TEXT("\" ") + clipttype + + + TEXT(" ") + sizeStr + + + TEXT(" ") + writeTimeWStr + + + TEXT("\r\n"); + } } + return L""; +} + +std::wstring ListMedia() +{ + std::wstringstream replyString; + for (boost::filesystem::recursive_directory_iterator itr(env::media_folder()), end; itr != end; ++itr) + replyString << MediaInfo(itr->path()); + return boost::to_upper_copy(replyString.str()); } @@ -136,11 +152,11 @@ std::wstring ListTemplates() { std::wstringstream replyString; - for (boost::filesystem::wrecursive_directory_iterator itr(env::template_folder()), end; itr != end; ++itr) + for (boost::filesystem::recursive_directory_iterator itr(env::template_folder()), end; itr != end; ++itr) { - if(boost::filesystem::is_regular_file(itr->path()) && itr->path().extension() == L".ft") + if(boost::filesystem::is_regular_file(itr->path()) && (itr->path().extension() == L".ft" || itr->path().extension() == L".ct")) { - auto relativePath = boost::filesystem::wpath(itr->path().file_string().substr(env::template_folder().size()-1, itr->path().file_string().size())); + auto relativePath = boost::filesystem::wpath(itr->path().wstring().substr(env::template_folder().size()-1, itr->path().wstring().size())); auto writeTimeStr = boost::posix_time::to_iso_string(boost::posix_time::from_time_t(boost::filesystem::last_write_time(itr->path()))); writeTimeStr.erase(std::remove_if(writeTimeStr.begin(), writeTimeStr.end(), [](char c){ return std::isdigit(c) == 0;}), writeTimeStr.end()); @@ -151,12 +167,12 @@ std::wstring ListTemplates() auto sizeWStr = std::wstring(sizeStr.begin(), sizeStr.end()); - std::wstring dir = relativePath.parent_path().external_directory_string(); - std::wstring file = boost::to_upper_copy(relativePath.filename()); + std::wstring dir = relativePath.parent_path().native(); + std::wstring file = boost::to_upper_copy(relativePath.filename().wstring()); relativePath = boost::filesystem::wpath(dir + L"/" + file); - auto str = relativePath.replace_extension(TEXT("")).external_file_string(); - if(str[0] == '\\' || str[0] == '/') + auto str = relativePath.replace_extension(TEXT("")).native(); + while(str.size() > 0 && (str[0] == '\\' || str[0] == '/')) str = std::wstring(str.begin() + 1, str.end()); replyString << TEXT("\"") << str @@ -185,80 +201,169 @@ void AMCPCommand::SendReply() void AMCPCommand::Clear() { - pChannel_->stage()->clear(); + pChannel_->stage().clear(); pClientInfo_.reset(); channelIndex_ = 0; _parameters.clear(); } -bool ParamCommand::DoExecute() +bool DiagnosticsCommand::DoExecute() { - //Perform loading of the clip try { - auto what = _parameters.at(2); - if(what == L"B") - GetChannel()->stage()->background(GetLayerIndex()).get()->param(_parameters.at(3)); - else if(what == L"F") - GetChannel()->stage()->foreground(GetLayerIndex()).get()->param(_parameters.at(3)); + diagnostics::show_graphs(true); + + SetReplyString(TEXT("202 DIAG OK\r\n")); + + return true; + } + catch(...) + { + CASPAR_LOG_CURRENT_EXCEPTION(); + SetReplyString(TEXT("502 DIAG FAILED\r\n")); + return false; + } +} + +bool ChannelGridCommand::DoExecute() +{ + int index = 1; + auto self = GetChannels().back(); - CASPAR_LOG(info) << "Executed param: " << _parameters[0] << TEXT(" successfully"); + std::vector params; + params.push_back(L"SCREEN"); + params.push_back(L"NAME"); + params.push_back(L"Channel Grid Window"); + auto screen = create_consumer(params); + + self->output().add(screen); + + BOOST_FOREACH(auto channel, GetChannels()) + { + if(channel != self) + { + auto producer = reroute::create_producer(self->frame_factory(), *channel); + self->stage().load(index, producer, false); + self->stage().play(index); + index++; + } + } + + int n = GetChannels().size()-1; + double delta = 1.0/static_cast(n); + for(int x = 0; x < n; ++x) + { + for(int y = 0; y < n; ++y) + { + int index = x+y*n+1; + auto transform = [=](frame_transform transform) -> frame_transform + { + transform.fill_translation[0] = x*delta; + transform.fill_translation[1] = y*delta; + transform.fill_scale[0] = delta; + transform.fill_scale[1] = delta; + transform.clip_translation[0] = x*delta; + transform.clip_translation[1] = y*delta; + transform.clip_scale[0] = delta; + transform.clip_scale[1] = delta; + return transform; + }; + self->stage().apply_transform(index, transform); + } + } + + return true; +} + +bool CallCommand::DoExecute() +{ + //Perform loading of the clip + try + { + auto what = _parameters.at(0); + + boost::unique_future result; + if(what == L"B" || what == L"F") + { + std::wstring param; + for(auto it = std::begin(_parameters2)+1; it != std::end(_parameters2); ++it, param += L" ") + param += *it; + result = (what == L"F" ? GetChannel()->stage().foreground(GetLayerIndex()) : GetChannel()->stage().background(GetLayerIndex())).get()->call(boost::trim_copy(param)); + } + else + { + std::wstring param; + for(auto it = std::begin(_parameters2); it != std::end(_parameters2); ++it, param += L" ") + param += *it; + result = GetChannel()->stage().foreground(GetLayerIndex()).get()->call(boost::trim_copy(param)); + } - SetReplyString(TEXT("202 PARAM OK\r\n")); + if(!result.timed_wait(boost::posix_time::seconds(2))) + BOOST_THROW_EXCEPTION(timed_out()); + + std::wstringstream replyString; + if(result.get().empty()) + replyString << TEXT("202 CALL OK\r\n"); + else + replyString << TEXT("201 CALL OK\r\n") << result.get() << L"\r\n"; + + SetReplyString(replyString.str()); return true; } catch(...) { CASPAR_LOG_CURRENT_EXCEPTION(); - SetReplyString(TEXT("502 PARAM FAILED\r\n")); + SetReplyString(TEXT("502 CALL FAILED\r\n")); return false; } } +tbb::concurrent_unordered_map> deferred_transforms; + bool MixerCommand::DoExecute() { //Perform loading of the clip try { - if(_parameters[0] == L"KEYER") + bool defer = _parameters.back() == L"DEFER"; + if(defer) + _parameters.pop_back(); + + std::vector transforms; + + if(_parameters[0] == L"KEYER" || _parameters[0] == L"IS_KEY") { - bool value = lexical_cast_or_default(_parameters.at(1), false); - auto transform = [=](frame_transform transform) -> frame_transform + bool value = boost::lexical_cast(_parameters.at(1)); + transforms.push_back(stage::transform_tuple_t(GetLayerIndex(), [=](frame_transform transform) -> frame_transform { transform.is_key = value; return transform; - }; - - int layer = GetLayerIndex(); - GetChannel()->mixer()->apply_frame_transform(GetLayerIndex(), transform); + }, 0, L"linear")); } else if(_parameters[0] == L"OPACITY") { - int duration = _parameters.size() > 2 ? lexical_cast_or_default(_parameters[2], 0) : 0; + int duration = _parameters.size() > 2 ? boost::lexical_cast(_parameters[2]) : 0; std::wstring tween = _parameters.size() > 3 ? _parameters[3] : L"linear"; double value = boost::lexical_cast(_parameters.at(1)); - auto transform = [=](frame_transform transform) -> frame_transform + transforms.push_back(stage::transform_tuple_t(GetLayerIndex(), [=](frame_transform transform) -> frame_transform { transform.opacity = value; return transform; - }; - - int layer = GetLayerIndex(); - GetChannel()->mixer()->apply_frame_transform(GetLayerIndex(), transform, duration, tween); + }, duration, tween)); } - else if(_parameters[0] == L"FILL") + else if(_parameters[0] == L"FILL" || _parameters[0] == L"FILL_RECT") { - int duration = _parameters.size() > 5 ? lexical_cast_or_default(_parameters[5], 0) : 0; + int duration = _parameters.size() > 5 ? boost::lexical_cast(_parameters[5]) : 0; std::wstring tween = _parameters.size() > 6 ? _parameters[6] : L"linear"; double x = boost::lexical_cast(_parameters.at(1)); double y = boost::lexical_cast(_parameters.at(2)); double x_s = boost::lexical_cast(_parameters.at(3)); double y_s = boost::lexical_cast(_parameters.at(4)); - auto transform = [=](frame_transform transform) mutable -> frame_transform + transforms.push_back(stage::transform_tuple_t(GetLayerIndex(), [=](frame_transform transform) mutable -> frame_transform { transform.fill_translation[0] = x; transform.fill_translation[1] = y; @@ -269,35 +374,29 @@ bool MixerCommand::DoExecute() transform.clip_scale[0] = x_s; transform.clip_scale[1] = y_s; return transform; - }; - - int layer = GetLayerIndex(); - GetChannel()->mixer()->apply_frame_transform(GetLayerIndex(), transform, duration, tween); + }, duration, tween)); } - else if(_parameters[0] == L"CLIP") + else if(_parameters[0] == L"CLIP" || _parameters[0] == L"CLIP_RECT") { - int duration = _parameters.size() > 5 ? lexical_cast_or_default(_parameters[5], 0) : 0; + int duration = _parameters.size() > 5 ? boost::lexical_cast(_parameters[5]) : 0; std::wstring tween = _parameters.size() > 6 ? _parameters[6] : L"linear"; double x = boost::lexical_cast(_parameters.at(1)); double y = boost::lexical_cast(_parameters.at(2)); double x_s = boost::lexical_cast(_parameters.at(3)); double y_s = boost::lexical_cast(_parameters.at(4)); - auto transform = [=](frame_transform transform) -> frame_transform + transforms.push_back(stage::transform_tuple_t(GetLayerIndex(), [=](frame_transform transform) -> frame_transform { transform.clip_translation[0] = x; transform.clip_translation[1] = y; transform.clip_scale[0] = x_s; transform.clip_scale[1] = y_s; return transform; - }; - - int layer = GetLayerIndex(); - GetChannel()->mixer()->apply_frame_transform(GetLayerIndex(), transform, duration, tween); + }, duration, tween)); } else if(_parameters[0] == L"GRID") { - int duration = _parameters.size() > 2 ? lexical_cast_or_default(_parameters[2], 0) : 0; + int duration = _parameters.size() > 2 ? boost::lexical_cast(_parameters[2]) : 0; std::wstring tween = _parameters.size() > 3 ? _parameters[3] : L"linear"; int n = boost::lexical_cast(_parameters.at(1)); double delta = 1.0/static_cast(n); @@ -306,7 +405,7 @@ bool MixerCommand::DoExecute() for(int y = 0; y < n; ++y) { int index = x+y*n+1; - auto transform = [=](frame_transform transform) -> frame_transform + transforms.push_back(stage::transform_tuple_t(index, [=](frame_transform transform) -> frame_transform { transform.fill_translation[0] = x*delta; transform.fill_translation[1] = y*delta; @@ -317,8 +416,7 @@ bool MixerCommand::DoExecute() transform.clip_scale[0] = delta; transform.clip_scale[1] = delta; return transform; - }; - GetChannel()->mixer()->apply_frame_transform(index, transform, duration, tween); + }, duration, tween)); } } } @@ -326,49 +424,40 @@ bool MixerCommand::DoExecute() { auto blend_str = _parameters.at(1); int layer = GetLayerIndex(); - GetChannel()->mixer()->set_blend_mode(GetLayerIndex(), get_blend_mode(blend_str)); + GetChannel()->mixer().set_blend_mode(GetLayerIndex(), get_blend_mode(blend_str)); } else if(_parameters[0] == L"BRIGHTNESS") { auto value = boost::lexical_cast(_parameters.at(1)); - int duration = _parameters.size() > 2 ? lexical_cast_or_default(_parameters[2], 0) : 0; + int duration = _parameters.size() > 2 ? boost::lexical_cast(_parameters[2]) : 0; std::wstring tween = _parameters.size() > 3 ? _parameters[3] : L"linear"; - auto transform = [=](frame_transform transform) -> frame_transform + auto transform = stage::transform_tuple_t(GetLayerIndex(), [=](frame_transform transform) -> frame_transform { transform.brightness = value; return transform; - }; - - int layer = GetLayerIndex(); - GetChannel()->mixer()->apply_frame_transform(GetLayerIndex(), transform, duration, tween); + }, duration, tween); } else if(_parameters[0] == L"SATURATION") { auto value = boost::lexical_cast(_parameters.at(1)); - int duration = _parameters.size() > 2 ? lexical_cast_or_default(_parameters[2], 0) : 0; + int duration = _parameters.size() > 2 ? boost::lexical_cast(_parameters[2]) : 0; std::wstring tween = _parameters.size() > 3 ? _parameters[3] : L"linear"; - auto transform = [=](frame_transform transform) -> frame_transform + auto transform = stage::transform_tuple_t(GetLayerIndex(), [=](frame_transform transform) -> frame_transform { transform.saturation = value; return transform; - }; - - int layer = GetLayerIndex(); - GetChannel()->mixer()->apply_frame_transform(GetLayerIndex(), transform, duration, tween); + }, duration, tween); } else if(_parameters[0] == L"CONTRAST") { auto value = boost::lexical_cast(_parameters.at(1)); - int duration = _parameters.size() > 2 ? lexical_cast_or_default(_parameters[2], 0) : 0; + int duration = _parameters.size() > 2 ? boost::lexical_cast(_parameters[2]) : 0; std::wstring tween = _parameters.size() > 3 ? _parameters[3] : L"linear"; - auto transform = [=](frame_transform transform) -> frame_transform + auto transform = stage::transform_tuple_t(GetLayerIndex(), [=](frame_transform transform) -> frame_transform { transform.contrast = value; return transform; - }; - - int layer = GetLayerIndex(); - GetChannel()->mixer()->apply_frame_transform(GetLayerIndex(), transform, duration, tween); + }, duration, tween); } else if(_parameters[0] == L"LEVELS") { @@ -378,42 +467,52 @@ bool MixerCommand::DoExecute() value.gamma = boost::lexical_cast(_parameters.at(3)); value.min_output = boost::lexical_cast(_parameters.at(4)); value.max_output = boost::lexical_cast(_parameters.at(5)); - int duration = _parameters.size() > 6 ? lexical_cast_or_default(_parameters[6], 0) : 0; + int duration = _parameters.size() > 6 ? boost::lexical_cast(_parameters[6]) : 0; std::wstring tween = _parameters.size() > 7 ? _parameters[7] : L"linear"; - auto transform = [=](frame_transform transform) -> frame_transform + auto transform = stage::transform_tuple_t(GetLayerIndex(), [=](frame_transform transform) -> frame_transform { transform.levels = value; return transform; - }; - - int layer = GetLayerIndex(); - GetChannel()->mixer()->apply_frame_transform(GetLayerIndex(), transform, duration, tween); + }, duration, tween); } else if(_parameters[0] == L"VOLUME") { - int duration = _parameters.size() > 2 ? lexical_cast_or_default(_parameters[2], 0) : 0; + int duration = _parameters.size() > 2 ? boost::lexical_cast(_parameters[2]) : 0; std::wstring tween = _parameters.size() > 3 ? _parameters[3] : L"linear"; double value = boost::lexical_cast(_parameters[1]); - auto transform = [=](frame_transform transform) -> frame_transform + auto transform = stage::transform_tuple_t(GetLayerIndex(), [=](frame_transform transform) -> frame_transform { transform.volume = value; return transform; - }; - - int layer = GetLayerIndex(); - GetChannel()->mixer()->apply_frame_transform(GetLayerIndex(), transform, duration, tween); + }, duration, tween); } else if(_parameters[0] == L"CLEAR") { - GetChannel()->mixer()->clear_transforms(); + int layer = GetLayerIndex(std::numeric_limits::max()); + if(layer == std::numeric_limits::max()) + GetChannel()->stage().clear_transforms(); + else + GetChannel()->stage().clear_transforms(layer); + } + else if(_parameters[0] == L"COMMIT") + { + transforms = std::move(deferred_transforms[GetChannelIndex()]); } else { SetReplyString(TEXT("404 MIXER ERROR\r\n")); return false; } + + if(defer) + { + auto& defer_tranforms = deferred_transforms[GetChannelIndex()]; + defer_tranforms.insert(defer_tranforms.end(), transforms.begin(), transforms.end()); + } + else + GetChannel()->stage().apply_transforms(transforms); SetReplyString(TEXT("202 MIXER OK\r\n")); @@ -449,17 +548,15 @@ bool SwapCommand::DoExecute() int l1 = GetLayerIndex(); int l2 = boost::lexical_cast(strs.at(1)); - ch1->stage()->swap_layer(l1, l2, *ch2->stage()); + ch1->stage().swap_layer(l1, l2, ch2->stage()); } else { auto ch1 = GetChannel(); auto ch2 = GetChannels().at(boost::lexical_cast(_parameters[0])-1); - ch1->stage()->swap(*ch2->stage()); + ch1->stage().swap_layers(ch2->stage()); } - - CASPAR_LOG(info) << "Swapped successfully"; - + SetReplyString(TEXT("202 SWAP OK\r\n")); return true; @@ -483,10 +580,9 @@ bool AddCommand::DoExecute() //Perform loading of the clip try { - GetChannel()->output()->add(GetLayerIndex(), create_consumer(_parameters)); + auto consumer = create_consumer(_parameters); + GetChannel()->output().add(GetLayerIndex(consumer->index()), consumer); - CASPAR_LOG(info) << "Added " << _parameters[0] << TEXT(" successfully"); - SetReplyString(TEXT("202 ADD OK\r\n")); return true; @@ -510,7 +606,11 @@ bool RemoveCommand::DoExecute() //Perform loading of the clip try { - GetChannel()->output()->remove(GetLayerIndex()); + auto index = GetLayerIndex(std::numeric_limits::min()); + if(index == std::numeric_limits::min()) + index = create_consumer(_parameters)->index(); + + GetChannel()->output().remove(index); SetReplyString(TEXT("202 REMOVE OK\r\n")); @@ -536,11 +636,9 @@ bool LoadCommand::DoExecute() try { _parameters[0] = _parameters[0]; - auto pFP = create_producer(GetChannel()->mixer(), _parameters); - GetChannel()->stage()->load(GetLayerIndex(), pFP, true); + auto pFP = create_producer(GetChannel()->frame_factory(), _parameters); + GetChannel()->stage().load(GetLayerIndex(), pFP, true); - CASPAR_LOG(info) << "Loaded " << _parameters[0] << TEXT(" successfully"); - SetReplyString(TEXT("202 LOAD OK\r\n")); return true; @@ -548,13 +646,13 @@ bool LoadCommand::DoExecute() catch(file_not_found&) { CASPAR_LOG_CURRENT_EXCEPTION(); - SetReplyString(TEXT("404 LOADBG ERROR\r\n")); + SetReplyString(TEXT("404 LOAD ERROR\r\n")); return false; } catch(...) { CASPAR_LOG_CURRENT_EXCEPTION(); - SetReplyString(TEXT("502 LOADBG FAILED\r\n")); + SetReplyString(TEXT("502 LOAD FAILED\r\n")); return false; } } @@ -590,7 +688,7 @@ bool LoadCommand::DoExecute() // std::wstring filename = templatename; // filename.append(extension); // -// flash::get_default_cg_producer(info.video_channel, std::max(DEFAULT_CHANNEL_LAYER+1, info.layer_index)) +// flash::flash::create_cg_proxy(info.video_channel, std::max(DEFAULT_CHANNEL_LAYER+1, info.layer_index)) // ->add(flash_layer_index, filename, play_on_load, start_label, data); // // CASPAR_LOG(info) << L"Executed [amcp_channel_cg_add]"; @@ -614,21 +712,21 @@ bool LoadbgCommand::DoExecute() if(boost::regex_match(message, what, expr)) { auto transition = what["TRANSITION"].str(); - transitionInfo.duration = lexical_cast_or_default(what["DURATION"].str()); + transitionInfo.duration = boost::lexical_cast(what["DURATION"].str()); auto direction = what["DIRECTION"].matched ? what["DIRECTION"].str() : L""; auto tween = what["TWEEN"].matched ? what["TWEEN"].str() : L""; - transitionInfo.tweener = get_tweener(tween); + transitionInfo.tweener = tween; if(transition == TEXT("CUT")) - transitionInfo.type = transition::cut; + transitionInfo.type = transition_type::cut; else if(transition == TEXT("MIX")) - transitionInfo.type = transition::mix; + transitionInfo.type = transition_type::mix; else if(transition == TEXT("PUSH")) - transitionInfo.type = transition::push; + transitionInfo.type = transition_type::push; else if(transition == TEXT("SLIDE")) - transitionInfo.type = transition::slide; + transitionInfo.type = transition_type::slide; else if(transition == TEXT("WIPE")) - transitionInfo.type = transition::wipe; + transitionInfo.type = transition_type::wipe; if(direction == TEXT("FROMLEFT")) transitionInfo.direction = transition_direction::from_left; @@ -644,23 +742,28 @@ bool LoadbgCommand::DoExecute() try { _parameters[0] = _parameters[0]; - auto pFP = create_producer(GetChannel()->mixer(), _parameters); + auto pFP = create_producer(GetChannel()->frame_factory(), _parameters); if(pFP == frame_producer::empty()) - BOOST_THROW_EXCEPTION(file_not_found() << msg_info(_parameters.size() > 0 ? narrow(_parameters[0]) : "")); + BOOST_THROW_EXCEPTION(file_not_found() << msg_info(_parameters.size() > 0 ? _parameters[0] : L"")); bool auto_play = std::find(_parameters.begin(), _parameters.end(), L"AUTO") != _parameters.end(); - auto pFP2 = create_transition_producer(GetChannel()->get_video_format_desc().field_mode, create_destroy_producer_proxy(GetChannel()->context().destruction(), pFP), transitionInfo); - GetChannel()->stage()->load(GetLayerIndex(), pFP2, false, auto_play ? transitionInfo.duration : -1); // TODO: LOOP + auto pFP2 = create_transition_producer(GetChannel()->video_format_desc().field_mode, pFP, transitionInfo); + if(auto_play) + GetChannel()->stage().load(GetLayerIndex(), pFP2, transitionInfo.duration); // TODO: LOOP + else + GetChannel()->stage().load(GetLayerIndex(), pFP2); // TODO: LOOP - CASPAR_LOG(info) << "Loaded " << _parameters[0] << TEXT(" successfully to background"); SetReplyString(TEXT("202 LOADBG OK\r\n")); return true; } catch(file_not_found&) - { - CASPAR_LOG_CURRENT_EXCEPTION(); + { + std::wstring params2; + for(auto it = _parameters.begin(); it != _parameters.end(); ++it) + params2 += L" " + *it; + CASPAR_LOG(error) << L"File not found. No match found for parameters. Check syntax:" << params2; SetReplyString(TEXT("404 LOADBG ERROR\r\n")); return false; } @@ -676,7 +779,7 @@ bool PauseCommand::DoExecute() { try { - GetChannel()->stage()->pause(GetLayerIndex()); + GetChannel()->stage().pause(GetLayerIndex()); SetReplyString(TEXT("202 PAUSE OK\r\n")); return true; } @@ -702,12 +805,10 @@ bool PlayCommand::DoExecute() for(auto it = _parameters.begin(); it != _parameters.end(); ++it) lbg.AddParameter(*it); if(!lbg.Execute()) - CASPAR_LOG(warning) << " Failed to play."; - - CASPAR_LOG(info) << "Playing " << _parameters[0]; + throw std::exception(); } - GetChannel()->stage()->play(GetLayerIndex()); + GetChannel()->stage().play(GetLayerIndex()); SetReplyString(TEXT("202 PLAY OK\r\n")); return true; @@ -724,7 +825,7 @@ bool StopCommand::DoExecute() { try { - GetChannel()->stage()->stop(GetLayerIndex()); + GetChannel()->stage().stop(GetLayerIndex()); SetReplyString(TEXT("202 STOP OK\r\n")); return true; } @@ -740,9 +841,9 @@ bool ClearCommand::DoExecute() { int index = GetLayerIndex(std::numeric_limits::min()); if(index != std::numeric_limits::min()) - GetChannel()->stage()->clear(index); + GetChannel()->stage().clear(index); else - GetChannel()->stage()->clear(); + GetChannel()->stage().clear(); SetReplyString(TEXT("202 CLEAR OK\r\n")); @@ -751,39 +852,13 @@ bool ClearCommand::DoExecute() bool PrintCommand::DoExecute() { - GetChannel()->output()->add(99978, create_consumer(boost::assign::list_of(L"IMAGE"))); + GetChannel()->output().add(create_consumer(boost::assign::list_of(L"IMAGE"))); SetReplyString(TEXT("202 PRINT OK\r\n")); return true; } -bool StatusCommand::DoExecute() -{ - if (GetLayerIndex() > -1) - { - auto status = GetChannel()->stage()->get_status(GetLayerIndex()); - std::wstringstream status_text; - status_text - << L"202 STATUS OK\r\n" - << L"FOREGROUND:" << status.foreground << L"\r\n" - << L"BACKGROUND:" << status.background << L"\r\n" - << L"STATUS:" << (status.is_paused ? L"PAUSED" : L"PLAYING") << L"\r\n" - << L"TOTAL FRAMES:" << (status.total_frames == std::numeric_limits::max() ? 0 : status.total_frames) << L"\r\n" - << L"CURRENT FRAME:" << status.current_frame << L"\r\n"; - - SetReplyString(status_text.str()); - return true; - } - else - { - //NOTE: Possible to extend soo that "channel" status is returned when no layer is specified. - - SetReplyString(TEXT("403 LAYER MUST BE SPECIFIED\r\n")); - return false; - } -} - bool LogCommand::DoExecute() { if(_parameters.at(0) == L"LEVEL") @@ -796,25 +871,32 @@ bool LogCommand::DoExecute() bool CGCommand::DoExecute() { - std::wstring command = _parameters[0]; - if(command == TEXT("ADD")) - return DoExecuteAdd(); - else if(command == TEXT("PLAY")) - return DoExecutePlay(); - else if(command == TEXT("STOP")) - return DoExecuteStop(); - else if(command == TEXT("NEXT")) - return DoExecuteNext(); - else if(command == TEXT("REMOVE")) - return DoExecuteRemove(); - else if(command == TEXT("CLEAR")) - return DoExecuteClear(); - else if(command == TEXT("UPDATE")) - return DoExecuteUpdate(); - else if(command == TEXT("INVOKE")) - return DoExecuteInvoke(); - else if(command == TEXT("INFO")) - return DoExecuteInfo(); + try + { + std::wstring command = _parameters[0]; + if(command == TEXT("ADD")) + return DoExecuteAdd(); + else if(command == TEXT("PLAY")) + return DoExecutePlay(); + else if(command == TEXT("STOP")) + return DoExecuteStop(); + else if(command == TEXT("NEXT")) + return DoExecuteNext(); + else if(command == TEXT("REMOVE")) + return DoExecuteRemove(); + else if(command == TEXT("CLEAR")) + return DoExecuteClear(); + else if(command == TEXT("UPDATE")) + return DoExecuteUpdate(); + else if(command == TEXT("INVOKE")) + return DoExecuteInvoke(); + else if(command == TEXT("INFO")) + return DoExecuteInfo(); + } + catch(...) + { + CASPAR_LOG_CURRENT_EXCEPTION(); + } SetReplyString(TEXT("403 CG ERROR\r\n")); return false; @@ -908,14 +990,14 @@ bool CGCommand::DoExecuteAdd() { } } - std::wstring fullFilename = find_flash_template(env::template_folder() + _parameters[2]); + std::wstring fullFilename = flash::find_template(env::template_folder() + _parameters[2]); if(!fullFilename.empty()) { - std::wstring extension = boost::filesystem::wpath(fullFilename).extension(); + std::wstring extension = boost::filesystem::path(fullFilename).extension().wstring(); std::wstring filename = _parameters[2]; filename.append(extension); - get_default_cg_producer(safe_ptr(GetChannel()), GetLayerIndex(cg_producer::DEFAULT_LAYER))->add(layer, filename, bDoStart, label, (pDataString!=0) ? pDataString : TEXT("")); + flash::create_cg_proxy(spl::shared_ptr(GetChannel()), GetLayerIndex(flash::cg_proxy::DEFAULT_LAYER)).add(layer, filename, bDoStart, label, (pDataString!=0) ? pDataString : TEXT("")); SetReplyString(TEXT("202 CG OK\r\n")); } else @@ -936,7 +1018,7 @@ bool CGCommand::DoExecutePlay() return false; } int layer = _ttoi(_parameters[1].c_str()); - get_default_cg_producer(safe_ptr(GetChannel()), GetLayerIndex(cg_producer::DEFAULT_LAYER))->play(layer); + flash::create_cg_proxy(spl::shared_ptr(GetChannel()), GetLayerIndex(flash::cg_proxy::DEFAULT_LAYER)).play(layer); } else { @@ -958,7 +1040,7 @@ bool CGCommand::DoExecuteStop() return false; } int layer = _ttoi(_parameters[1].c_str()); - get_default_cg_producer(safe_ptr(GetChannel()), GetLayerIndex(cg_producer::DEFAULT_LAYER))->stop(layer, 0); + flash::create_cg_proxy(spl::shared_ptr(GetChannel()), GetLayerIndex(flash::cg_proxy::DEFAULT_LAYER)).stop(layer, 0); } else { @@ -981,7 +1063,7 @@ bool CGCommand::DoExecuteNext() } int layer = _ttoi(_parameters[1].c_str()); - get_default_cg_producer(safe_ptr(GetChannel()), GetLayerIndex(cg_producer::DEFAULT_LAYER))->next(layer); + flash::create_cg_proxy(spl::shared_ptr(GetChannel()), GetLayerIndex(flash::cg_proxy::DEFAULT_LAYER)).next(layer); } else { @@ -1004,7 +1086,7 @@ bool CGCommand::DoExecuteRemove() } int layer = _ttoi(_parameters[1].c_str()); - get_default_cg_producer(safe_ptr(GetChannel()), GetLayerIndex(cg_producer::DEFAULT_LAYER))->remove(layer); + flash::create_cg_proxy(spl::shared_ptr(GetChannel()), GetLayerIndex(flash::cg_proxy::DEFAULT_LAYER)).remove(layer); } else { @@ -1018,7 +1100,7 @@ bool CGCommand::DoExecuteRemove() bool CGCommand::DoExecuteClear() { - GetChannel()->stage()->clear(GetLayerIndex(cg_producer::DEFAULT_LAYER)); + GetChannel()->stage().clear(GetLayerIndex(flash::cg_proxy::DEFAULT_LAYER)); SetReplyString(TEXT("202 CG OK\r\n")); return true; } @@ -1056,7 +1138,7 @@ bool CGCommand::DoExecuteUpdate() } int layer = _ttoi(_parameters.at(1).c_str()); - get_default_cg_producer(safe_ptr(GetChannel()), GetLayerIndex(cg_producer::DEFAULT_LAYER))->update(layer, dataString); + flash::create_cg_proxy(spl::shared_ptr(GetChannel()), GetLayerIndex(flash::cg_proxy::DEFAULT_LAYER)).update(layer, dataString); } catch(...) { @@ -1070,6 +1152,9 @@ bool CGCommand::DoExecuteUpdate() bool CGCommand::DoExecuteInvoke() { + std::wstringstream replyString; + replyString << TEXT("201 CG OK\r\n"); + if(_parameters.size() > 2) { if(!ValidateLayer(_parameters[1])) @@ -1078,23 +1163,44 @@ bool CGCommand::DoExecuteInvoke() return false; } int layer = _ttoi(_parameters[1].c_str()); - get_default_cg_producer(safe_ptr(GetChannel()), GetLayerIndex(cg_producer::DEFAULT_LAYER))->invoke(layer, _parameters2[2]); + auto result = flash::create_cg_proxy(spl::shared_ptr(GetChannel()), GetLayerIndex(flash::cg_proxy::DEFAULT_LAYER)).invoke(layer, _parameters2[2]); + replyString << result << TEXT("\r\n"); } else { SetReplyString(TEXT("402 CG ERROR\r\n")); return true; } - - SetReplyString(TEXT("202 CG OK\r\n")); + + SetReplyString(replyString.str()); return true; } bool CGCommand::DoExecuteInfo() { - // TODO - //get_default_cg_producer(GetChannel())->Info(); - SetReplyString(TEXT("600 CG FAILED\r\n")); + std::wstringstream replyString; + replyString << TEXT("201 CG OK\r\n"); + + if(_parameters.size() > 1) + { + if(!ValidateLayer(_parameters[1])) + { + SetReplyString(TEXT("403 CG ERROR\r\n")); + return false; + } + + int layer = _ttoi(_parameters[1].c_str()); + auto desc = flash::create_cg_proxy(spl::shared_ptr(GetChannel()), GetLayerIndex(flash::cg_proxy::DEFAULT_LAYER)).description(layer); + + replyString << desc << TEXT("\r\n"); + } + else + { + auto info = flash::create_cg_proxy(spl::shared_ptr(GetChannel()), GetLayerIndex(flash::cg_proxy::DEFAULT_LAYER)).template_host_info(); + replyString << info << TEXT("\r\n"); + } + + SetReplyString(replyString.str()); return true; } @@ -1182,16 +1288,16 @@ bool DataCommand::DoExecuteList() std::wstringstream replyString; replyString << TEXT("200 DATA LIST OK\r\n"); - for (boost::filesystem::wrecursive_directory_iterator itr(env::data_folder()), end; itr != end; ++itr) + for (boost::filesystem::recursive_directory_iterator itr(env::data_folder()), end; itr != end; ++itr) { if(boost::filesystem::is_regular_file(itr->path())) { - if(!boost::iequals(itr->path().extension(), L".ftd")) + if(!boost::iequals(itr->path().extension().wstring(), L".ftd")) continue; - auto relativePath = boost::filesystem::wpath(itr->path().file_string().substr(env::data_folder().size()-1, itr->path().file_string().size())); + auto relativePath = boost::filesystem::wpath(itr->path().wstring().substr(env::data_folder().size()-1, itr->path().wstring().size())); - auto str = relativePath.replace_extension(TEXT("")).external_file_string(); + auto str = relativePath.replace_extension(TEXT("")).native(); if(str[0] == '\\' || str[0] == '/') str = std::wstring(str.begin() + 1, str.end()); @@ -1208,64 +1314,175 @@ bool DataCommand::DoExecuteList() bool CinfCommand::DoExecute() { std::wstringstream replyString; + + try + { + std::wstring info; + for (boost::filesystem::recursive_directory_iterator itr(env::media_folder()), end; itr != end; ++itr) + { + auto path = itr->path(); + auto file = path.replace_extension(L"").filename(); + if(boost::iequals(file.wstring(), _parameters.at(0))) + info += MediaInfo(itr->path()) + L"\r\n"; + } - std::wstring filename = _parameters[0]; - - // TODO: - - //FileInfo fileInfo; - - //MediaManagerPtr pMediaManager = GetApplication()->FindMediaFile(filename, &fileInfo); - //if(pMediaManager != 0 && fileInfo.filetype.length() >0) //File was found - //{ - // if(pMediaManager->getFileInfo(&fileInfo)) - // { - // TCHAR numBuffer[32]; - // _ui64tot_s(fileInfo.size, numBuffer, 32, 10); - - // replyString << TEXT("201 CINF OK\r\n\"") << fileInfo.filename << TEXT("\" ") << fileInfo.type << TEXT("/") << fileInfo.filetype << TEXT("/") << fileInfo.encoding << TEXT(" ") << numBuffer << TEXT("\r\n"); - - // SetReplyString(replyString.str()); - // return true; - // } - //} - - SetReplyString(TEXT("404 CINF ERROR\r\n")); - return false; + if(info.empty()) + { + SetReplyString(TEXT("404 CINF ERROR\r\n")); + return false; + } + replyString << TEXT("200 CINF OK\r\n"); + replyString << info << "\r\n"; + } + catch(...) + { + SetReplyString(TEXT("404 CINF ERROR\r\n")); + return false; + } + + SetReplyString(replyString.str()); + return true; } -void GenerateChannelInfo(int index, const safe_ptr& pChannel, std::wstringstream& replyString) +void GenerateChannelInfo(int index, const spl::shared_ptr& pChannel, std::wstringstream& replyString) { - replyString << index+1 << TEXT(" ") << pChannel->get_video_format_desc().name << TEXT(" PLAYING") << TEXT("\r\n"); + replyString << index+1 << TEXT(" ") << pChannel->video_format_desc().name << TEXT(" PLAYING") << TEXT("\r\n"); } bool InfoCommand::DoExecute() { std::wstringstream replyString; + + boost::property_tree::xml_writer_settings w(' ', 3); - if(_parameters.size() >= 1) + try { - int channelIndex = _ttoi(_parameters[0].c_str())-1; + if(_parameters.size() >= 1 && _parameters[0] == L"TEMPLATE") + { + replyString << L"201 INFO TEMPLATE OK\r\n"; + + // Needs to be extended for any file, not just flash. + + auto filename = flash::find_template(env::template_folder() + _parameters.at(1)); + + std::wstringstream str; + str << u16(flash::read_template_meta_info(filename)); + boost::property_tree::wptree info; + boost::property_tree::xml_parser::read_xml(str, info, boost::property_tree::xml_parser::trim_whitespace | boost::property_tree::xml_parser::no_comments); + + boost::property_tree::xml_parser::write_xml(replyString, info, w); + } + else if(_parameters.size() >= 1 && _parameters[0] == L"CONFIG") + { + replyString << L"201 INFO CONFIG OK\r\n"; - if(channelIndex < channels_.size()) + boost::property_tree::write_xml(replyString, caspar::env::properties(), w); + } + else if(_parameters.size() >= 1 && _parameters[0] == L"PATHS") { - replyString << TEXT("201 INFO OK\r\n"); - GenerateChannelInfo(channelIndex, channels_[channelIndex], replyString); + replyString << L"201 INFO PATHS OK\r\n"; + + boost::property_tree::wptree info; + info.add_child(L"paths", caspar::env::properties().get_child(L"configuration.paths")); + info.add(L"paths.initial-path", boost::filesystem3::initial_path().wstring() + L"\\"); + + boost::property_tree::write_xml(replyString, info, w); } - else + else if(_parameters.size() >= 1 && _parameters[0] == L"SYSTEM") { - SetReplyString(TEXT("401 INFO ERROR\r\n")); - return false; + replyString << L"201 INFO SYSTEM OK\r\n"; + + boost::property_tree::wptree info; + + info.add(L"system.name", caspar::get_system_product_name()); + info.add(L"system.windows.name", caspar::get_win_product_name()); + info.add(L"system.windows.service-pack", caspar::get_win_sp_version()); + info.add(L"system.cpu", caspar::get_cpu_info()); + + BOOST_FOREACH(auto device, caspar::decklink::get_device_list()) + info.add(L"system.decklink.device", device); + + BOOST_FOREACH(auto device, caspar::bluefish::get_device_list()) + info.add(L"system.bluefish.device", device); + + info.add(L"system.flash", caspar::flash::get_version()); + //info.add(L"system.free-image", caspar::image::get_version()); + info.add(L"system.ffmpeg.avcodec", caspar::ffmpeg::get_avcodec_version()); + info.add(L"system.ffmpeg.avformat", caspar::ffmpeg::get_avformat_version()); + info.add(L"system.ffmpeg.avfilter", caspar::ffmpeg::get_avfilter_version()); + info.add(L"system.ffmpeg.avutil", caspar::ffmpeg::get_avutil_version()); + info.add(L"system.ffmpeg.swscale", caspar::ffmpeg::get_swscale_version()); + + boost::property_tree::write_xml(replyString, info, w); + } + else if(_parameters.size() >= 1 && _parameters[0] == L"SERVER") + { + replyString << L"201 INFO SYSTEM OK\r\n"; + + boost::property_tree::wptree info; + + int index = 0; + BOOST_FOREACH(auto channel, channels_) + info.add_child(L"channels.channel", channel->info()) + .add(L"index", ++index); + + boost::property_tree::write_xml(replyString, info, w); + } + else // channel + { + if(_parameters.size() >= 1) + { + replyString << TEXT("201 INFO OK\r\n"); + boost::property_tree::wptree info; + + std::vector split; + boost::split(split, _parameters[0], boost::is_any_of("-")); + + int layer = std::numeric_limits::min(); + int channel = boost::lexical_cast(split[0]) - 1; + + if(split.size() > 1) + layer = boost::lexical_cast(split[1]); + + if(layer == std::numeric_limits::min()) + { + info.add_child(L"channel", channels_.at(channel)->info()) + .add(L"index", channel); + } + else + { + if(_parameters.size() >= 2) + { + if(_parameters[1] == L"B") + info.add_child(L"producer", channels_.at(channel)->stage().background(layer).get()->info()); + else + info.add_child(L"producer", channels_.at(channel)->stage().foreground(layer).get()->info()); + } + else + { + info.add_child(L"layer", channels_.at(channel)->stage().info(layer).get()) + .add(L"index", layer); + } + } + boost::property_tree::xml_parser::write_xml(replyString, info, w); + } + else + { + // This is needed for backwards compatibility with old clients + replyString << TEXT("200 INFO OK\r\n"); + for(size_t n = 0; n < channels_.size(); ++n) + GenerateChannelInfo(n, channels_[n], replyString); + } + } } - else + catch(...) { - replyString << TEXT("200 INFO OK\r\n"); - for(size_t n = 0; n < channels_.size(); ++n) - GenerateChannelInfo(n, channels_[n], replyString); - replyString << TEXT("\r\n"); + SetReplyString(TEXT("403 INFO ERROR\r\n")); + return false; } + replyString << TEXT("\r\n"); SetReplyString(replyString.str()); return true; } @@ -1302,14 +1519,14 @@ bool TlsCommand::DoExecute() bool VersionCommand::DoExecute() { - std::wstring replyString = TEXT("201 VERSION OK\r\n SERVER: ") + env::version() + TEXT("\r\n"); + std::wstring replyString = TEXT("201 VERSION OK\r\n") + env::version() + TEXT("\r\n"); if(_parameters.size() > 0) { if(_parameters[0] == L"FLASH") - replyString = TEXT("201 VERSION OK\r\n FLASH: ") + get_flash_version() + TEXT("\r\n"); + replyString = TEXT("201 VERSION OK\r\n") + flash::get_version() + TEXT("\r\n"); else if(_parameters[0] == L"TEMPLATEHOST") - replyString = TEXT("201 VERSION OK\r\n TEMPLATEHOST: ") + get_cg_version() + TEXT("\r\n"); + replyString = TEXT("201 VERSION OK\r\n") + flash::get_cg_version() + TEXT("\r\n"); else if(_parameters[0] != L"SERVER") replyString = TEXT("403 VERSION ERROR\r\n"); } @@ -1334,10 +1551,10 @@ bool SetCommand::DoExecute() if(name == TEXT("MODE")) { - auto format_desc = core::video_format_desc::get(value); + auto format_desc = core::video_format_desc(value); if(format_desc.format != core::video_format::invalid) { - GetChannel()->set_video_format_desc(format_desc); + GetChannel()->video_format_desc(format_desc); SetReplyString(TEXT("202 SET MODE OK\r\n")); } else