2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
4 * This file is part of CasparCG (www.casparcg.com).
6 * CasparCG is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * CasparCG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
19 * Author: Nicklas P Andersson
23 #ifndef __AMCPCOMMANDSIMPL_H__
24 #define __AMCPCOMMANDSIMPL_H__
26 #include "AMCPCommand.h"
28 #include <core/thumbnail_generator.h>
30 namespace caspar { namespace protocol {
32 std::wstring ListMedia();
33 std::wstring ListTemplates();
37 class ChannelGridCommand : public AMCPCommandBase<0>
40 explicit ChannelGridCommand(IO::ClientInfoPtr client) : AMCPCommandBase(client) {}
41 std::wstring print() const { return L"ChannelGridCommand";}
45 class DiagnosticsCommand : public AMCPCommandBase<0>
48 explicit DiagnosticsCommand(IO::ClientInfoPtr client) : AMCPCommandBase(client) {}
49 std::wstring print() const { return L"DiagnosticsCommand";}
53 class CallCommand : public AMCPChannelCommandBase<1>
56 CallCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommandBase(client, channel, channel_index, layer_index)
60 std::wstring print() const { return L"CallCommand";}
64 class MixerCommand : public AMCPChannelCommandBase<1>
67 MixerCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommandBase(client, channel, channel_index, layer_index)
71 std::wstring print() const { return L"MixerCommand";}
75 class AddCommand : public AMCPChannelCommandBase<1>
78 AddCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommandBase(client, channel, channel_index, layer_index)
82 std::wstring print() const { return L"AddCommand";}
86 class RemoveCommand : public AMCPChannelCommandBase<0>
89 RemoveCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommandBase(client, channel, channel_index, layer_index)
93 std::wstring print() const { return L"RemoveCommand";}
97 class SwapCommand : public AMCPChannelCommandBase<1>, AMCPChannelsAwareCommand
100 SwapCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index, const std::vector<channel_context>& channels) : AMCPChannelCommandBase(client, channel, channel_index, layer_index), AMCPChannelsAwareCommand(channels)
104 std::wstring print() const { return L"SwapCommand";}
108 class LoadCommand : public AMCPChannelCommandBase<1>
111 LoadCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommandBase(client, channel, channel_index, layer_index)
115 std::wstring print() const { return L"LoadCommand";}
120 class PlayCommand: public AMCPChannelCommandBase<0>, public AMCPChannelsAwareCommand
123 PlayCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index, const std::vector<channel_context>& channels) : AMCPChannelCommandBase(client, channel, channel_index, layer_index), AMCPChannelsAwareCommand(channels)
127 std::wstring print() const { return L"PlayCommand";}
131 class LoadbgCommand : public AMCPChannelCommandBase<1>, public AMCPChannelsAwareCommand
134 LoadbgCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index, const std::vector<channel_context>& channels) : AMCPChannelCommandBase(client, channel, channel_index, layer_index), AMCPChannelsAwareCommand(channels)
136 LoadbgCommand(const PlayCommand& rhs) : AMCPChannelCommandBase<1>(rhs), AMCPChannelsAwareCommand(rhs) {}
139 std::wstring print() const { return L"LoadbgCommand";}
143 class PauseCommand: public AMCPChannelCommandBase<0>
146 PauseCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommandBase(client, channel, channel_index, layer_index)
150 std::wstring print() const { return L"PauseCommand";}
154 class StopCommand : public AMCPChannelCommandBase<0>
157 StopCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommandBase(client, channel, channel_index, layer_index)
161 std::wstring print() const { return L"StopCommand";}
165 class ClearCommand : public AMCPChannelCommandBase<0>
168 ClearCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommandBase(client, channel, channel_index, layer_index)
172 std::wstring print() const { return L"ClearCommand";}
176 class PrintCommand : public AMCPChannelCommandBase<0>
179 PrintCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommandBase(client, channel, channel_index, layer_index)
183 std::wstring print() const { return L"PrintCommand";}
187 class LogCommand : public AMCPCommandBase<2>
190 explicit LogCommand(IO::ClientInfoPtr client) : AMCPCommandBase(client) {}
191 std::wstring print() const { return L"LogCommand";}
195 class CGCommand : public AMCPChannelCommandBase<1>
198 CGCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommandBase(client, channel, channel_index, layer_index)
202 std::wstring print() const { return L"CGCommand";}
204 bool ValidateLayer(const std::wstring& layerstring);
207 bool DoExecutePlay();
208 bool DoExecuteStop();
209 bool DoExecuteNext();
210 bool DoExecuteRemove();
211 bool DoExecuteClear();
212 bool DoExecuteUpdate();
213 bool DoExecuteInvoke();
214 bool DoExecuteInfo();
217 class DataCommand : public AMCPCommandBase<1>
220 explicit DataCommand(IO::ClientInfoPtr client) : AMCPCommandBase(client) {}
222 std::wstring print() const { return L"DataCommand";}
224 bool DoExecuteStore();
225 bool DoExecuteRetrieve();
226 bool DoExecuteRemove();
227 bool DoExecuteList();
230 class ClsCommand : public AMCPCommandBase<0>
233 explicit ClsCommand(IO::ClientInfoPtr client) : AMCPCommandBase(client) {}
234 std::wstring print() const { return L"ClsCommand";}
238 class TlsCommand : public AMCPCommandBase<0>
241 explicit TlsCommand(IO::ClientInfoPtr client) : AMCPCommandBase(client) {}
242 std::wstring print() const { return L"TlsCommand";}
246 class CinfCommand : public AMCPCommandBase<1>
249 explicit CinfCommand(IO::ClientInfoPtr client) : AMCPCommandBase(client) {}
250 std::wstring print() const { return L"CinfCommand";}
254 class InfoCommand : public AMCPCommandBase<0>, AMCPChannelsAwareCommand
257 InfoCommand(IO::ClientInfoPtr client, const std::vector<channel_context>& channels) : AMCPChannelsAwareCommand(channels), AMCPCommandBase(client) {}
258 std::wstring print() const { return L"InfoCommand";}
262 class VersionCommand : public AMCPCommandBase<0>
265 explicit VersionCommand(IO::ClientInfoPtr client) : AMCPCommandBase(client) {}
266 std::wstring print() const { return L"VersionCommand";}
270 class ByeCommand : public AMCPCommandBase<0>
273 explicit ByeCommand(IO::ClientInfoPtr client) : AMCPCommandBase(client) {}
274 std::wstring print() const { return L"ByeCommand";}
278 class SetCommand : public AMCPChannelCommandBase<2>
281 SetCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommandBase(client, channel, channel_index, layer_index)
284 std::wstring print() const { return L"SetCommand";}
288 class LockCommand : public AMCPCommandBase<1>, AMCPChannelsAwareCommand
291 LockCommand(IO::ClientInfoPtr client, const std::vector<channel_context>& channels) : AMCPChannelsAwareCommand(channels), AMCPCommandBase(client) {}
292 std::wstring print() const { return L"LockCommand";}
296 class ThumbnailCommand : public AMCPCommandBase<1>
299 ThumbnailCommand::ThumbnailCommand(IO::ClientInfoPtr client, std::shared_ptr<core::thumbnail_generator> thumb_gen) : AMCPCommandBase(client), thumb_gen_(thumb_gen)
301 std::wstring print() const { return L"ThumbnailCommand";}
305 bool DoExecuteRetrieve();
306 bool DoExecuteList();
307 bool DoExecuteGenerate();
308 bool DoExecuteGenerateAll();
310 std::shared_ptr<core::thumbnail_generator> thumb_gen_;
313 //class KillCommand : public AMCPCommand
317 // virtual bool DoExecute();
318 // virtual AMCPCommandCondition CheckConditions();
320 // virtual bool NeedChannel() {
323 // virtual AMCPCommandScheduling GetDefaultScheduling() {
324 // return AddToQueue;
326 // virtual int GetMinimumParameters() {
332 }} //namespace caspar
334 #endif //__AMCPCOMMANDSIMPL_H__