]> git.sesse.net Git - casparcg/blob - protocol/amcp/AMCPCommandsImpl.h
Merge branch '2.1.0' of https://github.com/CasparCG/Server into 2.1.0
[casparcg] / protocol / amcp / AMCPCommandsImpl.h
1 /*
2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
3 *
4 * This file is part of CasparCG (www.casparcg.com).
5 *
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.
10 *
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.
15 *
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/>.
18 *
19 * Author: Nicklas P Andersson
20 */
21
22  
23 #ifndef __AMCPCOMMANDSIMPL_H__
24 #define __AMCPCOMMANDSIMPL_H__
25
26 #include "AMCPCommand.h"
27
28 namespace caspar { namespace protocol {
29         
30 std::wstring ListMedia();
31 std::wstring ListTemplates();
32
33 namespace amcp {
34         
35 class ChannelGridCommand : public AMCPCommandBase<0>
36 {
37 public:
38         explicit ChannelGridCommand(IO::ClientInfoPtr client) : AMCPCommandBase(client) {}
39         std::wstring print() const { return L"ChannelGridCommand";}
40         bool DoExecute();
41 };
42
43 class DiagnosticsCommand : public AMCPCommandBase<0>
44 {
45 public:
46         explicit DiagnosticsCommand(IO::ClientInfoPtr client) : AMCPCommandBase(client) {}
47         std::wstring print() const { return L"DiagnosticsCommand";}
48         bool DoExecute();
49 };
50
51 class CallCommand : public AMCPChannelCommandBase<1>
52 {
53 public:
54         CallCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommandBase(client, channel, channel_index, layer_index)
55         {}
56
57 private:
58         std::wstring print() const { return L"CallCommand";}
59         bool DoExecute();
60 };
61
62 class MixerCommand : public AMCPChannelCommandBase<1>
63 {
64 public:
65         MixerCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommandBase(client, channel, channel_index, layer_index)
66         {}
67
68 private:
69         std::wstring print() const { return L"MixerCommand";}
70         bool DoExecute();
71 };
72         
73 class AddCommand : public AMCPChannelCommandBase<1>
74 {
75 public:
76         AddCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommandBase(client, channel, channel_index, layer_index)
77         {}
78
79 private:
80         std::wstring print() const { return L"AddCommand";}
81         bool DoExecute();
82 };
83
84 class RemoveCommand : public AMCPChannelCommandBase<0>
85 {
86 public:
87         RemoveCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommandBase(client, channel, channel_index, layer_index)
88         {}
89
90 private:
91         std::wstring print() const { return L"RemoveCommand";}
92         bool DoExecute();
93 };
94
95 class SwapCommand : public AMCPChannelCommandBase<1>, AMCPChannelsAwareCommand
96 {
97 public:
98         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)
99         {}
100
101 private:
102         std::wstring print() const { return L"SwapCommand";}
103         bool DoExecute();
104 };
105
106 class LoadCommand : public AMCPChannelCommandBase<1>
107 {
108 public:
109         LoadCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommandBase(client, channel, channel_index, layer_index)
110         {}
111
112 private:
113         std::wstring print() const { return L"LoadCommand";}
114         bool DoExecute();
115 };
116
117
118 class PlayCommand: public AMCPChannelCommandBase<0>, public AMCPChannelsAwareCommand
119 {
120 public:
121         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)
122         {}
123
124 private:
125         std::wstring print() const { return L"PlayCommand";}
126         bool DoExecute();
127 };
128
129 class LoadbgCommand : public AMCPChannelCommandBase<1>, public AMCPChannelsAwareCommand
130 {
131 public:
132         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)
133         {}
134         LoadbgCommand(const PlayCommand& rhs) : AMCPChannelCommandBase<1>(rhs), AMCPChannelsAwareCommand(rhs) {}
135
136 private:
137         std::wstring print() const { return L"LoadbgCommand";}
138         bool DoExecute();
139 };
140
141 class PauseCommand: public AMCPChannelCommandBase<0>
142 {
143 public:
144         PauseCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommandBase(client, channel, channel_index, layer_index)
145         {}
146
147 private:
148         std::wstring print() const { return L"PauseCommand";}
149         bool DoExecute();
150 };
151
152 class StopCommand : public AMCPChannelCommandBase<0>
153 {
154 public:
155         StopCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommandBase(client, channel, channel_index, layer_index)
156         {}
157
158 private:
159         std::wstring print() const { return L"StopCommand";}
160         bool DoExecute();
161 };
162
163 class ClearCommand : public AMCPChannelCommandBase<0>
164 {
165 public:
166         ClearCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommandBase(client, channel, channel_index, layer_index)
167         {}
168
169 private:
170         std::wstring print() const { return L"ClearCommand";}
171         bool DoExecute();
172 };
173
174 class PrintCommand : public AMCPChannelCommandBase<0>
175 {
176 public:
177         PrintCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommandBase(client, channel, channel_index, layer_index)
178         {}
179
180 private:
181         std::wstring print() const { return L"PrintCommand";}
182         bool DoExecute();
183 };
184
185 class LogCommand : public AMCPCommandBase<2>
186 {
187 public:
188         explicit LogCommand(IO::ClientInfoPtr client) : AMCPCommandBase(client) {}
189         std::wstring print() const { return L"LogCommand";}
190         bool DoExecute();
191 };
192
193 class CGCommand : public AMCPChannelCommandBase<1>
194 {
195 public:
196         CGCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommandBase(client, channel, channel_index, layer_index)
197         {}
198
199 private:
200         std::wstring print() const { return L"CGCommand";}
201         bool DoExecute();
202         bool ValidateLayer(const std::wstring& layerstring);
203
204         bool DoExecuteAdd();
205         bool DoExecutePlay();
206         bool DoExecuteStop();
207         bool DoExecuteNext();
208         bool DoExecuteRemove();
209         bool DoExecuteClear();
210         bool DoExecuteUpdate();
211         bool DoExecuteInvoke();
212         bool DoExecuteInfo();
213 };
214
215 class DataCommand : public AMCPCommandBase<1>
216 {
217 public:
218         explicit DataCommand(IO::ClientInfoPtr client) : AMCPCommandBase(client) {}
219
220         std::wstring print() const { return L"DataCommand";}
221         bool DoExecute();
222         bool DoExecuteStore();
223         bool DoExecuteRetrieve();
224         bool DoExecuteRemove();
225         bool DoExecuteList();
226 };
227
228 class ClsCommand : public AMCPCommandBase<0>
229 {
230 public:
231         explicit ClsCommand(IO::ClientInfoPtr client) : AMCPCommandBase(client) {}
232         std::wstring print() const { return L"ClsCommand";}
233         bool DoExecute();
234 };
235
236 class TlsCommand : public AMCPCommandBase<0>
237 {
238 public:
239         explicit TlsCommand(IO::ClientInfoPtr client) : AMCPCommandBase(client) {}
240         std::wstring print() const { return L"TlsCommand";}
241         bool DoExecute();
242 };
243
244 class CinfCommand : public AMCPCommandBase<1>
245 {
246 public:
247         explicit CinfCommand(IO::ClientInfoPtr client) : AMCPCommandBase(client) {}
248         std::wstring print() const { return L"CinfCommand";}
249         bool DoExecute();
250 };
251
252 class InfoCommand : public AMCPCommandBase<0>, AMCPChannelsAwareCommand
253 {
254 public:
255         InfoCommand(IO::ClientInfoPtr client, const std::vector<channel_context>& channels) : AMCPChannelsAwareCommand(channels), AMCPCommandBase(client) {}
256         std::wstring print() const { return L"InfoCommand";}
257         bool DoExecute();
258 };
259
260 class VersionCommand : public AMCPCommandBase<0>
261 {
262 public:
263         explicit VersionCommand(IO::ClientInfoPtr client) : AMCPCommandBase(client) {}
264         std::wstring print() const { return L"VersionCommand";}
265         bool DoExecute();
266 };
267
268 class ByeCommand : public AMCPCommandBase<0>
269 {
270 public:
271         explicit ByeCommand(IO::ClientInfoPtr client) : AMCPCommandBase(client) {}
272         std::wstring print() const { return L"ByeCommand";}
273         bool DoExecute();
274 };
275
276 class SetCommand : public AMCPChannelCommandBase<2>
277 {
278 public:
279         SetCommand(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommandBase(client, channel, channel_index, layer_index)
280         {}
281
282 private:
283         std::wstring print() const { return L"SetCommand";}
284         bool DoExecute();
285 };
286
287 class LockCommand : public AMCPCommandBase<1>, AMCPChannelsAwareCommand
288 {
289 public:
290         LockCommand(IO::ClientInfoPtr client, const std::vector<channel_context>& channels) : AMCPChannelsAwareCommand(channels), AMCPCommandBase(client) {}
291         std::wstring print() const { return L"LockCommand";}
292         bool DoExecute();
293 };
294
295 //class KillCommand : public AMCPCommand
296 //{
297 //public:
298 //      KillCommand() {}
299 //      virtual bool DoExecute();
300 //      virtual AMCPCommandCondition CheckConditions();
301 //
302 //      virtual bool NeedChannel() {
303 //              return false;
304 //      }
305 //      virtual AMCPCommandScheduling GetDefaultScheduling() {
306 //              return AddToQueue;
307 //      }
308 //      virtual int GetMinimumParameters() {
309 //              return 0;
310 //      }
311 //};
312
313 }       //namespace amcp
314 }}      //namespace caspar
315
316 #endif  //__AMCPCOMMANDSIMPL_H__