]> git.sesse.net Git - casparcg/blob - core/mixer/mixer.h
2.0.2: Improved INFO.
[casparcg] / core / mixer / mixer.h
1 /*\r
2 * copyright (c) 2010 Sveriges Television AB <info@casparcg.com>\r
3 *\r
4 *  This file is part of CasparCG.\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 */\r
20 #pragma once\r
21 \r
22 #include "image/blend_modes.h"\r
23 \r
24 #include "../producer/frame/frame_factory.h"\r
25 \r
26 #include <common/memory/safe_ptr.h>\r
27 #include <common/concurrency/target.h>\r
28 #include <common/diagnostics/graph.h>\r
29 \r
30 #include <boost/property_tree/ptree_fwd.hpp>\r
31 #include <boost/thread/future.hpp>\r
32 \r
33 #include <map>\r
34 \r
35 namespace caspar { \r
36 \r
37 class executor;\r
38         \r
39 namespace core {\r
40 \r
41 class read_frame;\r
42 class write_frame;\r
43 class basic_frame;\r
44 class ogl_device;\r
45 struct frame_transform;\r
46 struct pixel_format;\r
47 \r
48 class mixer : public target<std::pair<std::map<int, safe_ptr<core::basic_frame>>, std::shared_ptr<void>>>\r
49                         , public core::frame_factory\r
50 {\r
51 public: \r
52         typedef target<std::pair<safe_ptr<read_frame>, std::shared_ptr<void>>> target_t;\r
53 \r
54         explicit mixer(const safe_ptr<diagnostics::graph>& graph, const safe_ptr<target_t>& target, const video_format_desc& format_desc, const safe_ptr<ogl_device>& ogl);\r
55                 \r
56         // target\r
57 \r
58         virtual void send(const std::pair<std::map<int, safe_ptr<basic_frame>>, std::shared_ptr<void>>& frames) override; \r
59                 \r
60         // mixer\r
61 \r
62         safe_ptr<core::write_frame> create_frame(const void* tag, const core::pixel_format_desc& desc);         \r
63         \r
64         core::video_format_desc get_video_format_desc() const; // nothrow\r
65         void set_video_format_desc(const video_format_desc& format_desc);\r
66 \r
67         void set_frame_transform(int index, const core::frame_transform& transform, unsigned int mix_duration = 0, const std::wstring& tween = L"linear");\r
68         void apply_frame_transform(int index, const std::function<frame_transform(frame_transform)>& transform, unsigned int mix_duration = 0, const std::wstring& tween = L"linear");\r
69         void clear_transforms(int index);\r
70         void clear_transforms();\r
71 \r
72         void set_blend_mode(int index, blend_mode::type value);\r
73 \r
74         boost::unique_future<boost::property_tree::wptree> info() const;\r
75         \r
76 private:\r
77         struct implementation;\r
78         safe_ptr<implementation> impl_;\r
79 };\r
80 \r
81 }}