]> git.sesse.net Git - casparcg/blob - core/frame/draw_frame.h
Fix CPU hogging on EOF in ffmpeg producer.
[casparcg] / core / frame / draw_frame.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_visitor.h"
25 #include "../fwd.h"
26
27 #include <common/memory.h>
28
29 #include <vector>
30
31 namespace caspar { namespace core {
32         
33 class draw_frame final
34 {
35 public:         
36         // Static Members
37
38         static draw_frame interlace(draw_frame frame1, draw_frame frame2, core::field_mode mode);
39         static draw_frame over(draw_frame frame1, draw_frame frame2);
40         static draw_frame mask(draw_frame fill, draw_frame key);
41         static draw_frame still(draw_frame frame);
42         static draw_frame push(draw_frame frame);
43                 
44         static const draw_frame& empty();
45         static const draw_frame& late();
46
47         // Constructors
48
49         draw_frame();
50         draw_frame(const draw_frame& other);
51         draw_frame(draw_frame&& other); 
52         explicit draw_frame(const_frame&& frame);
53         explicit draw_frame(mutable_frame&& frame);
54         explicit draw_frame(std::vector<draw_frame> frames);
55
56         ~draw_frame();
57         
58         // Methods
59
60         draw_frame& operator=(draw_frame other);
61
62         void swap(draw_frame& other);   
63         
64         void accept(frame_visitor& visitor) const;
65         
66         int64_t get_and_record_age_millis();
67         
68         bool operator==(const draw_frame& other) const;
69         bool operator!=(const draw_frame& other) const;
70
71         // Properties
72
73         const core::frame_transform&    transform() const;
74         core::frame_transform&                  transform();
75
76 private:
77         struct impl;
78         spl::unique_ptr<impl> impl_;
79 };
80         
81
82 }}