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 "frame_producer.h"
\r
26 #include "../monitor/monitor.h"
\r
28 #include <common/forward.h>
\r
29 #include <common/future_fwd.h>
\r
30 #include <common/memory.h>
\r
31 #include <common/tweener.h>
\r
33 #include <boost/optional.hpp>
\r
34 #include <boost/property_tree/ptree_fwd.hpp>
\r
36 #include <functional>
\r
40 FORWARD2(caspar, diagnostics, class graph);
\r
42 namespace caspar { namespace core {
\r
44 class stage sealed : public monitor::observable
\r
46 stage(const stage&);
\r
47 stage& operator=(const stage&);
\r
52 typedef std::function<struct frame_transform(struct frame_transform)> transform_func_t;
\r
53 typedef std::tuple<int, transform_func_t, unsigned int, tweener> transform_tuple_t;
\r
57 explicit stage(spl::shared_ptr<diagnostics::graph> graph);
\r
61 std::map<int, class draw_frame> operator()(const struct video_format_desc& format_desc);
\r
63 void apply_transforms(const std::vector<transform_tuple_t>& transforms);
\r
64 void apply_transform(int index, const transform_func_t& transform, unsigned int mix_duration = 0, const tweener& tween = L"linear");
\r
65 void clear_transforms(int index);
\r
66 void clear_transforms();
\r
68 void load(int index, const spl::shared_ptr<class frame_producer>& producer, bool preview = false, const boost::optional<int32_t>& auto_play_delta = nullptr);
\r
69 void pause(int index);
\r
70 void play(int index);
\r
71 void stop(int index);
\r
72 void clear(int index);
\r
74 void swap_layers(stage& other);
\r
75 void swap_layer(int index, int other_index);
\r
76 void swap_layer(int index, int other_index, stage& other);
\r
78 boost::unique_future<std::wstring> call(int index, const std::wstring& params);
\r
80 // monitor::observable
\r
82 void subscribe(const monitor::observable::observer_ptr& o) override;
\r
83 void unsubscribe(const monitor::observable::observer_ptr& o) override;
\r
87 boost::unique_future<spl::shared_ptr<class frame_producer>> foreground(int index);
\r
88 boost::unique_future<spl::shared_ptr<class frame_producer>> background(int index);
\r
90 boost::unique_future<boost::property_tree::wptree> info() const;
\r
91 boost::unique_future<boost::property_tree::wptree> info(int index) const;
\r
95 spl::shared_ptr<impl> impl_;
\r