]> git.sesse.net Git - casparcg/blob - protocol/amcp/AMCPCommandsImpl.h
569a1cb50c55cf818e4ba89ce92d061715f9a7a7
[casparcg] / protocol / amcp / AMCPCommandsImpl.h
1 /*\r
2 * Copyright 2013 Sveriges Television AB http://casparcg.com/\r
3 *\r
4 * This file is part of CasparCG (www.casparcg.com).\r
5 *\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
10 *\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
15 *\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
18 *\r
19 * Author: Nicklas P Andersson\r
20 */\r
21 \r
22  \r
23 #ifndef __AMCPCOMMANDSIMPL_H__\r
24 #define __AMCPCOMMANDSIMPL_H__\r
25 \r
26 #include "AMCPCommand.h"\r
27 \r
28 namespace caspar {\r
29 \r
30 namespace core {\r
31         struct frame_transform;\r
32         struct frame_producer;\r
33 }\r
34 \r
35 namespace protocol {\r
36 \r
37 std::wstring ListMedia();\r
38 std::wstring ListTemplates();\r
39 \r
40 namespace amcp {\r
41         \r
42 class ChannelGridCommand : public AMCPCommandBase<false, AddToQueue, 0>\r
43 {\r
44         std::wstring print() const { return L"ChannelGridCommand";}\r
45         bool DoExecute();\r
46 };\r
47 \r
48 class DiagnosticsCommand : public AMCPCommandBase<false, AddToQueue, 0>\r
49 {\r
50         std::wstring print() const { return L"DiagnosticsCommand";}\r
51         bool DoExecute();\r
52 };\r
53 \r
54 class CallCommand : public AMCPCommandBase<true, AddToQueue, 1>\r
55 {\r
56         std::wstring print() const { return L"CallCommand";}\r
57         bool DoExecute();\r
58 };\r
59 \r
60 class MixerCommand : public AMCPCommandBase<true, AddToQueue, 1>\r
61 {\r
62         std::wstring print() const { return L"MixerCommand";}\r
63         core::frame_transform get_current_transform();\r
64         template<typename Func>\r
65         bool reply_value(const Func& extractor)\r
66         {\r
67                 auto value = extractor(get_current_transform());\r
68 \r
69                 SetReplyString(L"201 MIXER OK\r\n"\r
70                         + boost::lexical_cast<std::wstring>(value) + L"\r\n");\r
71 \r
72                 return true;\r
73         }\r
74         bool DoExecute();\r
75 };\r
76         \r
77 class AddCommand : public AMCPCommandBase<true, AddToQueue, 1>\r
78 {\r
79         std::wstring print() const { return L"AddCommand";}\r
80         bool DoExecute();\r
81 };\r
82 \r
83 class RemoveCommand : public AMCPCommandBase<true, AddToQueue, 0>\r
84 {\r
85         std::wstring print() const { return L"RemoveCommand";}\r
86         bool DoExecute();\r
87 };\r
88 \r
89 class SwapCommand : public AMCPCommandBase<true, AddToQueue, 1>\r
90 {\r
91         std::wstring print() const { return L"SwapCommand";}\r
92         bool DoExecute();\r
93 };\r
94 \r
95 class RouteCommand : public AMCPCommandBase<true, AddToQueue, 1>\r
96 {\r
97         std::wstring print() const { return L"RouteCommand";}\r
98         bool DoExecute();\r
99 public:\r
100         static safe_ptr<core::frame_producer> TryCreateProducer(AMCPCommand& command, std::wstring const& uri);\r
101 };\r
102 \r
103 /*class RouteCommand : public AMCPCommandBase<true, AddToQueue, 1>\r
104 {\r
105         std::wstring print() const { return L"RouteCommand";}\r
106         bool DoExecute();\r
107 };*/\r
108 \r
109 class LoadCommand : public AMCPCommandBase<true, AddToQueue, 1>\r
110 {\r
111         std::wstring print() const { return L"LoadCommand";}\r
112         bool DoExecute();\r
113 };\r
114 \r
115 class LoadbgCommand : public AMCPCommandBase<true, AddToQueue, 1>\r
116 {\r
117         std::wstring print() const { return L"LoadbgCommand";}\r
118         bool DoExecute();\r
119 };\r
120 \r
121 class PlayCommand: public AMCPCommandBase<true, AddToQueue, 0>\r
122 {\r
123         std::wstring print() const { return L"PlayCommand";}\r
124         bool DoExecute();\r
125 };\r
126 \r
127 class PauseCommand: public AMCPCommandBase<true, AddToQueue, 0>\r
128 {\r
129         std::wstring print() const { return L"PauseCommand";}\r
130         bool DoExecute();\r
131 };\r
132 \r
133 class ResumeCommand: public AMCPCommandBase<true, AddToQueue, 0>\r
134 {\r
135         std::wstring print() const { return L"ResumeCommand";}\r
136         bool DoExecute();\r
137 };\r
138 \r
139 class StopCommand : public AMCPCommandBase<true, AddToQueue, 0>\r
140 {\r
141         std::wstring print() const { return L"StopCommand";}\r
142         bool DoExecute();\r
143 };\r
144 \r
145 class ClearCommand : public AMCPCommandBase<true, AddToQueue, 0>\r
146 {\r
147         std::wstring print() const { return L"ClearCommand";}\r
148         bool DoExecute();\r
149 };\r
150 \r
151 class PrintCommand : public AMCPCommandBase<true, AddToQueue, 0>\r
152 {\r
153         std::wstring print() const { return L"PrintCommand";}\r
154         bool DoExecute();\r
155 };\r
156 \r
157 class LogCommand : public AMCPCommandBase<false, AddToQueue, 0>\r
158 {\r
159         std::wstring print() const { return L"LogCommand";}\r
160         bool DoExecute();\r
161 };\r
162 \r
163 class CGCommand : public AMCPCommandBase<true, AddToQueue, 1>\r
164 {\r
165         std::wstring print() const { return L"CGCommand";}\r
166         bool DoExecute();\r
167         bool ValidateLayer(const std::wstring& layerstring);\r
168 \r
169         bool DoExecuteAdd();\r
170         bool DoExecutePlay();\r
171         bool DoExecuteStop();\r
172         bool DoExecuteNext();\r
173         bool DoExecuteRemove();\r
174         bool DoExecuteClear();\r
175         bool DoExecuteUpdate();\r
176         bool DoExecuteInvoke();\r
177         bool DoExecuteInfo();\r
178 };\r
179 \r
180 class DataCommand : public AMCPCommandBase<false, AddToQueue, 1>\r
181 {\r
182         std::wstring print() const { return L"DataCommand";}\r
183         bool DoExecute();\r
184         bool DoExecuteStore();\r
185         bool DoExecuteRetrieve();\r
186         bool DoExecuteRemove();\r
187         bool DoExecuteList();\r
188 };\r
189 \r
190 class ThumbnailCommand : public AMCPCommandBase<false, AddToQueue, 1>\r
191 {\r
192         std::wstring print() const { return L"ThumbnailCommand";}\r
193         bool DoExecute();\r
194         bool DoExecuteRetrieve();\r
195         bool DoExecuteList();\r
196         bool DoExecuteGenerate();\r
197         bool DoExecuteGenerateAll();\r
198 };\r
199 \r
200 class ClsCommand : public AMCPCommandBase<false, AddToQueue, 0>\r
201 {\r
202         std::wstring print() const { return L"ClsCommand";}\r
203         bool DoExecute();\r
204 };\r
205 \r
206 class TlsCommand : public AMCPCommandBase<false, AddToQueue, 0>\r
207 {\r
208         std::wstring print() const { return L"TlsCommand";}\r
209         bool DoExecute();\r
210 };\r
211 \r
212 class CinfCommand : public AMCPCommandBase<false, AddToQueue, 1>\r
213 {\r
214         std::wstring print() const { return L"CinfCommand";}\r
215         bool DoExecute();\r
216 };\r
217 \r
218 class InfoCommand : public AMCPCommandBase<false, AddToQueue, 0>\r
219 {\r
220 public:\r
221         std::wstring print() const { return L"InfoCommand";}\r
222         InfoCommand(const std::vector<safe_ptr<core::video_channel>>& channels) : channels_(channels){}\r
223         bool DoExecute();\r
224 private:\r
225         const std::vector<safe_ptr<core::video_channel>>& channels_;\r
226 };\r
227 \r
228 class VersionCommand : public AMCPCommandBase<false, AddToQueue, 0>\r
229 {\r
230         std::wstring print() const { return L"VersionCommand";}\r
231         bool DoExecute();\r
232 };\r
233 \r
234 class ByeCommand : public AMCPCommandBase<false, AddToQueue, 0>\r
235 {\r
236         std::wstring print() const { return L"ByeCommand";}\r
237         bool DoExecute();\r
238 };\r
239 \r
240 class SetCommand : public AMCPCommandBase<true, AddToQueue, 2>\r
241 {\r
242         std::wstring print() const { return L"SetCommand";}\r
243         bool DoExecute();\r
244 };\r
245 \r
246 class KillCommand : public AMCPCommandBase<false, AddToQueue, 0>\r
247 {\r
248         std::wstring print() const { return L"KillCommand";}\r
249         bool DoExecute();\r
250 };\r
251 \r
252 class RestartCommand : public AMCPCommandBase<false, AddToQueue, 0>\r
253 {\r
254         std::wstring print() const { return L"RestartCommand";}\r
255         bool DoExecute();\r
256 };\r
257 \r
258 }       //namespace amcp\r
259 }}      //namespace caspar\r
260 \r
261 #endif  //__AMCPCOMMANDSIMPL_H__