]> git.sesse.net Git - casparcg/blobdiff - protocol/clk/clk_commands.cpp
[general] Added cg_producer_registry as dependency in frame_producer_dependencies
[casparcg] / protocol / clk / clk_commands.cpp
index 130a50d3016b9e8e4177e3a0f7979f0e5ab5dd2a..d853f02b759b67c3bb4b503ca0220ad26d97ef4b 100644 (file)
@@ -40,36 +40,39 @@ namespace caspar { namespace protocol { namespace CLK {
 \r
 class command_context\r
 {\r
-       bool                                                                                            clock_loaded_ = false;\r
-       std::vector<spl::shared_ptr<core::video_channel>>       channels_;\r
-       spl::shared_ptr<core::video_channel>                            channel_;\r
-       spl::shared_ptr<core::cg_producer_registry>                     cg_registry_;\r
+       bool                                                                                                    clock_loaded_ = false;\r
+       std::vector<spl::shared_ptr<core::video_channel>>               channels_;\r
+       spl::shared_ptr<core::video_channel>                                    channel_;\r
+       spl::shared_ptr<core::cg_producer_registry>                             cg_registry_;\r
+       spl::shared_ptr<const core::frame_producer_registry>    producer_registry_;\r
 public:\r
        command_context(\r
                        const std::vector<spl::shared_ptr<core::video_channel>>& channels,\r
                        const spl::shared_ptr<core::video_channel>& channel,\r
-                       const spl::shared_ptr<core::cg_producer_registry>& cg_registry)\r
+                       const spl::shared_ptr<core::cg_producer_registry>& cg_registry,\r
+                       const spl::shared_ptr<const core::frame_producer_registry>& producer_registry)\r
                : channels_(channels)\r
                , channel_(channel)\r
                , cg_registry_(cg_registry)\r
+               , producer_registry_(producer_registry)\r
        {\r
        }\r
 \r
        void send_to_flash(const std::wstring& data)\r
        {\r
-               if (!clock_loaded_) \r
+               if (!clock_loaded_)\r
                {\r
-                       core::frame_producer_dependencies dependencies(channel_->frame_factory(), channels_, channel_->video_format_desc());\r
+                       core::frame_producer_dependencies dependencies(channel_->frame_factory(), channels_, channel_->video_format_desc(), producer_registry_, cg_registry_);\r
                        cg_registry_->get_or_create_proxy(channel_, dependencies, core::cg_proxy::DEFAULT_LAYER, L"hawrysklocka/clock")->add(\r
-                               0, L"hawrysklocka/clock", true, L"", data);\r
+                                       0, L"hawrysklocka/clock", true, L"", data);\r
                        clock_loaded_ = true;\r
                }\r
                else\r
                {\r
                        cg_registry_->get_proxy(channel_, core::cg_proxy::DEFAULT_LAYER)->update(0, data);\r
                }\r
-                               \r
-               CASPAR_LOG(debug) << L"CLK: Clockdata sent: " << data;\r
+\r
+               CASPAR_LOG(info) << L"CLK: Clockdata sent: " << data;\r
        }\r
 \r
        void reset()\r
@@ -104,10 +107,10 @@ std::wstring get_xml(
 {\r
        std::wstringstream stream;\r
 \r
-       stream << L"<templateData>";    \r
+       stream << L"<templateData>";\r
        stream << L"<componentData id=\"command\">";\r
        stream << L"<command id=\"" << command_name << "\"";\r
-       \r
+\r
        std::vector<std::wstring>::const_iterator it = parameters.begin();\r
        std::vector<std::wstring>::const_iterator end = parameters.end();\r
 \r
@@ -144,9 +147,9 @@ std::wstring get_xml(
 }\r
 \r
 clk_command_handler create_send_xml_handler(\r
-       const std::wstring& command_name, \r
-       bool expect_clock, \r
-       bool expect_time, \r
+       const std::wstring& command_name,\r
+       bool expect_clock,\r
+       bool expect_time,\r
        const spl::shared_ptr<command_context>& context)\r
 {\r
        return [=] (const std::vector<std::wstring>& params)\r
@@ -160,30 +163,31 @@ void add_command_handlers(
        clk_command_processor& processor,\r
        const std::vector<spl::shared_ptr<core::video_channel>>& channels,\r
        const spl::shared_ptr<core::video_channel>& channel,\r
-       const spl::shared_ptr<core::cg_producer_registry>& cg_registry)\r
+       const spl::shared_ptr<core::cg_producer_registry>& cg_registry,\r
+       const spl::shared_ptr<const core::frame_producer_registry>& producer_registry)\r
 {\r
-       auto context = spl::make_shared<command_context>(channels, channel, cg_registry);\r
+       auto context = spl::make_shared<command_context>(channels, channel, cg_registry, producer_registry);\r
 \r
        processor\r
-               .add_handler(L"DUR", \r
+               .add_handler(L"DUR",\r
                        create_send_xml_handler(L"DUR", true, true, context))\r
-               .add_handler(L"NEWDUR", \r
+               .add_handler(L"NEWDUR",\r
                        create_send_xml_handler(L"NEWDUR", true, true, context))\r
-               .add_handler(L"UNTIL", \r
+               .add_handler(L"UNTIL",\r
                        create_send_xml_handler(L"UNTIL", true, true, context))\r
-               .add_handler(L"NEXTEVENT", \r
+               .add_handler(L"NEXTEVENT",\r
                        create_send_xml_handler(L"NEXTEVENT", true, false, context))\r
-               .add_handler(L"STOP", \r
+               .add_handler(L"STOP",\r
                        create_send_xml_handler(L"STOP", true, false, context))\r
-               .add_handler(L"ADD", \r
+               .add_handler(L"ADD",\r
                        create_send_xml_handler(L"ADD", true, true, context))\r
-               .add_handler(L"SUB", \r
+               .add_handler(L"SUB",\r
                        create_send_xml_handler(L"SUB", true, true, context))\r
-               .add_handler(L"TIMELINE_LOAD", \r
+               .add_handler(L"TIMELINE_LOAD",\r
                        create_send_xml_handler(L"TIMELINE_LOAD", false, false, context))\r
-               .add_handler(L"TIMELINE_PLAY", \r
+               .add_handler(L"TIMELINE_PLAY",\r
                        create_send_xml_handler(L"TIMELINE_PLAY", false, false, context))\r
-               .add_handler(L"TIMELINE_STOP", \r
+               .add_handler(L"TIMELINE_STOP",\r
                        create_send_xml_handler(L"TIMELINE_STOP", false, false, context))\r
                .add_handler(L"RESET", [=] (const std::vector<std::wstring>& params)\r
                {\r