X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=shell%2Fserver.cpp;h=b121b809819c43776d951fd00d19f20f75717842;hb=155bb9004a3f60a946af0f0ce12552dc9a223d4b;hp=610487e328fc60749f895e5e64cb4b7f70828b4b;hpb=c5bf7659f087e5c0fa7fcc6e46cf182a822faa21;p=casparcg diff --git a/shell/server.cpp b/shell/server.cpp index 610487e32..b121b8098 100644 --- a/shell/server.cpp +++ b/shell/server.cpp @@ -24,7 +24,10 @@ #include #include -#include +#include +#include +#include +#include #include #include @@ -48,7 +51,6 @@ #include #include -#include #include #include #include @@ -61,7 +63,8 @@ using namespace protocol; struct server::implementation : boost::noncopyable { std::vector> async_servers_; - std::vector> channels_; + std::vector> channels_; + ogl_device ogl_; implementation() { @@ -71,7 +74,7 @@ struct server::implementation : boost::noncopyable init_flash(); init_oal(); init_ogl(); - init_silverlight(); + //init_silverlight(); init_image(); setup_channels(env::properties()); @@ -79,7 +82,9 @@ struct server::implementation : boost::noncopyable } ~implementation() - { + { + uninit_ffmpeg(); + async_servers_.clear(); channels_.clear(); } @@ -89,43 +94,30 @@ struct server::implementation : boost::noncopyable using boost::property_tree::ptree; BOOST_FOREACH(auto& xml_channel, pt.get_child("configuration.channels")) { - auto format_desc = video_format_desc::get(widen(xml_channel.second.get("videomode", "PAL"))); + auto format_desc = video_format_desc::get(widen(xml_channel.second.get("video-mode", "PAL"))); if(format_desc.format == video_format::invalid) - BOOST_THROW_EXCEPTION(caspar_exception() << msg_info("Invalid videomode.")); + BOOST_THROW_EXCEPTION(caspar_exception() << msg_info("Invalid video-mode.")); - channels_.push_back(channel(channels_.size(), format_desc)); + channels_.push_back(video_channel(channels_.size(), format_desc, ogl_)); int index = 0; BOOST_FOREACH(auto& xml_consumer, xml_channel.second.get_child("consumers")) { try { - std::string name = xml_consumer.first; - if(name == "ogl") - { - int device = xml_consumer.second.get("device", 0); - - stretch stretch = stretch::fill; - std::string stretchStr = xml_consumer.second.get("stretch", ""); - if(stretchStr == "none") - stretch = stretch::none; - else if(stretchStr == "uniform") - stretch = stretch::uniform; - else if(stretchStr == "uniformtofill") - stretch = stretch::uniform_to_fill; - - bool windowed = xml_consumer.second.get("windowed", false); - channels_.back()->consumer()->add(index++, ogl_consumer(device, stretch, windowed)); - } + const std::string name = xml_consumer.first; + if(name == "screen") + channels_.back()->output()->add(index++, create_ogl_consumer(xml_consumer.second)); else if(name == "bluefish") - channels_.back()->consumer()->add(index++, bluefish_consumer(xml_consumer.second.get("device", 0), - xml_consumer.second.get("embedded-audio", true))); - else if(name == "decklink") - channels_.back()->consumer()->add(index++, decklink_consumer(xml_consumer.second.get("device", 0), - xml_consumer.second.get("embedded-audio", true), - xml_consumer.second.get("internal-key", false))); + channels_.back()->output()->add(index++, create_bluefish_consumer(xml_consumer.second)); + else if(name == "decklink") + channels_.back()->output()->add(index++, create_decklink_consumer(xml_consumer.second)); + //else if(name == "file") + // channels_.back()->output()->add(index++, create_ffmpeg_consumer(xml_consumer.second)); else if(name == "audio") - channels_.back()->consumer()->add(index++, oal_consumer()); + channels_.back()->output()->add(index++, create_oal_consumer()); + else if(name != "") + CASPAR_LOG(warning) << "Invalid consumer: " << widen(name); } catch(...) { @@ -153,7 +145,7 @@ struct server::implementation : boost::noncopyable async_servers_.push_back(asyncbootstrapper); } else - BOOST_THROW_EXCEPTION(caspar_exception() << arg_name_info(name) << msg_info("Invalid controller.")); + CASPAR_LOG(warning) << "Invalid controller: " << widen(name); } catch(...) { @@ -177,7 +169,7 @@ struct server::implementation : boost::noncopyable server::server() : impl_(new implementation()){} -const std::vector> server::get_channels() const +const std::vector> server::get_channels() const { return impl_->channels_; }