*/\r
#pragma once\r
\r
-#include "../processor/frame.h"\r
+#include "../processor/draw_frame.h"\r
#include "../processor/frame_processor_device.h"\r
\r
+#include <common/utility/safe_ptr.h>\r
+\r
#include <boost/noncopyable.hpp>\r
\r
-#include <memory>\r
+#include <string>\r
+#include <ostream>\r
\r
namespace caspar { namespace core {\r
- \r
+\r
class frame_producer : boost::noncopyable\r
{\r
public:\r
virtual ~frame_producer(){} \r
\r
////////////////////////////////////////////////////////////////////////////////////////////////////\r
- /// \fn virtual frame_ptr :::render_frame() = 0;\r
+ /// \fn virtual draw_frame :::receive() = 0;\r
///\r
/// \brief Renders a frame.\r
/// \r
///\r
/// \return The frame. \r
////////////////////////////////////////////////////////////////////////////////////////////////////\r
- virtual frame_ptr render_frame() = 0;\r
+ virtual safe_ptr<draw_frame> receive() = 0;\r
\r
////////////////////////////////////////////////////////////////////////////////////////////////////\r
/// \fn virtual std::shared_ptr<frame_producer> :::get_following_producer() const\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
+ virtual safe_ptr<frame_producer> get_following_producer() const {return frame_producer::empty();} // nothrow\r
+ \r
////////////////////////////////////////////////////////////////////////////////////////////////////\r
/// \fn virtual void :::set_leading_producer(const std::shared_ptr<frame_producer>& producer)\r
///\r
///\r
/// \param producer The leading producer.\r
////////////////////////////////////////////////////////////////////////////////////////////////////\r
- virtual void set_leading_producer(const std::shared_ptr<frame_producer>& /*producer*/) {}\r
+ virtual void set_leading_producer(const safe_ptr<frame_producer>& /*producer*/) {} // nothrow\r
\r
////////////////////////////////////////////////////////////////////////////////////////////////////\r
- /// \fn virtual void :::initialize(const frame_processor_device_ptr& frame_processor) = 0;\r
+ /// \fn virtual void :::initialize(const safe_ptr<frame_processor_device>& frame_processor) = 0;\r
///\r
/// \brief Provides the frame frame_processor used to create frames and initializes the producer. \r
///\r
/// \param frame_processor The frame frame_processor. \r
////////////////////////////////////////////////////////////////////////////////////////////////////\r
- virtual void initialize(const frame_processor_device_ptr& frame_processor) = 0;\r
+ virtual void initialize(const safe_ptr<frame_processor_device>& frame_processor) = 0;\r
+\r
+ static safe_ptr<frame_producer> empty() // nothrow\r
+ {\r
+ struct empty_frame_producer : public frame_producer\r
+ {\r
+ virtual safe_ptr<draw_frame> receive(){return draw_frame::eof();}\r
+ virtual void initialize(const safe_ptr<frame_processor_device>&){}\r
+ virtual std::wstring print() const { return L"empty";}\r
+ };\r
+ static safe_ptr<frame_producer> producer = make_safe<empty_frame_producer>();\r
+ return producer;\r
+ }\r
+\r
+ virtual std::wstring print() const = 0; // nothrow\r
};\r
-typedef std::shared_ptr<frame_producer> frame_producer_ptr;\r
\r
-}}
\ No newline at end of file
+inline std::wostream& operator<<(std::wostream& out, const frame_producer& producer)\r
+{\r
+ out << producer.print().c_str();\r
+ return out;\r
+}\r
+\r
+}}\r