]> git.sesse.net Git - casparcg/blobdiff - shell/server.cpp
Merged CLK changes from trunk, and separated delimiter message splitting and codepage...
[casparcg] / shell / server.cpp
index 8d3cd24c7d818d498e428d3179247ebb8f619f0f..4d2c7cdc0225e4287477943b2ab24785f313b29f 100644 (file)
 #include <common/env.h>
 #include <common/except.h>
 #include <common/utf.h>
+#include <common/memory.h>
 
 #include <core/video_channel.h>
 #include <core/video_format.h>
 #include <core/producer/stage.h>
+#include <core/producer/diag/diag_producer.h>
+#include <core/producer/frame_producer.h>
 #include <core/consumer/output.h>
 
 #include <modules/bluefish/bluefish.h>
@@ -51,6 +54,7 @@
 #include <protocol/cii/CIIProtocolStrategy.h>
 #include <protocol/CLK/CLKProtocolStrategy.h>
 #include <protocol/util/AsyncEventServer.h>
+#include <protocol/util/strategy_adapters.h>
 
 #include <boost/algorithm/string.hpp>
 #include <boost/lexical_cast.hpp>
@@ -95,6 +99,8 @@ struct server::impl : boost::noncopyable
                flash::init();            
                CASPAR_LOG(info) << L"Initialized flash module.";
 
+               core::register_producer_factory(core::create_diag_producer);
+
                setup_channels(env::properties());
                CASPAR_LOG(info) << L"Initialized channels.";
 
@@ -183,17 +189,22 @@ struct server::impl : boost::noncopyable
                }
        }
 
-       spl::shared_ptr<IO::IProtocolStrategy> create_protocol(const std::wstring& name) const
+       IO::protocol_strategy_factory<char>::ptr create_protocol(const std::wstring& name) const
        {
+               using namespace IO;
+
                if(boost::iequals(name, L"AMCP"))
-                       return spl::make_shared<amcp::AMCPProtocolStrategy>(channels_);
+                       return wrap_legacy_protocol("\r\n", spl::make_shared<amcp::AMCPProtocolStrategy>(channels_));
                else if(boost::iequals(name, L"CII"))
-                       return spl::make_shared<cii::CIIProtocolStrategy>(channels_);
+                       return wrap_legacy_protocol("\r\n", spl::make_shared<cii::CIIProtocolStrategy>(channels_));
                else if(boost::iequals(name, L"CLOCK"))
-                       return spl::make_shared<CLK::CLKProtocolStrategy>(channels_);
+                       return spl::make_shared<to_unicode_adapter_factory>(
+                                       "ISO-8859-1",
+                                       spl::make_shared<CLK::clk_protocol_strategy_factory>(channels_));
                
                CASPAR_THROW_EXCEPTION(caspar_exception() << arg_name_info(L"name") << arg_value_info(name) << msg_info(L"Invalid protocol"));
        }
+
 };
 
 server::server() : impl_(new impl()){}