2 * copyright (c) 2010 Sveriges Television AB <info@casparcg.com>
\r
4 * This file is part of CasparCG.
\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
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
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
21 #include "../../stdafx.h"
\r
23 #include "ct_producer.h"
\r
25 #include "cg_producer.h"
\r
27 #include "../../processor/draw_frame.h"
\r
28 #include "../../server.h"
\r
30 #include <boost/assign/list_of.hpp>
\r
32 using namespace boost::assign;
\r
34 namespace caspar { namespace core { namespace flash {
\r
36 struct ct_producer : public cg_producer
\r
38 ct_producer(ct_producer&& other) : initialized_(std::move(other.initialized_)), filename_(std::move(other.filename_)){}
\r
39 ct_producer(const std::wstring& filename) : filename_(filename), initialized_(false){}
\r
41 safe_ptr<draw_frame> receive()
\r
45 cg_producer::add(0, filename_, 1);
\r
46 initialized_ = true;
\r
48 return cg_producer::receive();
\r
51 std::wstring print() const
\r
53 return L"ct[" + filename_ + L"]";
\r
57 std::wstring filename_;
\r
60 safe_ptr<frame_producer> create_ct_producer(const std::vector<std::wstring>& params)
\r
62 std::wstring filename = server::media_folder() + L"\\" + params[0] + L".ct";
\r
63 return boost::filesystem::exists(filename) ? make_safe<ct_producer>(filename) : frame_producer::empty();
\r