]> git.sesse.net Git - casparcg/blobdiff - core/producer/frame_producer.h
2.0. imag
[casparcg] / core / producer / frame_producer.h
index 9189c69fcb0c978c849870cfbec42f01f3da489c..d2b1becdf9f83ba04bb4d35aa1941feabe03a203 100644 (file)
 */\r
 #pragma once\r
 \r
-#include "../frame/frame_fwd.h"\r
-#include "../frame/gpu_frame.h"\r
-#include "../frame/frame_factory.h"\r
+#include <common/memory/safe_ptr.h>\r
 \r
 #include <boost/noncopyable.hpp>\r
 \r
-#include <memory>\r
+#include <functional>\r
+#include <string>\r
+#include <vector>\r
+#include <stdint.h>\r
+#include <numeric>\r
 \r
 namespace caspar { namespace core {\r
-       \r
-class frame_producer : boost::noncopyable\r
+\r
+class basic_frame;\r
+struct frame_factory;\r
+\r
+struct frame_producer : boost::noncopyable\r
 {\r
 public:\r
+       enum hints\r
+       {\r
+               NO_HINT = 0,\r
+               ALPHA_HINT = 1\r
+       };\r
+\r
        virtual ~frame_producer(){}     \r
 \r
-       ////////////////////////////////////////////////////////////////////////////////////////////////////\r
-       /// \fn virtual gpu_frame_ptr :::render_frame() = 0;\r
-       ///\r
-       /// \brief      Renders a frame.\r
-       ///             \r
-       /// \note       This function is run in through the tbb task_schedular and shall be *non blocking*.\r
-       ///\r
-       /// \return     The frame. \r
-       ////////////////////////////////////////////////////////////////////////////////////////////////////\r
-       virtual gpu_frame_ptr render_frame() = 0;\r
-\r
-       ////////////////////////////////////////////////////////////////////////////////////////////////////\r
-       /// \fn virtual std::shared_ptr<frame_producer> :::get_following_producer() const\r
-       ///\r
-       /// \brief      Gets the producer which will replace the current producer on EOF. \r
-       ///\r
-       /// \return     The following producer, or nullptr if there is no following producer. \r
-       ////////////////////////////////////////////////////////////////////////////////////////////////////\r
-       virtual std::shared_ptr<frame_producer> get_following_producer() const { return nullptr; }\r
-\r
-       ////////////////////////////////////////////////////////////////////////////////////////////////////\r
-       /// \fn virtual void :::set_leading_producer(const std::shared_ptr<frame_producer>& producer)\r
-       ///\r
-       /// \brief      Sets the producer which was run before the current producer. \r
-       ///\r
-       /// \param      producer        The leading producer.\r
-       ////////////////////////////////////////////////////////////////////////////////////////////////////\r
-       virtual void set_leading_producer(const std::shared_ptr<frame_producer>& /*producer*/) {}\r
-\r
-       ////////////////////////////////////////////////////////////////////////////////////////////////////\r
-       /// \fn virtual const frame_format_desc& :::get_frame_format_desc() const = 0;\r
-       ///\r
-       /// \brief      Gets the frame format description. \r
-       ///\r
-       /// \return     The frame format description. \r
-       ////////////////////////////////////////////////////////////////////////////////////////////////////\r
-       virtual const frame_format_desc& get_frame_format_desc() const = 0;\r
-\r
-       ////////////////////////////////////////////////////////////////////////////////////////////////////\r
-       /// \fn virtual void :::initialize(const frame_factory_ptr& factory) = 0;\r
-       ///\r
-       /// \brief      Provides the frame factory used to create frames and initializes the producer. \r
-       ///\r
-       /// \param      factory The frame factory. \r
-       ////////////////////////////////////////////////////////////////////////////////////////////////////\r
-       virtual void initialize(const frame_factory_ptr& factory) = 0;\r
+       virtual std::wstring print() const = 0; // nothrow\r
+\r
+       virtual void param(const std::wstring&){}\r
+\r
+       virtual safe_ptr<frame_producer> get_following_producer() const {return frame_producer::empty();}  // nothrow\r
+       virtual void set_leading_producer(const safe_ptr<frame_producer>&) {}  // nothrow\r
+               \r
+       virtual int64_t nb_frames() const {return std::numeric_limits<int>::max();}\r
+       \r
+       virtual safe_ptr<basic_frame> receive(int hints) = 0;\r
+       virtual safe_ptr<core::basic_frame> last_frame() const = 0;\r
+\r
+       static const safe_ptr<frame_producer>& empty(); // nothrow\r
 };\r
-typedef std::shared_ptr<frame_producer> frame_producer_ptr;\r
 \r
-}}
\ No newline at end of file
+safe_ptr<basic_frame> receive_and_follow(safe_ptr<frame_producer>& producer, int hints);\r
+\r
+typedef std::function<safe_ptr<core::frame_producer>(const safe_ptr<frame_factory>&, const std::vector<std::wstring>&)> producer_factory_t;\r
+void register_producer_factory(const producer_factory_t& factory); // Not thread-safe.\r
+safe_ptr<core::frame_producer> create_producer(const safe_ptr<frame_factory>&, const std::vector<std::wstring>& params);\r
+\r
+\r
+}}\r