]> git.sesse.net Git - casparcg/blobdiff - shell/server.cpp
- Fixed diag to work with new SFML version.
[casparcg] / shell / server.cpp
index eed31a8296a07febb447f108e258cc87e179b1f0..6a96760ed4ef089507dab4404f367156038f40fd 100644 (file)
@@ -29,7 +29,6 @@
 #include <common/utf.h>
 #include <common/memory.h>
 #include <common/polling_filesystem_monitor.h>
-#include <common/diagnostics/graph.h>
 
 #include <core/video_channel.h>
 #include <core/video_format.h>
@@ -40,6 +39,9 @@
 #include <core/producer/text/text_producer.h>
 #include <core/consumer/output.h>
 #include <core/thumbnail_generator.h>
+#include <core/diagnostics/subject_diagnostics.h>
+#include <core/diagnostics/call_context.h>
+#include <core/diagnostics/osd_graph.h>
 
 #include <modules/bluefish/bluefish.h>
 #include <modules/decklink/decklink.h>
@@ -68,7 +70,6 @@
 #include <boost/algorithm/string.hpp>
 #include <boost/thread.hpp>
 #include <boost/lexical_cast.hpp>
-#include <boost/foreach.hpp>
 #include <boost/property_tree/ptree.hpp>
 #include <boost/property_tree/xml_parser.hpp>
 
@@ -83,6 +84,7 @@ struct server::impl : boost::noncopyable
 {
        protocol::asio::io_service_manager                                      io_service_manager_;
        spl::shared_ptr<monitor::subject>                                       monitor_subject_;
+       spl::shared_ptr<monitor::subject>                                       diag_subject_                                   = core::diagnostics::get_or_create_subject();
        accelerator::accelerator                                                        accelerator_;
        std::vector<spl::shared_ptr<IO::AsyncEventServer>>      async_servers_;
        std::shared_ptr<IO::AsyncEventServer>                           primary_amcp_server_;
@@ -96,7 +98,9 @@ struct server::impl : boost::noncopyable
                : accelerator_(env::properties().get(L"configuration.accelerator", L"auto"))
                , osc_client_(io_service_manager_.service())
                , shutdown_server_now_(shutdown_server_now)
-       {       
+       {
+               core::diagnostics::osd::register_sink();
+               diag_subject_->attach_parent(monitor_subject_);
 
                ffmpeg::init();
                CASPAR_LOG(info) << L"Initialized ffmpeg module.";
@@ -152,21 +156,24 @@ struct server::impl : boost::noncopyable
 
                image::uninit();
                ffmpeg::uninit();
-               diagnostics::shutdown();
+               core::diagnostics::osd::shutdown();
        }
                                
        void setup_channels(const boost::property_tree::wptree& pt)
        {   
                using boost::property_tree::wptree;
-               BOOST_FOREACH(auto& xml_channel, pt.get_child(L"configuration.channels"))
+               for (auto& xml_channel : pt.get_child(L"configuration.channels"))
                {               
                        auto format_desc = video_format_desc(xml_channel.second.get(L"video-mode", L"PAL"));            
                        if(format_desc.format == video_format::invalid)
                                CASPAR_THROW_EXCEPTION(caspar_exception() << msg_info("Invalid video-mode."));
                        
                        auto channel = spl::make_shared<video_channel>(static_cast<int>(channels_.size()+1), format_desc, accelerator_.create_image_mixer());
+
+                       core::diagnostics::scoped_call_context save;
+                       core::diagnostics::call_context::for_thread().video_channel = channel->index();
                        
-                       BOOST_FOREACH(auto& xml_consumer, xml_channel.second.get_child(L"consumers"))
+                       for (auto& xml_consumer : xml_channel.second.get_child(L"consumers"))
                        {
                                try
                                {
@@ -213,7 +220,7 @@ struct server::impl : boost::noncopyable
 
                if (predefined_clients)
                {
-                       BOOST_FOREACH(auto& predefined_client, *predefined_clients)
+                       for (auto& predefined_client : *predefined_clients)
                        {
                                const auto address =
                                                predefined_client.second.get<std::wstring>(L"address");
@@ -268,7 +275,7 @@ struct server::impl : boost::noncopyable
        void setup_controllers(const boost::property_tree::wptree& pt)
        {               
                using boost::property_tree::wptree;
-               BOOST_FOREACH(auto& xml_controller, pt.get_child(L"configuration.controllers"))
+               for (auto& xml_controller : pt.get_child(L"configuration.controllers"))
                {
                        try
                        {