/*\r
-* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>\r
+* Copyright 2013 Sveriges Television AB http://casparcg.com/\r
*\r
* This file is part of CasparCG (www.casparcg.com).\r
*\r
\r
#include <core/mixer/gpu/ogl_device.h>\r
#include <core/mixer/audio/audio_util.h>\r
+#include <core/mixer/mixer.h>\r
#include <core/video_channel.h>\r
#include <core/producer/stage.h>\r
#include <core/consumer/output.h>\r
+#include <core/consumer/synchronizing/synchronizing_consumer.h>\r
#include <core/thumbnail_generator.h>\r
\r
#include <modules/bluefish/bluefish.h>\r
#include <modules/decklink/decklink.h>\r
#include <modules/ffmpeg/ffmpeg.h>\r
#include <modules/flash/flash.h>\r
-#include <modules/oal/oal.h>\r
+#include <modules/portaudio/portaudio.h>\r
#include <modules/ogl/ogl.h>\r
+#include <modules/newtek/newtek.h>\r
#include <modules/silverlight/silverlight.h>\r
#include <modules/image/image.h>\r
#include <modules/image/consumer/image_consumer.h>\r
\r
-#include <modules/oal/consumer/oal_consumer.h>\r
+#include <modules/portaudio/consumer/portaudio_consumer.h>\r
#include <modules/bluefish/consumer/bluefish_consumer.h>\r
+#include <modules/newtek/consumer/newtek_ivga_consumer.h>\r
#include <modules/decklink/consumer/decklink_consumer.h>\r
+#include <modules/decklink/consumer/blocking_decklink_consumer.h>\r
#include <modules/ogl/consumer/ogl_consumer.h>\r
#include <modules/ffmpeg/consumer/ffmpeg_consumer.h>\r
\r
struct server::implementation : boost::noncopyable\r
{\r
protocol::asio::io_service_manager io_service_manager_;\r
- core::monitor::subject monitor_subject_;\r
- core::monitor::multi_target multi_target_;\r
+ safe_ptr<core::monitor::subject> monitor_subject_;\r
boost::promise<bool>& shutdown_server_now_;\r
safe_ptr<ogl_device> ogl_;\r
std::vector<safe_ptr<IO::AsyncEventServer>> async_servers_; \r
std::shared_ptr<IO::AsyncEventServer> primary_amcp_server_;\r
- std::vector<osc::client> osc_clients_;\r
+ osc::client osc_client_;\r
+ std::vector<std::shared_ptr<void>> predefined_osc_subscriptions_;\r
std::vector<safe_ptr<video_channel>> channels_;\r
std::shared_ptr<thumbnail_generator> thumbnail_generator_;\r
\r
implementation(boost::promise<bool>& shutdown_server_now)\r
: shutdown_server_now_(shutdown_server_now)\r
, ogl_(ogl_device::create())\r
+ , osc_client_(io_service_manager_.service())\r
{\r
- monitor_subject_.link_target(&multi_target_);\r
setup_audio(env::properties());\r
\r
ffmpeg::init();\r
\r
decklink::init(); \r
CASPAR_LOG(info) << L"Initialized decklink module.";\r
- \r
- oal::init(); \r
- CASPAR_LOG(info) << L"Initialized oal module.";\r
+\r
+ portaudio::init();\r
+ CASPAR_LOG(info) << L"Initialized portaudio module.";\r
\r
+ newtek::init();\r
+ CASPAR_LOG(info) << L"Initialized newtek module.";\r
+\r
ogl::init(); \r
CASPAR_LOG(info) << L"Initialized ogl module.";\r
\r
- image::init(); \r
- CASPAR_LOG(info) << L"Initialized image module.";\r
-\r
flash::init(); \r
CASPAR_LOG(info) << L"Initialized flash module.";\r
\r
+ image::init(); \r
+ CASPAR_LOG(info) << L"Initialized image module.";\r
+\r
setup_channels(env::properties());\r
CASPAR_LOG(info) << L"Initialized channels.";\r
\r
\r
~implementation()\r
{ \r
- ffmpeg::uninit();\r
-\r
+ thumbnail_generator_.reset();\r
+ primary_amcp_server_.reset();\r
async_servers_.clear();\r
+ destroy_producers_synchronously();\r
channels_.clear();\r
+\r
+ ffmpeg::uninit();\r
}\r
\r
void setup_audio(const boost::property_tree::wptree& pt)\r
{\r
register_default_channel_layouts(default_channel_layout_repository());\r
register_default_mix_configs(default_mix_config_repository());\r
- parse_channel_layouts(\r
- default_channel_layout_repository(),\r
- pt.get_child(L"configuration.audio.channel-layouts"));\r
- parse_mix_configs(\r
- default_mix_config_repository(),\r
- pt.get_child(L"configuration.audio.mix-configs"));\r
+\r
+ auto channel_layouts =\r
+ pt.get_child_optional(L"configuration.audio.channel-layouts");\r
+ auto mix_configs =\r
+ pt.get_child_optional(L"configuration.audio.mix-configs");\r
+\r
+ if (channel_layouts)\r
+ parse_channel_layouts(\r
+ default_channel_layout_repository(), *channel_layouts);\r
+\r
+ if (mix_configs)\r
+ parse_mix_configs(\r
+ default_mix_config_repository(), *mix_configs);\r
}\r
\r
void setup_channels(const boost::property_tree::wptree& pt)\r
\r
channels_.push_back(make_safe<video_channel>(channels_.size()+1, format_desc, ogl_, audio_channel_layout));\r
\r
- channels_.back()->monitor_output().link_target(&monitor_subject_);\r
+ channels_.back()->monitor_output().attach_parent(monitor_subject_);\r
+ channels_.back()->mixer()->set_straight_alpha_output(\r
+ xml_channel.second.get(L"straight-alpha-output", false));\r
\r
create_consumers(\r
xml_channel.second.get_child(L"consumers"),\r
try\r
{\r
auto name = xml_consumer.first;\r
+\r
if (name == L"screen")\r
on_consumer(ogl::create_consumer(xml_consumer.second));\r
else if (name == L"bluefish") \r
on_consumer(bluefish::create_consumer(xml_consumer.second)); \r
else if (name == L"decklink") \r
on_consumer(decklink::create_consumer(xml_consumer.second)); \r
- else if (name == L"file") \r
+ else if (name == L"newtek-ivga") \r
+ on_consumer(newtek::create_ivga_consumer(xml_consumer.second)); \r
+ else if (name == L"blocking-decklink")\r
+ on_consumer(decklink::create_blocking_consumer(xml_consumer.second)); \r
+ else if (name == L"file" || name == L"stream") \r
on_consumer(ffmpeg::create_consumer(xml_consumer.second)); \r
else if (name == L"system-audio")\r
- on_consumer(oal::create_consumer());\r
+ on_consumer(portaudio::create_consumer());\r
+ else if (name == L"synchronizing")\r
+ on_consumer(make_safe<core::synchronizing_consumer>(\r
+ create_consumers<core::frame_consumer>(\r
+ xml_consumer.second)));\r
else if (name != L"<xmlcomment>")\r
CASPAR_LOG(warning) << "Invalid consumer: " << widen(name); \r
}\r
{ \r
using boost::property_tree::wptree;\r
using namespace boost::asio::ip;\r
+\r
+ monitor_subject_->attach_parent(osc_client_.sink());\r
\r
auto default_port =\r
pt.get<unsigned short>(L"configuration.osc.default-port", 6250);\r
predefined_client.second.get<std::wstring>(L"address");\r
const auto port =\r
predefined_client.second.get<unsigned short>(L"port");\r
- osc_clients_.push_back(osc::client(\r
- io_service_manager_.service(),\r
- udp::endpoint(\r
+ predefined_osc_subscriptions_.push_back(\r
+ osc_client_.get_subscription_token(udp::endpoint(\r
address_v4::from_string(narrow(address)),\r
- port),\r
- multi_target_));\r
+ port)));\r
}\r
}\r
\r
{\r
using namespace boost::asio::ip;\r
\r
- return std::make_shared<osc::client>(\r
- io_service_manager_.service(),\r
+ return osc_client_.get_subscription_token(\r
udp::endpoint(\r
address_v4::from_string(ipv4_address),\r
- default_port),\r
- multi_target_);\r
+ default_port));\r
});\r
}\r
\r
\r
auto scan_interval_millis = pt.get(L"configuration.thumbnails.scan-interval-millis", 5000);\r
\r
- polling_filesystem_monitor_factory monitor_factory(scan_interval_millis);\r
+ polling_filesystem_monitor_factory monitor_factory(\r
+ io_service_manager_.service(),\r
+ scan_interval_millis);\r
thumbnail_generator_.reset(new thumbnail_generator(\r
monitor_factory, \r
env::media_folder(),\r
return impl_->thumbnail_generator_;\r
}\r
\r
-core::monitor::source& server::monitor_output()\r
+core::monitor::subject& server::monitor_output()\r
{\r
- return impl_->monitor_subject_;\r
+ return *impl_->monitor_subject_;\r
}\r
\r
}
\ No newline at end of file