]> git.sesse.net Git - casparcg/blobdiff - protocol/cii/CIICommandsImpl.cpp
Revert previous change.
[casparcg] / protocol / cii / CIICommandsImpl.cpp
index acdb1115b4d659d33e5f88a0403156590e9609bd..3253097f754f2a39ea54521bc1a29b11d1b34d4f 100644 (file)
@@ -1,30 +1,35 @@
 /*\r
-* copyright (c) 2010 Sveriges Television AB <info@casparcg.com>\r
+* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>\r
 *\r
-*  This file is part of CasparCG.\r
+* This file is part of CasparCG (www.casparcg.com).\r
 *\r
-*    CasparCG is free software: you can redistribute it and/or modify\r
-*    it under the terms of the GNU General Public License as published by\r
-*    the Free Software Foundation, either version 3 of the License, or\r
-*    (at your option) any later version.\r
+* CasparCG is free software: you can redistribute it and/or modify\r
+* it under the terms of the GNU General Public License as published by\r
+* the Free Software Foundation, either version 3 of the License, or\r
+* (at your option) any later version.\r
 *\r
-*    CasparCG is distributed in the hope that it will be useful,\r
-*    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-*    GNU General Public License for more details.\r
-\r
-*    You should have received a copy of the GNU General Public License\r
-*    along with CasparCG.  If not, see <http://www.gnu.org/licenses/>.\r
+* CasparCG is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
 *\r
+* Author: Nicklas P Andersson\r
 */\r
+\r
  \r
 #include "../StdAfx.h"\r
 \r
+#pragma warning (disable: 4244)\r
+\r
 #include "CIIProtocolStrategy.h"\r
 #include "CIICommandsImpl.h"\r
 #include <sstream>\r
 #include <algorithm>\r
 #include <modules/flash/producer/cg_producer.h>\r
+#include <boost/locale.hpp>\r
 \r
 namespace caspar { namespace protocol { namespace cii {\r
 \r
@@ -109,6 +114,9 @@ void MiscellaneousCommand::Setup(const std::vector<std::wstring>& parameters)
        {\r
                layer_ = _ttoi(parameters[4].c_str());\r
                filename_ = parameters[5];\r
+               if(filename_.find(L"PK/") == std::wstring::npos && filename_.find(L"PK\\") == std::wstring::npos)\r
+                       filename_ = L"PK/" + filename_;\r
+\r
                state_ = 1;\r
                if(parameters.size() > 7) {\r
                        std::wstringstream dataStream;\r
@@ -130,7 +138,7 @@ void MiscellaneousCommand::Setup(const std::vector<std::wstring>& parameters)
                std::wstring value = parameters[3];\r
                std::transform(value.begin(), value.end(), value.begin(), toupper);\r
 \r
-               //this->pCIIStrategy_->GetChannel()->SetVideoFormat(value); TODO\r
+               this->pCIIStrategy_->GetChannel()->set_video_format_desc(core::video_format_desc::get(value));\r
        }\r
 }\r
 \r
@@ -140,8 +148,12 @@ void MiscellaneousCommand::Execute()
                pCIIStrategy_->DisplayMediaFile(filename_);     \r
 \r
        //TODO: Need to be checked for validity\r
-       else if(state_ == 1)\r
-               get_default_cg_producer(pCIIStrategy_->GetChannel())->add(layer_, filename_, false, TEXT(""), xmlData_);\r
+       else if(state_ == 1)            \r
+       {\r
+               // HACK fix. The data sent is UTF8, however the protocol is implemented for ISO-8859-1. Instead of doing risky changes we simply convert into proper encoding when leaving protocol code.\r
+               auto xmlData2 = boost::locale::conv::utf_to_utf<wchar_t, char>(std::string(xmlData_.begin(), xmlData_.end()));\r
+               flash::get_default_cg_producer(pCIIStrategy_->GetChannel())->add(layer_, filename_, false, TEXT(""), xmlData2);\r
+       }\r
 }\r
 \r
 \r
@@ -155,11 +167,11 @@ void KeydataCommand::Execute()
 \r
        //TODO: Need to be checked for validity\r
        else if(state_ == 1)\r
-               get_default_cg_producer(pCIIStrategy_->GetChannel())->stop(layer_, 0);\r
+               flash::get_default_cg_producer(pCIIStrategy_->GetChannel())->stop(layer_, 0);\r
        else if(state_ == 2)\r
-               pCIIStrategy_->GetChannel()->stage()->clear(cg_producer::DEFAULT_LAYER);\r
+               pCIIStrategy_->GetChannel()->stage()->clear(flash::cg_producer::DEFAULT_LAYER);\r
        else if(state_ == 3)\r
-               get_default_cg_producer(pCIIStrategy_->GetChannel())->play(layer_);\r
+               flash::get_default_cg_producer(pCIIStrategy_->GetChannel())->play(layer_);\r
 }\r
 \r
 void KeydataCommand::Setup(const std::vector<std::wstring>& parameters) {\r