2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
\r
4 * This file is part of CasparCG (www.casparcg.com).
\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
19 * Author: Robert Nagy, ronag89@gmail.com
\r
24 #include "../monitor/monitor.h"
\r
25 #include "../video_format.h"
\r
27 #include <common/forward.h>
\r
28 #include <common/future_fwd.h>
\r
29 #include <common/memory.h>
\r
30 #include <common/enum_class.h>
\r
34 #include <functional>
\r
36 #include <type_traits>
\r
39 #include <boost/property_tree/ptree_fwd.hpp>
\r
41 FORWARD1(caspar, class executor);
\r
43 namespace caspar { namespace core {
\r
46 class frame_producer : public monitor::observable
\r
48 frame_producer(const frame_producer&);
\r
49 frame_producer& operator=(const frame_producer&);
\r
54 static const spl::shared_ptr<frame_producer>& empty();
\r
59 virtual ~frame_producer(){}
\r
63 virtual class draw_frame receive() = 0;
\r
64 virtual boost::unique_future<std::wstring> call(const std::wstring& params) = 0;
\r
66 // monitor::observable
\r
68 virtual void subscribe(const monitor::observable::observer_ptr& o) = 0;
\r
69 virtual void unsubscribe(const monitor::observable::observer_ptr& o) = 0;
\r
74 virtual void paused(bool value) = 0;
\r
75 virtual std::wstring print() const = 0;
\r
76 virtual std::wstring name() const = 0;
\r
77 virtual boost::property_tree::wptree info() const = 0;
\r
78 virtual uint32_t nb_frames() const = 0;
\r
79 virtual uint32_t frame_number() const = 0;
\r
80 virtual class draw_frame last_frame() = 0;
\r
81 virtual void leading_producer(const spl::shared_ptr<frame_producer>&) {}
\r
84 class frame_producer_base : public frame_producer
\r
87 frame_producer_base();
\r
88 virtual ~frame_producer_base(){}
\r
92 virtual boost::unique_future<std::wstring> call(const std::wstring& params);
\r
94 // monitor::observable
\r
98 void paused(bool value) override;
\r
99 uint32_t nb_frames() const override;
\r
100 uint32_t frame_number() const override;
\r
101 virtual class draw_frame last_frame() override;
\r
104 virtual class draw_frame receive() override;
\r
105 virtual class draw_frame receive_impl() = 0;
\r
108 friend struct impl;
\r
109 std::shared_ptr<impl> impl_;
\r
112 typedef std::function<spl::shared_ptr<core::frame_producer>(const spl::shared_ptr<class frame_factory>&, const video_format_desc& format_desc, const std::vector<std::wstring>&)> producer_factory_t;
\r
113 void register_producer_factory(const producer_factory_t& factory); // Not thread-safe.
\r
115 spl::shared_ptr<core::frame_producer> create_producer(const spl::shared_ptr<frame_factory>&, const video_format_desc& format_desc, const std::vector<std::wstring>& params);
\r
116 spl::shared_ptr<core::frame_producer> create_producer(const spl::shared_ptr<frame_factory>&, const video_format_desc& format_desc, const std::wstring& params);
\r
118 spl::shared_ptr<core::frame_producer> create_destroy_proxy(spl::shared_ptr<core::frame_producer> producer);
\r