5 #include "frame_consumer.h"
6 #include "../frame/frame.h"
7 #include <boost/lexical_cast.hpp>
11 namespace caspar { namespace core {
15 spl::shared_ptr<monitor::subject> monitor_subject_;
16 std::shared_ptr<frame_consumer> consumer_;
20 impl(int index, int channel_index, spl::shared_ptr<frame_consumer> consumer)
21 : monitor_subject_(spl::make_shared<monitor::subject>(
22 "/port" + boost::lexical_cast<std::string>(index)))
23 , consumer_(std::move(consumer))
25 , channel_index_(channel_index)
27 consumer_->monitor_output().attach_parent(monitor_subject_);
30 void video_format_desc(const struct video_format_desc& format_desc)
32 consumer_->initialize(format_desc, channel_index_);
35 std::future<bool> send(const_frame frame)
37 *monitor_subject_ << monitor::message("/type") % consumer_->name();
38 return consumer_->send(std::move(frame));
40 std::wstring print() const
42 return consumer_->print();
50 int buffer_depth() const
52 return consumer_->buffer_depth();
55 bool has_synchronization_clock() const
57 return consumer_->has_synchronization_clock();
60 boost::property_tree::wptree info() const
62 return consumer_->info();
66 port::port(int index, int channel_index, spl::shared_ptr<frame_consumer> consumer) : impl_(new impl(index, channel_index, std::move(consumer))){}
67 port::port(port&& other) : impl_(std::move(other.impl_)){}
69 port& port::operator=(port&& other){impl_ = std::move(other.impl_); return *this;}
70 std::future<bool> port::send(const_frame frame){return impl_->send(std::move(frame));}
71 monitor::subject& port::monitor_output() {return *impl_->monitor_subject_;}
72 void port::video_format_desc(const struct video_format_desc& format_desc){impl_->video_format_desc(format_desc);}
73 int port::buffer_depth() const{return impl_->buffer_depth();}
74 std::wstring port::print() const{ return impl_->print();}
75 bool port::has_synchronization_clock() const{return impl_->has_synchronization_clock();}
76 boost::property_tree::wptree port::info() const{return impl_->info();}