]> git.sesse.net Git - casparcg/blob - core/producer/stage.h
2.1.0: ffmpeg_producer: Preallocate/reserve some frames during construction.
[casparcg] / core / producer / stage.h
1 /*\r
2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>\r
3 *\r
4 * This file is part of CasparCG (www.casparcg.com).\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 * Author: Robert Nagy, ronag89@gmail.com\r
20 */\r
21 \r
22 #pragma once\r
23 \r
24 #include "frame_producer.h"\r
25 \r
26 #include <common/forward.h>\r
27 #include <common/spl/memory.h>\r
28 #include <common/tweener.h>\r
29 \r
30 #include <boost/property_tree/ptree_fwd.hpp>\r
31 \r
32 #include <functional>\r
33 #include <tuple>\r
34 #include <vector>\r
35 \r
36 FORWARD2(caspar, diagnostics, class graph);\r
37 FORWARD1(boost, template<typename> class unique_future);\r
38 \r
39 namespace caspar { namespace core {\r
40         \r
41 class stage sealed\r
42 {\r
43         stage(const stage&);\r
44         stage& operator=(const stage&);\r
45 public: \r
46         typedef std::function<struct frame_transform(struct frame_transform)> transform_func_t;\r
47         typedef std::tuple<int, transform_func_t, unsigned int, tweener> transform_tuple_t;\r
48 \r
49         stage();\r
50                 \r
51         std::map<int, spl::shared_ptr<class draw_frame>> operator()(const struct video_format_desc& format_desc);\r
52 \r
53         void apply_transforms(const std::vector<transform_tuple_t>& transforms);\r
54         void apply_transform(int index, const transform_func_t& transform, unsigned int mix_duration = 0, const tweener& tween = L"linear");\r
55         void clear_transforms(int index);\r
56         void clear_transforms();\r
57                                 \r
58         void load(int index, const spl::shared_ptr<struct frame_producer>& producer, const boost::optional<int32_t>& auto_play_delta = nullptr);\r
59         void pause(int index);\r
60         void play(int index);\r
61         void stop(int index);\r
62         void clear(int index);\r
63         void clear();   \r
64         void swap_layers(const spl::shared_ptr<stage>& other);\r
65         void swap_layer(int index, int other_index);\r
66         void swap_layer(int index, int other_index, const spl::shared_ptr<stage>& other);\r
67         \r
68         boost::unique_future<spl::shared_ptr<struct frame_producer>>    foreground(int index);\r
69         boost::unique_future<spl::shared_ptr<struct frame_producer>>    background(int index);\r
70 \r
71         boost::unique_future<boost::property_tree::wptree> info() const;\r
72         boost::unique_future<boost::property_tree::wptree> info(int index) const;\r
73         \r
74 private:\r
75         struct impl;\r
76         spl::shared_ptr<impl> impl_;\r
77 };\r
78 \r
79 }}