5 #include "frame_consumer.h"
6 #include "../frame/frame.h"
8 namespace caspar { namespace core {
12 monitor::basic_subject event_subject_;
13 std::shared_ptr<frame_consumer> consumer_;
17 impl(int index, int channel_index, spl::shared_ptr<frame_consumer> consumer)
18 : event_subject_(monitor::path("port") % index)
19 , consumer_(std::move(consumer))
21 , channel_index_(channel_index)
23 consumer_->subscribe(event_subject_);
26 void video_format_desc(const struct video_format_desc& format_desc)
28 consumer_->initialize(format_desc, channel_index_);
31 boost::unique_future<bool> send(const_frame frame)
33 event_subject_ << monitor::event("type") % consumer_->name();
34 return consumer_->send(std::move(frame));
36 std::wstring print() const
38 return consumer_->print();
46 int buffer_depth() const
48 return consumer_->buffer_depth();
51 bool has_synchronization_clock() const
53 return consumer_->has_synchronization_clock();
56 boost::property_tree::wptree info() const
58 return consumer_->info();
62 port::port(int index, int channel_index, spl::shared_ptr<frame_consumer> consumer) : impl_(new impl(index, channel_index, std::move(consumer))){}
63 port::port(port&& other) : impl_(std::move(other.impl_)){}
65 port& port::operator=(port&& other){impl_ = std::move(other.impl_); return *this;}
66 boost::unique_future<bool> port::send(const_frame frame){return impl_->send(std::move(frame));}
67 void port::subscribe(const monitor::observable::observer_ptr& o){impl_->event_subject_.subscribe(o);}
68 void port::unsubscribe(const monitor::observable::observer_ptr& o){impl_->event_subject_.unsubscribe(o);}
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();}