]> 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 "../../../common/utility/find_file.h"\r
28 #include "../../frame/gpu_frame.h"\r
29 #include "../../server.h"\r
30 \r
31 #include <boost/assign/list_of.hpp>\r
32 \r
33 using namespace boost::assign;\r
34 \r
35 namespace caspar { namespace flash {\r
36         \r
37 frame_producer_ptr create_ct_producer(const std::vector<std::wstring>& params, const frame_format_desc& format_desc) \r
38 {\r
39         std::wstring filename = params[0];\r
40         std::wstring result_filename = common::find_file(server::media_folder() + filename, list_of(L"ct"));\r
41         if(result_filename.empty())\r
42                 return nullptr;\r
43         \r
44         std::wstring fixed_filename = result_filename;\r
45         std::wstring::size_type pos = 0;\r
46         while((pos = fixed_filename.find(TEXT('\\'), pos)) != std::wstring::npos) \r
47                 fixed_filename[pos] = TEXT('/');\r
48         \r
49         cg_producer_ptr cg_producer(new cg_producer(format_desc));\r
50         cg_producer->add(0, filename, 1);\r
51         return cg_producer;\r
52 }\r
53 \r
54 }\r
55 \r
56 }       //namespace caspar