]> git.sesse.net Git - casparcg/blobdiff - core/producer/layer.cpp
ยค412
[casparcg] / core / producer / layer.cpp
index 1f30234320af91da7b17893c9aa7b90c01bcab98..44c1d928a869fd0fd59d1fbf536cbf6de555ece3 100644 (file)
@@ -43,7 +43,7 @@ public:
 \r
 frame_producer_remover g_remover;\r
 \r
-struct layer::implementation : boost::noncopyable\r
+struct layer::implementation : public object, boost::noncopyable\r
 {                              \r
        mutable tbb::spin_mutex         printer_mutex_;\r
        printer                                         parent_printer_;\r
@@ -54,8 +54,8 @@ struct layer::implementation : boost::noncopyable
        safe_ptr<basic_frame>           last_frame_;\r
        bool                                            is_paused_;\r
 public:\r
-       implementation(int index, const printer& parent_printer\r
-               : parent_printer_(parent_printer)\r
+       implementation(const object* parent, int index\r
+               : object(parent)\r
                , index_(index)\r
                , foreground_(frame_producer::empty())\r
                , background_(frame_producer::empty())\r
@@ -64,6 +64,7 @@ public:
        \r
        void load(const safe_ptr<frame_producer>& frame_producer, bool play_on_load, bool preview)\r
        {               \r
+               frame_producer->set_parent(this);\r
                background_ = frame_producer;\r
                is_paused_ = false;\r
 \r
@@ -119,7 +120,7 @@ public:
 \r
                                auto following = foreground_->get_following_producer();\r
                                following->set_leading_producer(foreground_);\r
-                               following->set_parent_printer([=]{return print();});\r
+                               following->set_parent(this);\r
                                g_remover.remove(std::move(foreground_));\r
                                foreground_ = following;\r
                                CASPAR_LOG(info) << foreground_->print() << L" Added.";\r
@@ -140,11 +141,11 @@ public:
        std::wstring print() const\r
        {\r
                tbb::spin_mutex::scoped_lock lock(printer_mutex_); // Child-producers may call print asynchronously to the producer thread.\r
-               return (parent_printer_ ? parent_printer_() + L"/" : L"") + L"layer[" + boost::lexical_cast<std::wstring>(index_) + L"]";\r
+               return object::print() + L"layer[" + boost::lexical_cast<std::wstring>(index_) + L"]";\r
        }\r
 };\r
 \r
-layer::layer(int index, const printer& parent_printer) : impl_(new implementation(index, parent_printer)){}\r
+layer::layer(const object* parent, int index) : impl_(new implementation(parent, index)){}\r
 layer::layer(layer&& other) : impl_(std::move(other.impl_)){}\r
 layer& layer::operator=(layer&& other)\r
 {\r