]> git.sesse.net Git - casparcg/blobdiff - core/consumer/port.cpp
Created a consumer that provides sync to a channel based on the pace of another chann...
[casparcg] / core / consumer / port.cpp
index db3c68fa890b9ee28303eb68c4b6565ec73abf4b..ecc19836d07c7fb92e3e9052b2155eed2efc4794 100644 (file)
@@ -14,7 +14,7 @@ struct port::impl
 {
        int                                                                     index_;
        spl::shared_ptr<monitor::subject>       monitor_subject_ = spl::make_shared<monitor::subject>("/port/" + boost::lexical_cast<std::string>(index_));
-       std::shared_ptr<frame_consumer>         consumer_;
+       spl::shared_ptr<frame_consumer>         consumer_;
        int                                                                     channel_index_;
 public:
        impl(int index, int channel_index, spl::shared_ptr<frame_consumer> consumer)
@@ -24,12 +24,12 @@ public:
        {
                consumer_->monitor_output().attach_parent(monitor_subject_);
        }
-       
+
        void change_channel_format(const core::video_format_desc& format_desc, const audio_channel_layout& channel_layout)
        {
                consumer_->initialize(format_desc, channel_layout, channel_index_);
        }
-               
+
        std::future<bool> send(const_frame frame)
        {
                *monitor_subject_ << monitor::message("/type") % consumer_->name();
@@ -64,13 +64,18 @@ public:
        {
                return consumer_->presentation_frame_age_millis();
        }
+
+       spl::shared_ptr<const frame_consumer> consumer() const
+       {
+               return consumer_;
+       }
 };
 
 port::port(int index, int channel_index, spl::shared_ptr<frame_consumer> consumer) : impl_(new impl(index, channel_index, std::move(consumer))){}
 port::port(port&& other) : impl_(std::move(other.impl_)){}
 port::~port(){}
 port& port::operator=(port&& other){impl_ = std::move(other.impl_); return *this;}
-std::future<bool> port::send(const_frame frame){return impl_->send(std::move(frame));} 
+std::future<bool> port::send(const_frame frame){return impl_->send(std::move(frame));}
 monitor::subject& port::monitor_output() {return *impl_->monitor_subject_;}
 void port::change_channel_format(const core::video_format_desc& format_desc, const audio_channel_layout& channel_layout){impl_->change_channel_format(format_desc, channel_layout);}
 int port::buffer_depth() const{return impl_->buffer_depth();}
@@ -78,4 +83,5 @@ std::wstring port::print() const{ return impl_->print();}
 bool port::has_synchronization_clock() const{return impl_->has_synchronization_clock();}
 boost::property_tree::wptree port::info() const{return impl_->info();}
 int64_t port::presentation_frame_age_millis() const{ return impl_->presentation_frame_age_millis(); }
-}}
\ No newline at end of file
+spl::shared_ptr<const frame_consumer> port::consumer() const { return impl_->consumer(); }
+}}