]> git.sesse.net Git - casparcg/blob - core/producer/flash/ct_producer.cpp
2.0.0.2:
[casparcg] / core / producer / flash / ct_producer.cpp
1 /*\r
2 * copyright (c) 2010 Sveriges Television AB <info@casparcg.com>\r
3 *\r
4 *  This file is part of CasparCG.\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 */\r
20  \r
21 #include "../../stdafx.h"\r
22 \r
23 #include "ct_producer.h"\r
24 \r
25 #include "cg_producer.h"\r
26 \r
27 #include "../../processor/frame.h"\r
28 #include "../../server.h"\r
29 \r
30 #include <boost/assign/list_of.hpp>\r
31 \r
32 using namespace boost::assign;\r
33 \r
34 namespace caspar { namespace core { namespace flash {\r
35 \r
36 struct ct_producer : public cg_producer\r
37 {\r
38         ct_producer(const std::wstring& filename) : filename_(filename), initialized_(false){}\r
39 \r
40         frame_ptr render_frame()\r
41         {\r
42                 if(!initialized_)\r
43                 {\r
44                         cg_producer::add(0, filename_, 1);\r
45                         initialized_ = true;\r
46                 }\r
47                 return cg_producer::render_frame();\r
48         }\r
49 \r
50         std::wstring print() const\r
51         {\r
52                 return L"ct_producer. filename: " + filename_;\r
53         }\r
54 \r
55         bool initialized_;\r
56         std::wstring filename_;\r
57 };\r
58         \r
59 frame_producer_ptr create_ct_producer(const std::vector<std::wstring>& params) \r
60 {\r
61         std::wstring filename = server::media_folder() + L"\\" + params[0] + L".ct";\r
62         return boost::filesystem::exists(filename) ? std::make_shared<ct_producer>(filename) : nullptr;\r
63 }\r
64 \r
65 }}}