From 71448120cabf1beb55aa893c2de2a18dcc02febe Mon Sep 17 00:00:00 2001 From: ronag Date: Sun, 4 Dec 2011 14:28:42 +0000 Subject: [PATCH] 2.0.2: INFO: Improved formatting. Added INFO 1-1 F/B query. git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.2@1781 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d --- protocol/amcp/AMCPCommandsImpl.cpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/protocol/amcp/AMCPCommandsImpl.cpp b/protocol/amcp/AMCPCommandsImpl.cpp index f7f99d02d..3d5c06ac3 100644 --- a/protocol/amcp/AMCPCommandsImpl.cpp +++ b/protocol/amcp/AMCPCommandsImpl.cpp @@ -1329,7 +1329,8 @@ bool InfoCommand::DoExecute() { std::wstringstream replyString; replyString << TEXT("201 INFO OK\r\n"); - + + boost::property_tree::wptree info; if(_parameters.size() >= 1) { std::vector split; @@ -1342,20 +1343,35 @@ bool InfoCommand::DoExecute() layer = boost::lexical_cast(split[1]); if(layer == std::numeric_limits::min()) - boost::property_tree::xml_parser::write_xml(replyString, channels_.at(channel)->info(), boost::property_tree::xml_writer_settings(' ', 3)); + { + info.add_child(L"channel", channels_.at(channel)->info()) + .add(L"index", channel); + } else - boost::property_tree::xml_parser::write_xml(replyString, channels_.at(channel)->stage()->info(layer).get(), boost::property_tree::xml_writer_settings(' ', 3)); + { + 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); + } + } } else { - 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::xml_parser::write_xml(replyString, info, boost::property_tree::xml_writer_settings(' ', 3)); } + + boost::property_tree::xml_parser::write_xml(replyString, info, boost::property_tree::xml_writer_settings(' ', 3)); replyString << TEXT("\r\n"); SetReplyString(replyString.str()); return true; -- 2.39.2