| 72 | } |
| 73 | |
| 74 | void EffectStackModel::loadService(std::weak_ptr<Mlt::Service> service) |
| 75 | { |
| 76 | // Ensure child stack has the same effects count, otherwise re-sync |
| 77 | if (auto ptr = service.lock()) { |
| 78 | auto ms = m_masterService.lock(); |
| 79 | if (ptr->filter_count() != ms->filter_count()) { |
| 80 | // Filters mismatch |
| 81 | ms->unlock(); |
| 82 | // Remove all filters from service |
| 83 | int ix = ptr->filter_count() - 1; |
| 84 | while (ix >= 0) { |
| 85 | std::unique_ptr<Mlt::Filter> filt(ptr->filter(ix)); |
| 86 | if (filt->property_exists("kdenlive_id")) { |
| 87 | ptr->detach(*filt.get()); |
| 88 | } |
| 89 | ix--; |
| 90 | } |
| 91 | ptr->unlock(); |
| 92 | addService(service); |
| 93 | return; |
| 94 | } |
| 95 | } |
| 96 | QWriteLocker locker(&m_lock); |
| 97 | m_childServices.emplace_back(std::move(service)); |
| 98 | for (int i = 0; i < rootItem->childCount(); ++i) { |
| 99 | std::static_pointer_cast<EffectItemModel>(rootItem->child(i))->loadClone(m_childServices.back()); |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | void EffectStackModel::removeService(const std::shared_ptr<Mlt::Service> &service) |
| 104 | { |
no test coverage detected