]> git.sesse.net Git - casparcg/blob - core/producer/frame_producer.h
2.0.0.2:
[casparcg] / core / producer / frame_producer.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 "../processor/frame.h"\r
23 #include "../processor/frame_processor_device.h"\r
24 \r
25 #include <boost/noncopyable.hpp>\r
26 \r
27 #include <memory>\r
28 \r
29 namespace caspar { namespace core {\r
30         \r
31 class frame_producer : boost::noncopyable\r
32 {\r
33 public:\r
34         virtual ~frame_producer(){}     \r
35 \r
36         ////////////////////////////////////////////////////////////////////////////////////////////////////\r
37         /// \fn virtual frame_ptr :::render_frame() = 0;\r
38         ///\r
39         /// \brief      Renders a frame.\r
40         ///             \r
41         /// \note       This function is run in through the tbb task_schedular and shall be *non blocking*.\r
42         ///\r
43         /// \return     The frame. \r
44         ////////////////////////////////////////////////////////////////////////////////////////////////////\r
45         virtual frame_ptr render_frame() = 0;\r
46 \r
47         ////////////////////////////////////////////////////////////////////////////////////////////////////\r
48         /// \fn virtual std::shared_ptr<frame_producer> :::get_following_producer() const\r
49         ///\r
50         /// \brief      Gets the producer which will replace the current producer on EOF. \r
51         ///\r
52         /// \return     The following producer, or nullptr if there is no following producer. \r
53         ////////////////////////////////////////////////////////////////////////////////////////////////////\r
54         virtual std::shared_ptr<frame_producer> get_following_producer() const { return nullptr; }\r
55 \r
56         ////////////////////////////////////////////////////////////////////////////////////////////////////\r
57         /// \fn virtual void :::set_leading_producer(const std::shared_ptr<frame_producer>& producer)\r
58         ///\r
59         /// \brief      Sets the producer which was run before the current producer. \r
60         ///\r
61         /// \param      producer        The leading producer.\r
62         ////////////////////////////////////////////////////////////////////////////////////////////////////\r
63         virtual void set_leading_producer(const std::shared_ptr<frame_producer>& /*producer*/) {}\r
64         \r
65         ////////////////////////////////////////////////////////////////////////////////////////////////////\r
66         /// \fn virtual void :::initialize(const frame_processor_device_ptr& frame_processor) = 0;\r
67         ///\r
68         /// \brief      Provides the frame frame_processor used to create frames and initializes the producer. \r
69         ///\r
70         /// \param      frame_processor The frame frame_processor. \r
71         ////////////////////////////////////////////////////////////////////////////////////////////////////\r
72         virtual void initialize(const frame_processor_device_ptr& frame_processor) = 0;\r
73 \r
74         virtual std::wstring print() { return L"Unknown frame_producer.";}\r
75 };\r
76 typedef std::shared_ptr<frame_producer> frame_producer_ptr;\r
77 \r
78 }}