]> git.sesse.net Git - casparcg/blobdiff - core/producer/color/color_producer.cpp
2.1.0: Refactored away "write_frame", only "data_frame" and "draw_frame" are needed.
[casparcg] / core / producer / color / color_producer.cpp
index 6b6c2188fd1717ac99da142bfeec670f7e5c81b8..2879623ef3bb0bc27454a8dd0905f179cf2a11c7 100644 (file)
 #include "color_producer.h"\r
 \r
 #include <core/producer/frame_producer.h>\r
+#include <core/frame/data_frame.h>\r
 #include <core/frame/draw_frame.h>\r
 #include <core/frame/frame_factory.h>\r
 #include <core/frame/pixel_format.h>\r
-#include <core/frame/write_frame.h>\r
 \r
 #include <common/except.h>\r
 \r
@@ -54,12 +54,7 @@ public:
        {\r
                return frame_;\r
        }       \r
-\r
-       virtual spl::shared_ptr<draw_frame> last_frame() const override\r
-       {\r
-               return frame_; \r
-       }       \r
-\r
+       \r
        virtual std::wstring print() const override\r
        {\r
                return L"color[" + color_str_ + L"]";\r
@@ -70,6 +65,11 @@ public:
                return L"color";\r
        }\r
 \r
+       virtual spl::shared_ptr<draw_frame> last_frame() const override\r
+       {\r
+               return frame_;\r
+       }\r
+\r
        boost::property_tree::wptree info() const override\r
        {\r
                boost::property_tree::wptree info;\r
@@ -131,7 +131,7 @@ spl::shared_ptr<frame_producer> create_color_producer(const spl::shared_ptr<fram
 \r
        return core::wrap_producer(spl::make_shared<color_producer>(frame_factory, color2));\r
 }\r
-spl::shared_ptr<write_frame> create_color_frame(void* tag, const spl::shared_ptr<frame_factory>& frame_factory, const std::wstring& color)\r
+spl::shared_ptr<draw_frame> create_color_frame(void* tag, const spl::shared_ptr<frame_factory>& frame_factory, const std::wstring& color)\r
 {\r
        auto color2 = get_hex_color(color);\r
        if(color2.length() != 9 || color2[0] != '#')\r
@@ -148,7 +148,7 @@ spl::shared_ptr<write_frame> create_color_frame(void* tag, const spl::shared_ptr
        if(!(str >> std::hex >> value) || !str.eof())\r
                BOOST_THROW_EXCEPTION(invalid_argument() << arg_name_info("color") << arg_value_info(color2) << msg_info("Invalid color."));\r
                        \r
-       return frame;\r
+       return spl::make_shared<draw_frame>(frame);\r
 }\r
 \r
 }}
\ No newline at end of file