5 #include "frame_consumer.h"
6 #include "../frame/frame.h"
7 #include <boost/lexical_cast.hpp>
9 namespace caspar { namespace core {
13 monitor::subject monitor_subject_;
14 std::shared_ptr<frame_consumer> consumer_;
18 impl(int index, int channel_index, spl::shared_ptr<frame_consumer> consumer)
19 : monitor_subject_("/port" + boost::lexical_cast<std::string>(index))
20 , consumer_(std::move(consumer))
22 , channel_index_(channel_index)
24 consumer_->monitor_output().link_target(&monitor_subject_);
27 void video_format_desc(const struct video_format_desc& format_desc)
29 consumer_->initialize(format_desc, channel_index_);
32 boost::unique_future<bool> send(const_frame frame)
34 monitor_subject_ << monitor::message("/type") % consumer_->name();
35 return consumer_->send(std::move(frame));
37 std::wstring print() const
39 return consumer_->print();
47 int buffer_depth() const
49 return consumer_->buffer_depth();
52 bool has_synchronization_clock() const
54 return consumer_->has_synchronization_clock();
57 boost::property_tree::wptree info() const
59 return consumer_->info();
63 port::port(int index, int channel_index, spl::shared_ptr<frame_consumer> consumer) : impl_(new impl(index, channel_index, std::move(consumer))){}
64 port::port(port&& other) : impl_(std::move(other.impl_)){}
66 port& port::operator=(port&& other){impl_ = std::move(other.impl_); return *this;}
67 boost::unique_future<bool> port::send(const_frame frame){return impl_->send(std::move(frame));}
68 monitor::source& port::monitor_output() {return impl_->monitor_subject_;}
69 void port::video_format_desc(const struct video_format_desc& format_desc){impl_->video_format_desc(format_desc);}
70 int port::buffer_depth() const{return impl_->buffer_depth();}
71 std::wstring port::print() const{ return impl_->print();}
72 bool port::has_synchronization_clock() const{return impl_->has_synchronization_clock();}
73 boost::property_tree::wptree port::info() const{return impl_->info();}