]> git.sesse.net Git - casparcg/blobdiff - protocol/clk/clk_commands.cpp
[logging] Made the Linux ThreadId be the actual thread id in the log.
[casparcg] / protocol / clk / clk_commands.cpp
index 75209288d9508c4eb787fdaf1aa3aac4d91c59d2..5832f9feab49e1a70e567d2f6cc8b667daab95a9 100644 (file)
@@ -19,7 +19,7 @@
 * Author: Helge Norberg, helge.norberg@svt.se\r
 */\r
 \r
-#include "../stdafx.h"\r
+#include "../StdAfx.h"\r
 \r
 #include <stdexcept>\r
 #include <sstream>\r
 #include <boost/lexical_cast.hpp>\r
 \r
 #include <common/log.h>\r
+#include <common/memory.h>\r
 \r
-#include <modules/flash/producer/cg_proxy.h>\r
+#include <core/video_channel.h>\r
+#include <core/producer/stage.h>\r
+#include <core/producer/cg_proxy.h>\r
 \r
 #include "clk_commands.h"\r
 \r
@@ -37,12 +40,21 @@ namespace caspar { namespace protocol { namespace CLK {
 \r
 class command_context\r
 {\r
-       bool clock_loaded_;\r
-       spl::shared_ptr<core::video_channel> channel_;\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(const spl::shared_ptr<core::video_channel>& channel)\r
-               : clock_loaded_(false)\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<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
@@ -50,21 +62,22 @@ public:
        {\r
                if (!clock_loaded_) \r
                {\r
-                       flash::create_cg_proxy(channel_).add(\r
-                               0, L"hawrysklocka/clock.ft", true, L"", data);\r
+                       core::frame_producer_dependencies dependencies(channel_->frame_factory(), channels_, channel_->video_format_desc(), producer_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
                        clock_loaded_ = true;\r
                }\r
                else\r
                {\r
-                       flash::create_cg_proxy(channel_).update(0, data);\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
+               CASPAR_LOG(info) << L"CLK: Clockdata sent: " << data;\r
        }\r
 \r
        void reset()\r
        {\r
-               channel_->stage().clear(flash::cg_proxy::DEFAULT_LAYER);\r
+               channel_->stage().clear(core::cg_proxy::DEFAULT_LAYER);\r
                clock_loaded_ = false;\r
                CASPAR_LOG(info) << L"CLK: Recieved and executed reset-command";\r
        }\r
@@ -147,10 +160,13 @@ clk_command_handler create_send_xml_handler(
 }\r
 \r
 void add_command_handlers(\r
-       clk_command_processor& processor, \r
-       const spl::shared_ptr<core::video_channel>& channel)\r
+       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<const core::frame_producer_registry>& producer_registry)\r
 {\r
-       auto context = spl::make_shared<command_context>(channel);\r
+       auto context = spl::make_shared<command_context>(channels, channel, cg_registry, producer_registry);\r
 \r
        processor\r
                .add_handler(L"DUR", \r