-/*\r
-* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>\r
-*\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
-*\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
-#pragma once\r
-\r
-#include <core/video_channel.h>\r
-\r
-#include "../util/ProtocolStrategy.h"\r
-#include "CIICommand.h"\r
-\r
-#include <core/producer/stage.h>\r
-\r
-#include <common/concurrency/executor.h>\r
-\r
-namespace caspar { namespace protocol { namespace cii {\r
-\r
-class CIIProtocolStrategy : public IO::IProtocolStrategy\r
-{\r
-public:\r
- CIIProtocolStrategy(const std::vector<safe_ptr<core::video_channel>>& channels);\r
-\r
- void Parse(const TCHAR* pData, int charCount, IO::ClientInfoPtr pClientInfo);\r
- UINT GetCodepage() {return 28591;} //ISO 8859-1\r
-\r
- void SetProfile(const std::wstring& profile) {currentProfile_ = profile;}\r
-\r
- safe_ptr<core::video_channel> GetChannel() const{return this->pChannel_;}\r
-\r
- void DisplayMediaFile(const std::wstring& filename);\r
- void DisplayTemplate(const std::wstring& titleName);\r
- void WriteTemplateData(const std::wstring& templateName, const std::wstring& titleName, const std::wstring& xmlData);\r
-\r
-public:\r
- struct TitleHolder\r
- {\r
- TitleHolder() : titleName(TEXT("")), pframe_producer(core::frame_producer::empty()) {}\r
- TitleHolder(const std::wstring& name, safe_ptr<core::frame_producer> pFP) : titleName(name), pframe_producer(pFP) {}\r
- TitleHolder(const TitleHolder& th) : titleName(th.titleName), pframe_producer(th.pframe_producer) {}\r
- const TitleHolder& operator=(const TitleHolder& th) \r
- {\r
- titleName = th.titleName;\r
- pframe_producer = th.pframe_producer;\r
- }\r
- bool operator==(const TitleHolder& rhs) \r
- {\r
- return pframe_producer == rhs.pframe_producer;\r
- }\r
-\r
- std::wstring titleName;\r
- safe_ptr<core::frame_producer> pframe_producer;\r
- friend CIIProtocolStrategy;\r
- };\r
-private:\r
-\r
- typedef std::list<TitleHolder> TitleList;\r
- TitleList titles_;\r
- safe_ptr<core::frame_producer> GetPreparedTemplate(const std::wstring& name);\r
- void PutPreparedTemplate(const std::wstring& name, safe_ptr<core::frame_producer>& pframe_producer);\r
-\r
- static const TCHAR TokenDelimiter;\r
- static const std::wstring MessageDelimiter;\r
-\r
- void ProcessMessage(const std::wstring& message);\r
- int TokenizeMessage(const std::wstring& message, std::vector<std::wstring>* pTokenVector);\r
- CIICommandPtr Create(const std::wstring& name);\r
-\r
- executor executor_;\r
- std::wstring currentMessage_;\r
-\r
- std::wstring currentProfile_;\r
- safe_ptr<core::video_channel> pChannel_;\r
-};\r
-\r
-}}}
\ No newline at end of file
+/*
+* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
+*
+* 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 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 <http://www.gnu.org/licenses/>.
+*
+* Author: Nicklas P Andersson
+*/
+
+
+#pragma once
+
+#include <core/video_channel.h>
+
+#include "../util/ProtocolStrategy.h"
+#include "CIICommand.h"
+
+#include <core/producer/stage.h>
+#include <core/producer/cg_proxy.h>
+
+#include <common/executor.h>
+#include <common/memory.h>
+
+#include <string>
+
+namespace caspar { namespace protocol { namespace cii {
+
+class CIIProtocolStrategy : public IO::IProtocolStrategy
+{
+public:
+ CIIProtocolStrategy(
+ const std::vector<spl::shared_ptr<core::video_channel>>& channels,
+ const spl::shared_ptr<core::cg_producer_registry>& cg_registry,
+ const spl::shared_ptr<const core::frame_producer_registry>& producer_registry);
+
+ void Parse(const std::wstring& message, IO::ClientInfoPtr pClientInfo);
+ std::string GetCodepage() const { return "ISO-8859-1"; } //ISO 8859-1
+
+ void SetProfile(const std::wstring& profile) {currentProfile_ = profile;}
+
+ spl::shared_ptr<core::video_channel> GetChannel() const { return pChannel_; }
+ spl::shared_ptr<core::cg_producer_registry> get_cg_registry() const { return cg_registry_; }
+ spl::shared_ptr<const core::frame_producer_registry> get_producer_registry() const { return producer_registry_; }
+ core::frame_producer_dependencies get_dependencies() const { return core::frame_producer_dependencies(GetChannel()->frame_factory(), channels_, GetChannel()->video_format_desc(), producer_registry_); }
+
+ void DisplayMediaFile(const std::wstring& filename);
+ void DisplayTemplate(const std::wstring& titleName);
+ void WriteTemplateData(const std::wstring& templateName, const std::wstring& titleName, const std::wstring& xmlData);
+
+public:
+ struct TitleHolder
+ {
+ TitleHolder() : titleName(L""), pframe_producer(core::frame_producer::empty()) {}
+ TitleHolder(const std::wstring& name, spl::shared_ptr<core::frame_producer> pFP) : titleName(name), pframe_producer(pFP) {}
+ TitleHolder(const TitleHolder& th) : titleName(th.titleName), pframe_producer(th.pframe_producer) {}
+ TitleHolder& operator=(const TitleHolder& th)
+ {
+ titleName = th.titleName;
+ pframe_producer = th.pframe_producer;
+
+ return *this;
+ }
+ bool operator==(const TitleHolder& rhs)
+ {
+ return pframe_producer == rhs.pframe_producer;
+ }
+
+ std::wstring titleName;
+ spl::shared_ptr<core::frame_producer> pframe_producer;
+ friend CIIProtocolStrategy;
+ };
+private:
+
+ typedef std::list<TitleHolder> TitleList;
+ TitleList titles_;
+ spl::shared_ptr<core::frame_producer> GetPreparedTemplate(const std::wstring& name);
+ void PutPreparedTemplate(const std::wstring& name, const spl::shared_ptr<core::frame_producer>& pframe_producer);
+
+ static const wchar_t TokenDelimiter;
+ static const std::wstring MessageDelimiter;
+
+ void ProcessMessage(const std::wstring& message, IO::ClientInfoPtr pClientInfo);
+ int TokenizeMessage(const std::wstring& message, std::vector<std::wstring>* pTokenVector);
+ CIICommandPtr Create(const std::wstring& name);
+
+ executor executor_;
+ std::wstring currentMessage_;
+
+ std::wstring currentProfile_;
+ spl::shared_ptr<core::video_channel> pChannel_;
+ spl::shared_ptr<core::cg_producer_registry> cg_registry_;
+ spl::shared_ptr<const core::frame_producer_registry> producer_registry_;
+ std::vector<spl::shared_ptr<core::video_channel>> channels_;
+};
+
+}}}