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