]> git.sesse.net Git - casparcg/blob - core/frame/frame_factory.h
2.0.0.2:
[casparcg] / core / frame / frame_factory.h
1 #pragma once\r
2 \r
3 #include "gpu_frame.h"\r
4 #include "frame_format.h"\r
5 \r
6 #include <memory>\r
7 #include <array>\r
8 \r
9 namespace caspar { namespace core { \r
10 \r
11 ////////////////////////////////////////////////////////////////////////////////////////////////////\r
12 /// \struct     frame_factory\r
13 ///\r
14 /// \brief      Factory interface used to create frames.\r
15 ////////////////////////////////////////////////////////////////////////////////////////////////////\r
16 struct frame_factory\r
17 {\r
18         ////////////////////////////////////////////////////////////////////////////////////////////////////\r
19         /// \fn virtual ~frame_factory()\r
20         ///\r
21         /// \brief      Destructor. \r
22         ////////////////////////////////////////////////////////////////////////////////////////////////////\r
23         virtual ~frame_factory(){}\r
24 \r
25         ////////////////////////////////////////////////////////////////////////////////////////////////////\r
26         /// \fn virtual void release_frames(void* tag) = 0;\r
27         ///\r
28         /// \brief      Releases the frame pool associated with the provided tag. \r
29         ///\r
30         /// \param  tag         Tag associated with the source frame pool. \r
31         ////////////////////////////////////////////////////////////////////////////////////////////////////\r
32         virtual void release_frames(void* tag) = 0;\r
33 \r
34         ////////////////////////////////////////////////////////////////////////////////////////////////////\r
35         /// \fn virtual gpu_frame_ptr create_frame(size_t width, size_t height, void* tag) = 0;\r
36         ///\r
37         /// \brief      Creates a frame from a pool associated with the provided tag. \r
38         ///             Frames are pooled on destruction and need to be released with *release_frames*. \r
39         ///\r
40         /// \param      width           The width. \r
41         /// \param      height          The height. \r
42         /// \param  tag                 Tag associated with the source frame pool. \r
43         ///\r
44         /// \return     . \r
45         ////////////////////////////////////////////////////////////////////////////////////////////////////\r
46         virtual gpu_frame_ptr create_frame(size_t width, size_t height, void* tag) = 0;\r
47 \r
48         ////////////////////////////////////////////////////////////////////////////////////////////////////\r
49         /// \fn virtual gpu_frame_ptr create_frame(const gpu_frame_desc& desc, void* tag) = 0;\r
50         ///\r
51         /// \brief      Creates a frame from a pool associated with the provided tag. \r
52         ///             Frames are pooled on destruction and need to be released with *release_frames*. \r
53         ///\r
54         /// \param      desc            Information describing the frame. \r
55         /// \param  tag                 Tag associated with the source frame pool. \r
56         ///\r
57         /// \return     . \r
58         ////////////////////////////////////////////////////////////////////////////////////////////////////\r
59         virtual gpu_frame_ptr create_frame(const gpu_frame_desc& desc, void* tag) = 0;\r
60 \r
61         ////////////////////////////////////////////////////////////////////////////////////////////////////\r
62         /// \fn gpu_frame_ptr create_frame(const frame_format_desc format_desc, void* tag)\r
63         ///\r
64         /// \brief      Creates a frame from a pool associated with the provided tag. \r
65         ///             Frames are pooled on destruction and need to be released with *release_frames*. \r
66         ///\r
67         /// \param      format_desc     Information describing the frame format. \r
68         /// \param  tag                 Tag associated with the source frame pool. \r
69         ///\r
70         /// \return     . \r
71         ////////////////////////////////////////////////////////////////////////////////////////////////////\r
72         gpu_frame_ptr create_frame(const frame_format_desc format_desc, void* tag)\r
73         {\r
74                 return create_frame(format_desc.width, format_desc.height, tag);\r
75         }\r
76 };\r
77 \r
78 typedef std::shared_ptr<frame_factory> frame_factory_ptr;\r
79 \r
80 }}