From 9a9d3846c2830c38ad296ff50c7646b766c9ac6f Mon Sep 17 00:00:00 2001 From: Helge Norberg Date: Thu, 6 Oct 2016 17:27:43 +0200 Subject: [PATCH] [osc] Added possibility to completely disable sending OSC to connected AMCP clients, only sending to predefined-clients. The option is disable-send-to-amcp-clients under the osc element in casparcg.config. --- shell/casparcg.config | 1 + shell/server.cpp | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/shell/casparcg.config b/shell/casparcg.config index 5c4b33db3..d1358aab2 100644 --- a/shell/casparcg.config +++ b/shell/casparcg.config @@ -121,6 +121,7 @@ 6250 + false [true|false]
127.0.0.1
diff --git a/shell/server.cpp b/shell/server.cpp index 2c2c5f3d3..cee6709c7 100644 --- a/shell/server.cpp +++ b/shell/server.cpp @@ -146,7 +146,7 @@ struct server::impl : boost::noncopyable std::shared_ptr thumbnail_generator_; std::promise& shutdown_server_now_; - explicit impl(std::promise& shutdown_server_now) + explicit impl(std::promise& shutdown_server_now) : accelerator_(env::properties().get(L"configuration.accelerator", L"auto")) , media_info_repo_(create_in_memory_media_info_repository()) , producer_registry_(spl::make_shared(help_repo_)) @@ -212,7 +212,7 @@ struct server::impl : boost::noncopyable destroy_producers_synchronously(); destroy_consumers_synchronously(); channels_.clear(); - + while (weak_io_service.lock()) boost::this_thread::sleep_for(boost::chrono::milliseconds(100)); @@ -248,7 +248,7 @@ struct server::impl : boost::noncopyable } void setup_channels(const boost::property_tree::wptree& pt) - { + { using boost::property_tree::wptree; for (auto& xml_channel : pt | witerate_children(L"configuration.channels") | welement_context_iteration) { @@ -288,7 +288,7 @@ struct server::impl : boost::noncopyable { CASPAR_LOG_CURRENT_EXCEPTION(); } - } + } channel->monitor_output().attach_parent(monitor_subject_); channel->mixer().set_straight_alpha_output(xml_channel.second.get(L"straight-alpha-output", false)); @@ -309,14 +309,16 @@ struct server::impl : boost::noncopyable } void setup_osc(const boost::property_tree::wptree& pt) - { + { using boost::property_tree::wptree; using namespace boost::asio::ip; monitor_subject_->attach_parent(osc_client_->sink()); - + auto default_port = pt.get(L"configuration.osc.default-port", 6250); + auto disable_send_to_amcp_clients = + pt.get(L"configuration.osc.disable-send-to-amcp-clients", false); auto predefined_clients = pt.get_child_optional(L"configuration.osc.predefined-clients"); @@ -337,7 +339,7 @@ struct server::impl : boost::noncopyable } } - if (primary_amcp_server_) + if (!disable_send_to_amcp_clients && primary_amcp_server_) primary_amcp_server_->add_client_lifecycle_object_factory( [=] (const std::string& ipv4_address) -> std::pair> @@ -363,7 +365,7 @@ struct server::impl : boost::noncopyable polling_filesystem_monitor_factory monitor_factory(io_service_, scan_interval_millis); thumbnail_generator_.reset(new thumbnail_generator( - monitor_factory, + monitor_factory, env::media_folder(), env::thumbnails_folder(), pt.get(L"configuration.thumbnails.width", 256), @@ -376,7 +378,7 @@ struct server::impl : boost::noncopyable producer_registry_, pt.get(L"configuration.thumbnails.mipmap", true))); } - + void setup_controllers(const boost::property_tree::wptree& pt) { amcp_command_repo_ = spl::make_shared( @@ -399,7 +401,7 @@ struct server::impl : boost::noncopyable auto protocol = ptree_get(xml_controller.second, L"protocol"); if(name == L"tcp") - { + { auto port = ptree_get(xml_controller.second, L"port"); auto asyncbootstrapper = spl::make_shared( io_service_, @@ -411,7 +413,7 @@ struct server::impl : boost::noncopyable primary_amcp_server_ = asyncbootstrapper; } else - CASPAR_LOG(warning) << "Invalid controller: " << name; + CASPAR_LOG(warning) << "Invalid controller: " << name; } } -- 2.39.2