]> git.sesse.net Git - casparcg/blobdiff - core/producer/color/color_producer.cpp
2.0.0.2: Mayor solution reconfiguration.
[casparcg] / core / producer / color / color_producer.cpp
index 3e131713d50a48797226aee150f63fee59ac3e4d..002ef09d6df3200b196114075b6fd45efa2d3ca4 100644 (file)
@@ -22,7 +22,7 @@
 \r
 #include "color_producer.h"\r
 \r
-#include "../../mixer/frame/draw_frame.h"\r
+#include <mixer/frame/draw_frame.h>\r
 \r
 #include <sstream>\r
 \r
@@ -32,10 +32,13 @@ class color_producer : public frame_producer
 {\r
        safe_ptr<draw_frame> frame_;\r
        std::wstring color_str_;\r
+       printer parent_printer_;\r
 \r
 public:\r
 \r
-       explicit color_producer(const std::wstring& color) : color_str_(color), frame_(draw_frame::empty())\r
+       explicit color_producer(const std::wstring& color) \r
+               : color_str_(color)\r
+               , frame_(draw_frame::empty())\r
        {\r
                if(color.length() != 9 || color[0] != '#')\r
                        BOOST_THROW_EXCEPTION(invalid_argument() << arg_name_info("color") << arg_value_info(narrow(color)) << msg_info("Invalid color code"));\r
@@ -49,10 +52,12 @@ public:
                str >> std::hex >> value;       \r
                frame_ = std::move(frame);\r
        }\r
+\r
+       virtual void set_parent_printer(const printer& parent_printer){parent_printer_ = parent_printer;}\r
        \r
        virtual safe_ptr<draw_frame> receive() { return frame_; }\r
        \r
-       virtual std::wstring print() const { return + L"color[" + color_str_ + L"]"; }\r
+       virtual std::wstring print() const { return (parent_printer_ ? parent_printer_() + L"/" : L"") + L"color[" + color_str_ + L"]"; }\r
 };\r
 \r
 safe_ptr<frame_producer> create_color_producer(const std::vector<std::wstring>& params)\r
@@ -62,4 +67,9 @@ safe_ptr<frame_producer> create_color_producer(const std::vector<std::wstring>&
        return make_safe<color_producer>(params[0]);\r
 }\r
 \r
+volatile struct reg\r
+{\r
+       reg(){register_producer_factory(create_color_producer);}\r
+} my_reg;\r
+\r
 }}
\ No newline at end of file