2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
\r
4 * This file is part of CasparCG (www.casparcg.com).
\r
6 * CasparCG is free software: you can redistribute it and/or modify
\r
7 * it under the terms of the GNU General Public License as published by
\r
8 * the Free Software Foundation, either version 3 of the License, or
\r
9 * (at your option) any later version.
\r
11 * CasparCG is distributed in the hope that it will be useful,
\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 * GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License
\r
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
\r
19 * Author: Nicklas P Andersson
\r
25 #include <core/video_channel.h>
\r
27 #include "../util/ProtocolStrategy.h"
\r
28 #include "CIICommand.h"
\r
30 #include <core/producer/stage.h>
\r
32 #include <common/concurrency/executor.h>
\r
34 namespace caspar { namespace protocol { namespace cii {
\r
36 class CIIProtocolStrategy : public IO::IProtocolStrategy
\r
39 CIIProtocolStrategy(const std::vector<spl::shared_ptr<core::video_channel>>& channels);
\r
41 void Parse(const TCHAR* pData, int charCount, IO::ClientInfoPtr pClientInfo);
\r
42 UINT GetCodepage() {return 28591;} //ISO 8859-1
\r
44 void SetProfile(const std::wstring& profile) {currentProfile_ = profile;}
\r
46 spl::shared_ptr<core::video_channel> GetChannel() const{return this->pChannel_;}
\r
48 void DisplayMediaFile(const std::wstring& filename);
\r
49 void DisplayTemplate(const std::wstring& titleName);
\r
50 void WriteTemplateData(const std::wstring& templateName, const std::wstring& titleName, const std::wstring& xmlData);
\r
55 TitleHolder() : titleName(TEXT("")), pframe_producer(core::frame_producer::empty()) {}
\r
56 TitleHolder(const std::wstring& name, spl::shared_ptr<core::frame_producer> pFP) : titleName(name), pframe_producer(pFP) {}
\r
57 TitleHolder(const TitleHolder& th) : titleName(th.titleName), pframe_producer(th.pframe_producer) {}
\r
58 const TitleHolder& operator=(const TitleHolder& th)
\r
60 titleName = th.titleName;
\r
61 pframe_producer = th.pframe_producer;
\r
63 bool operator==(const TitleHolder& rhs)
\r
65 return pframe_producer == rhs.pframe_producer;
\r
68 std::wstring titleName;
\r
69 spl::shared_ptr<core::frame_producer> pframe_producer;
\r
70 friend CIIProtocolStrategy;
\r
74 typedef std::list<TitleHolder> TitleList;
\r
76 spl::shared_ptr<core::frame_producer> GetPreparedTemplate(const std::wstring& name);
\r
77 void PutPreparedTemplate(const std::wstring& name, spl::shared_ptr<core::frame_producer>& pframe_producer);
\r
79 static const TCHAR TokenDelimiter;
\r
80 static const std::wstring MessageDelimiter;
\r
82 void ProcessMessage(const std::wstring& message, IO::ClientInfoPtr pClientInfo);
\r
83 int TokenizeMessage(const std::wstring& message, std::vector<std::wstring>* pTokenVector);
\r
84 CIICommandPtr Create(const std::wstring& name);
\r
87 std::wstring currentMessage_;
\r
89 std::wstring currentProfile_;
\r
90 spl::shared_ptr<core::video_channel> pChannel_;
\r