#include "consumer/output.h"\r
#include "mixer/mixer.h"\r
#include "mixer/gpu/ogl_device.h"\r
+#include "mixer/audio/audio_util.h"\r
#include "producer/stage.h"\r
\r
#include <common/diagnostics/graph.h>\r
\r
struct video_channel::implementation : boost::noncopyable\r
{\r
- const int index_;\r
- video_format_desc format_desc_;\r
- const safe_ptr<ogl_device> ogl_;\r
- safe_ptr<diagnostics::graph> graph_;\r
-\r
- safe_ptr<caspar::core::output> output_;\r
- safe_ptr<caspar::core::mixer> mixer_;\r
- safe_ptr<caspar::core::stage> stage_;\r
+ video_channel& self_;\r
+ const int index_;\r
+ video_format_desc format_desc_;\r
+ const safe_ptr<ogl_device> ogl_;\r
+ const safe_ptr<diagnostics::graph> graph_;\r
+\r
+ const safe_ptr<caspar::core::output> output_;\r
+ const safe_ptr<caspar::core::mixer> mixer_;\r
+ const safe_ptr<caspar::core::stage> stage_;\r
+\r
+ monitor::subject monitor_subject_;\r
\r
public:\r
- implementation(int index, const video_format_desc& format_desc, const safe_ptr<ogl_device>& ogl) \r
- : index_(index)\r
+ implementation(video_channel& self, int index, const video_format_desc& format_desc, const safe_ptr<ogl_device>& ogl, const channel_layout& audio_channel_layout) \r
+ : self_(self)\r
+ , index_(index)\r
, format_desc_(format_desc)\r
, ogl_(ogl)\r
, output_(new caspar::core::output(graph_, format_desc, index))\r
- , mixer_(new caspar::core::mixer(graph_, output_, format_desc, ogl))\r
+ , mixer_(new caspar::core::mixer(graph_, output_, format_desc, ogl, audio_channel_layout))\r
, stage_(new caspar::core::stage(graph_, mixer_, format_desc)) \r
+ , monitor_subject_("/channel/" + boost::lexical_cast<std::string>(index))\r
{\r
graph_->set_text(print());\r
diagnostics::register_graph(graph_);\r
for(int n = 0; n < std::max(1, env::properties().get(L"configuration.pipeline-tokens", 2)); ++n)\r
stage_->spawn_token();\r
\r
+ stage_->monitor_output().link_target(&monitor_subject_);\r
+\r
CASPAR_LOG(info) << print() << " Successfully Initialized.";\r
}\r
\r
void set_video_format_desc(const video_format_desc& format_desc)\r
{\r
+ if(format_desc.format == core::video_format::invalid)\r
+ BOOST_THROW_EXCEPTION(invalid_argument() << msg_info("Invalid video-format"));\r
+\r
try\r
{\r
output_->set_video_format_desc(format_desc);\r
mixer_->set_video_format_desc(format_desc);\r
+ stage_->set_video_format_desc(format_desc);\r
ogl_->gc();\r
}\r
catch(...)\r
{\r
output_->set_video_format_desc(format_desc_);\r
mixer_->set_video_format_desc(format_desc_);\r
+ stage_->set_video_format_desc(format_desc_);\r
throw;\r
}\r
format_desc_ = format_desc;\r
}\r
};\r
\r
-video_channel::video_channel(int index, const video_format_desc& format_desc, const safe_ptr<ogl_device>& ogl) : impl_(new implementation(index, format_desc, ogl)){}\r
+video_channel::video_channel(int index, const video_format_desc& format_desc, const safe_ptr<ogl_device>& ogl, const channel_layout& audio_channel_layout) \r
+ : impl_(new implementation(*this, index, format_desc, ogl, audio_channel_layout)){}\r
safe_ptr<stage> video_channel::stage() { return impl_->stage_;} \r
safe_ptr<mixer> video_channel::mixer() { return impl_->mixer_;} \r
safe_ptr<output> video_channel::output() { return impl_->output_;} \r
video_format_desc video_channel::get_video_format_desc() const{return impl_->format_desc_;}\r
void video_channel::set_video_format_desc(const video_format_desc& format_desc){impl_->set_video_format_desc(format_desc);}\r
boost::property_tree::wptree video_channel::info() const{return impl_->info();}\r
-\r
+int video_channel::index() const {return impl_->index_;}\r
+monitor::source& video_channel::monitor_output(){return impl_->monitor_subject_;}\r
}}
\ No newline at end of file