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));
42 int buffer_depth() const
44 return consumer_->buffer_depth();
47 bool has_synchronization_clock() const
49 return consumer_->has_synchronization_clock();
52 boost::property_tree::wptree info() const
54 return consumer_->info();
58 port::port(int index, int channel_index, spl::shared_ptr<frame_consumer> consumer) : impl_(new impl(index, channel_index, std::move(consumer))){}
59 port::port(port&& other) : impl_(std::move(other.impl_)){}
61 port& port::operator=(port&& other){impl_ = std::move(other.impl_); return *this;}
62 boost::unique_future<bool> port::send(const_frame frame){return impl_->send(std::move(frame));}
63 void port::subscribe(const monitor::observable::observer_ptr& o){impl_->event_subject_.subscribe(o);}
64 void port::unsubscribe(const monitor::observable::observer_ptr& o){impl_->event_subject_.unsubscribe(o);}
65 void port::video_format_desc(const struct video_format_desc& format_desc){impl_->video_format_desc(format_desc);}
66 int port::buffer_depth() const{return impl_->buffer_depth();}
67 bool port::has_synchronization_clock() const{return impl_->has_synchronization_clock();}
68 boost::property_tree::wptree port::info() const{return impl_->info();}