X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=core%2Fproducer%2Flayer.cpp;h=44c1d928a869fd0fd59d1fbf536cbf6de555ece3;hb=c2ce81cf2749e7adf26715227d80af1a325c7370;hp=1f30234320af91da7b17893c9aa7b90c01bcab98;hpb=4dd9d408e0039d332016ece4b37939b59e21dbdb;p=casparcg diff --git a/core/producer/layer.cpp b/core/producer/layer.cpp index 1f3023432..44c1d928a 100644 --- a/core/producer/layer.cpp +++ b/core/producer/layer.cpp @@ -43,7 +43,7 @@ public: frame_producer_remover g_remover; -struct layer::implementation : boost::noncopyable +struct layer::implementation : public object, boost::noncopyable { mutable tbb::spin_mutex printer_mutex_; printer parent_printer_; @@ -54,8 +54,8 @@ struct layer::implementation : boost::noncopyable safe_ptr last_frame_; bool is_paused_; public: - implementation(int index, const printer& parent_printer) - : parent_printer_(parent_printer) + implementation(const object* parent, int index) + : object(parent) , index_(index) , foreground_(frame_producer::empty()) , background_(frame_producer::empty()) @@ -64,6 +64,7 @@ public: void load(const safe_ptr& frame_producer, bool play_on_load, bool preview) { + frame_producer->set_parent(this); background_ = frame_producer; is_paused_ = false; @@ -119,7 +120,7 @@ public: auto following = foreground_->get_following_producer(); following->set_leading_producer(foreground_); - following->set_parent_printer([=]{return print();}); + following->set_parent(this); g_remover.remove(std::move(foreground_)); foreground_ = following; CASPAR_LOG(info) << foreground_->print() << L" Added."; @@ -140,11 +141,11 @@ public: std::wstring print() const { tbb::spin_mutex::scoped_lock lock(printer_mutex_); // Child-producers may call print asynchronously to the producer thread. - return (parent_printer_ ? parent_printer_() + L"/" : L"") + L"layer[" + boost::lexical_cast(index_) + L"]"; + return object::print() + L"layer[" + boost::lexical_cast(index_) + L"]"; } }; -layer::layer(int index, const printer& parent_printer) : impl_(new implementation(index, parent_printer)){} +layer::layer(const object* parent, int index) : impl_(new implementation(parent, index)){} layer::layer(layer&& other) : impl_(std::move(other.impl_)){} layer& layer::operator=(layer&& other) {