]> git.sesse.net Git - casparcg/blob - core/producer/layer.h
set svn:eol-style native on .h and .cpp files
[casparcg] / core / producer / layer.h
1 /*
2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
3 *
4 * This file is part of CasparCG (www.casparcg.com).
5 *
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.
10 *
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.
15 *
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/>.
18 *
19 * Author: Robert Nagy, ronag89@gmail.com
20 */
21
22 #pragma once
23
24 #include "frame_producer.h"
25
26 #include "../monitor/monitor.h"
27
28 #include <common/forward.h>
29 #include <common/future_fwd.h>
30 #include <common/memory.h>
31
32 #include <boost/property_tree/ptree_fwd.hpp>
33
34 #include <string>
35
36 FORWARD1(boost, template<typename T> class optional);
37
38 namespace caspar { namespace core {
39         
40 class layer sealed : public monitor::observable
41 {
42         layer(const layer&);
43         layer& operator=(const layer&);
44 public:
45         // Static Members
46
47         // Constructors
48
49         explicit layer(int index = -1); 
50         layer(layer&& other); 
51
52         // Methods
53
54         layer& operator=(layer&& other); 
55
56         void swap(layer& other);  
57                 
58         void load(spl::shared_ptr<class frame_producer> producer, bool preview, const boost::optional<int32_t>& auto_play_delta = nullptr); 
59         void play(); 
60         void pause(); 
61         void stop(); 
62         
63         class draw_frame receive(const struct video_format_desc& format_desc); 
64         
65         // monitor::observable
66
67         void subscribe(const monitor::observable::observer_ptr& o) override;
68         void unsubscribe(const monitor::observable::observer_ptr& o) override;
69
70         // Properties
71                 
72         spl::shared_ptr<class frame_producer>   foreground() const; 
73         spl::shared_ptr<class frame_producer>   background() const; 
74
75         boost::property_tree::wptree                    info() const;
76
77 private:
78         struct impl;
79         spl::shared_ptr<impl> impl_;
80 };
81
82 }}