2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
4 * This file is part of CasparCG (www.casparcg.com).
6 * CasparCG is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * CasparCG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
19 * Author: Robert Nagy, ronag89@gmail.com
24 #include "frame_producer.h"
26 #include "../monitor/monitor.h"
28 #include <common/forward.h>
29 #include <common/future_fwd.h>
30 #include <common/memory.h>
31 #include <common/tweener.h>
33 #include <boost/optional.hpp>
34 #include <boost/property_tree/ptree_fwd.hpp>
41 FORWARD2(caspar, diagnostics, class graph);
43 namespace caspar { namespace core {
45 typedef reactive::observable<std::map<int, class draw_frame>> frame_observable;
47 class stage sealed : public monitor::observable, public frame_observable
50 stage& operator=(const stage&);
55 typedef std::function<struct frame_transform(struct frame_transform)> transform_func_t;
56 typedef std::tuple<int, transform_func_t, unsigned int, tweener> transform_tuple_t;
60 explicit stage(spl::shared_ptr<diagnostics::graph> graph);
64 std::map<int, class draw_frame> operator()(const struct video_format_desc& format_desc);
66 boost::unique_future<void> apply_transforms(const std::vector<transform_tuple_t>& transforms);
67 boost::unique_future<void> apply_transform(int index, const transform_func_t& transform, unsigned int mix_duration = 0, const tweener& tween = L"linear");
68 boost::unique_future<void> clear_transforms(int index);
69 boost::unique_future<void> clear_transforms();
70 boost::unique_future<void> load(int index, const spl::shared_ptr<class frame_producer>& producer, bool preview = false, const boost::optional<int32_t>& auto_play_delta = nullptr);
71 boost::unique_future<void> pause(int index);
72 boost::unique_future<void> play(int index);
73 boost::unique_future<void> stop(int index);
74 boost::unique_future<std::wstring> call(int index, const std::wstring& params);
75 boost::unique_future<void> clear(int index);
76 boost::unique_future<void> clear();
77 boost::unique_future<void> swap_layers(stage& other);
78 boost::unique_future<void> swap_layer(int index, int other_index);
79 boost::unique_future<void> swap_layer(int index, int other_index, stage& other);
81 // monitor::observable
83 void subscribe(const monitor::observable::observer_ptr& o) override;
84 void unsubscribe(const monitor::observable::observer_ptr& o) override;
88 void subscribe(const frame_observable::observer_ptr& o) override;
89 void unsubscribe(const frame_observable::observer_ptr& o) override;
93 boost::unique_future<spl::shared_ptr<class frame_producer>> foreground(int index);
94 boost::unique_future<spl::shared_ptr<class frame_producer>> background(int index);
96 boost::unique_future<boost::property_tree::wptree> info() const;
97 boost::unique_future<boost::property_tree::wptree> info(int index) const;
101 spl::shared_ptr<impl> impl_;