]> git.sesse.net Git - casparcg/blobdiff - protocol/cii/CIICommandsImpl.cpp
Revert previous change.
[casparcg] / protocol / cii / CIICommandsImpl.cpp
index 306e6b60ad5852d3037557f9a1c4ea31531ef548..3253097f754f2a39ea54521bc1a29b11d1b34d4f 100644 (file)
  \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
@@ -111,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
@@ -132,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
@@ -142,8 +148,12 @@ void MiscellaneousCommand::Execute()
                pCIIStrategy_->DisplayMediaFile(filename_);     \r
 \r
        //TODO: Need to be checked for validity\r
-       else if(state_ == 1)\r
-               flash::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