]> git.sesse.net Git - casparcg/blobdiff - protocol/amcp/amcp_command_repository.cpp
Merge pull request #519 from krzyc/patch-1
[casparcg] / protocol / amcp / amcp_command_repository.cpp
index d993c738ea2b94fe7d823b60bb61d841630cd610..2457ec72d5b0f847897fe5b204ef65b53f02e27c 100644 (file)
@@ -69,6 +69,9 @@ struct amcp_command_repository::impl
        spl::shared_ptr<core::system_info_provider_repository>          system_info_provider_repo;
        spl::shared_ptr<core::cg_producer_registry>                                     cg_registry;
        spl::shared_ptr<core::help_repository>                                          help_repo;
+       spl::shared_ptr<const core::frame_producer_registry>            producer_registry;
+       spl::shared_ptr<const core::frame_consumer_registry>            consumer_registry;
+       std::shared_ptr<accelerator::ogl::device>                                       ogl_device;
        std::promise<bool>&                                                                                     shutdown_server_now;
 
        std::map<std::wstring, std::pair<amcp_command_func, int>>       commands;
@@ -81,12 +84,18 @@ struct amcp_command_repository::impl
                        const spl::shared_ptr<core::system_info_provider_repository>& system_info_provider_repo,
                        const spl::shared_ptr<core::cg_producer_registry>& cg_registry,
                        const spl::shared_ptr<core::help_repository>& help_repo,
+                       const spl::shared_ptr<const core::frame_producer_registry>& producer_registry,
+                       const spl::shared_ptr<const core::frame_consumer_registry>& consumer_registry,
+                       const std::shared_ptr<accelerator::ogl::device>& ogl_device,
                        std::promise<bool>& shutdown_server_now)
                : thumb_gen(thumb_gen)
                , media_info_repo(media_info_repo)
                , system_info_provider_repo(system_info_provider_repo)
                , cg_registry(cg_registry)
                , help_repo(help_repo)
+               , producer_registry(producer_registry)
+               , consumer_registry(consumer_registry)
+               , ogl_device(ogl_device)
                , shutdown_server_now(shutdown_server_now)
        {
                int index = 0;
@@ -106,17 +115,30 @@ amcp_command_repository::amcp_command_repository(
                const spl::shared_ptr<core::system_info_provider_repository>& system_info_provider_repo,
                const spl::shared_ptr<core::cg_producer_registry>& cg_registry,
                const spl::shared_ptr<core::help_repository>& help_repo,
+               const spl::shared_ptr<const core::frame_producer_registry>& producer_registry,
+               const spl::shared_ptr<const core::frame_consumer_registry>& consumer_registry,
+               const std::shared_ptr<accelerator::ogl::device>& ogl_device,
                std::promise<bool>& shutdown_server_now)
-       : impl_(new impl(channels, thumb_gen, media_info_repo, system_info_provider_repo, cg_registry, help_repo, shutdown_server_now))
+               : impl_(new impl(
+                               channels,
+                               thumb_gen,
+                               media_info_repo,
+                               system_info_provider_repo,
+                               cg_registry,
+                               help_repo,
+                               producer_registry,
+                               consumer_registry,
+                               ogl_device,
+                               shutdown_server_now))
 {
 }
 
-AMCPCommand::ptr_type amcp_command_repository::create_command(const std::wstring& s, IO::ClientInfoPtr client, std::list<std::wstring>& tokens)
+AMCPCommand::ptr_type amcp_command_repository::create_command(const std::wstring& s, IO::ClientInfoPtr client, std::list<std::wstring>& tokens) const
 {
        auto& self = *impl_;
 
        command_context ctx(
-                       client,
+                       std::move(client),
                        channel_context(),
                        -1,
                        -1,
@@ -126,6 +148,9 @@ AMCPCommand::ptr_type amcp_command_repository::create_command(const std::wstring
                        self.cg_registry,
                        self.system_info_provider_repo,
                        self.thumb_gen,
+                       self.producer_registry,
+                       self.consumer_registry,
+                       self.ogl_device,
                        self.shutdown_server_now);
 
        auto command = find_command(self.commands, s, ctx, tokens);
@@ -146,7 +171,7 @@ AMCPCommand::ptr_type amcp_command_repository::create_channel_command(
                IO::ClientInfoPtr client,
                unsigned int channel_index,
                int layer_index,
-               std::list<std::wstring>& tokens)
+               std::list<std::wstring>& tokens) const
 {
        auto& self = *impl_;
 
@@ -163,6 +188,9 @@ AMCPCommand::ptr_type amcp_command_repository::create_channel_command(
                        self.cg_registry,
                        self.system_info_provider_repo,
                        self.thumb_gen,
+                       self.producer_registry,
+                       self.consumer_registry,
+                       self.ogl_device,
                        self.shutdown_server_now);
 
        auto command = find_command(self.channel_commands, s, ctx, tokens);
@@ -197,4 +225,9 @@ void amcp_command_repository::register_channel_command(
        self.channel_commands.insert(std::make_pair(std::move(name), std::make_pair(std::move(command), min_num_params)));
 }
 
+spl::shared_ptr<core::help_repository> amcp_command_repository::help_repo() const
+{
+       return impl_->help_repo;
+}
+
 }}}