]> git.sesse.net Git - casparcg/blobdiff - protocol/amcp/AMCPProtocolStrategy.h
Merge branch '2.1.0' of https://github.com/CasparCG/Server into 2.1.0
[casparcg] / protocol / amcp / AMCPProtocolStrategy.h
index 4454b01e621d11d12f5936abbe54a42e89c09ea3..559b9d44f1f09042135033c1a5dbd8b8003e6fb1 100644 (file)
@@ -1,71 +1,56 @@
-/*\r
-* copyright (c) 2010 Sveriges Television AB <info@casparcg.com>\r
-*\r
-*  This file is part of CasparCG.\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
-*/\r
-#pragma once\r
-\r
-#include "../util/protocolstrategy.h"\r
-#include <core/channel.h>\r
-\r
-#include "AMCPCommand.h"\r
-#include "AMCPCommandQueue.h"\r
-\r
-#include <boost/noncopyable.hpp>\r
-\r
-namespace caspar { namespace protocol { namespace amcp {\r
-\r
-class AMCPProtocolStrategy : public IO::IProtocolStrategy, boost::noncopyable\r
-{\r
-       enum MessageParserState {\r
-               New = 0,\r
-               GetSwitch,\r
-               GetCommand,\r
-               GetParameters,\r
-               GetChannel,\r
-               Done\r
-       };\r
-\r
-       AMCPProtocolStrategy(const AMCPProtocolStrategy&);\r
-       AMCPProtocolStrategy& operator=(const AMCPProtocolStrategy&);\r
-\r
-public:\r
-       AMCPProtocolStrategy(const std::vector<safe_ptr<core::channel>>& channels);\r
-       virtual ~AMCPProtocolStrategy();\r
-\r
-       virtual void Parse(const TCHAR* pData, int charCount, IO::ClientInfoPtr pClientInfo);\r
-       virtual UINT GetCodepage() {\r
-               return CP_UTF8;\r
-       }\r
-\r
-       AMCPCommandPtr InterpretCommandString(const std::wstring& str, MessageParserState* pOutState=0);\r
-\r
-private:\r
-       friend class AMCPCommand;\r
-\r
-       void ProcessMessage(const std::wstring& message, IO::ClientInfoPtr& pClientInfo);\r
-       std::size_t TokenizeMessage(const std::wstring& message, std::vector<std::wstring>* pTokenVector);\r
-       AMCPCommandPtr CommandFactory(const std::wstring& str);\r
-\r
-       bool QueueCommand(AMCPCommandPtr);\r
-\r
-       std::vector<safe_ptr<core::channel>> channels_;\r
-       std::vector<AMCPCommandQueuePtr> commandQueues_;\r
-       static const std::wstring MessageDelimiter;\r
-};\r
-\r
-}}}\r
+/*
+* 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 "../util/ProtocolStrategy.h"
+
+#include <core/video_channel.h>
+#include <core/thumbnail_generator.h>
+#include <core/producer/media_info/media_info_repository.h>
+#include <core/producer/cg_proxy.h>
+#include <core/system_info_provider.h>
+
+#include <common/memory.h>
+
+#include <boost/noncopyable.hpp>
+
+#include <string>
+#include <future>
+
+namespace caspar { namespace protocol { namespace amcp {
+
+class AMCPProtocolStrategy : public IO::IProtocolStrategy, boost::noncopyable
+{
+public:
+       AMCPProtocolStrategy(const std::wstring& name, const spl::shared_ptr<class amcp_command_repository>& repo);
+
+       virtual ~AMCPProtocolStrategy();
+
+       virtual void Parse(const std::wstring& msg, IO::ClientInfoPtr pClientInfo);
+       virtual std::string GetCodepage() const { return "UTF-8"; }
+
+private:
+       struct impl;
+       spl::unique_ptr<impl> impl_;
+};
+
+}}}