diff --git a/src/bin/projectclip.cpp b/src/bin/projectclip.cpp --- a/src/bin/projectclip.cpp +++ b/src/bin/projectclip.cpp @@ -421,11 +421,12 @@ void ProjectClip::createVideoMasterProducer() { if (!m_videoProducer) { - m_videoProducer = cloneProducer(&pCore->getCurrentProfile()->profile()); - // disable audio but activate video - m_videoProducer->set("set.test_audio", 1); - m_videoProducer->set("set.test_image", 0); - m_effectStack->addService(m_videoProducer); + m_videoProducer = std::shared_ptr(new Mlt::Producer(m_masterProducer.get())); + if (hasAudio()) { + // disable audio but activate video + m_videoProducer->set("set.test_audio", 1); + m_videoProducer->set("set.test_image", 0); + } } } diff --git a/src/timeline2/model/clipmodel.cpp b/src/timeline2/model/clipmodel.cpp --- a/src/timeline2/model/clipmodel.cpp +++ b/src/timeline2/model/clipmodel.cpp @@ -441,7 +441,21 @@ QWriteLocker locker(&m_lock); return [this, state]() { if (auto ptr = m_parent.lock()) { - refreshProducerFromBin(state); + switch (state) { + case PlaylistState::Disabled: + m_producer->set("set.test_audio", 1); + m_producer->set("set.test_image", 1); + break; + case PlaylistState::VideoOnly: + m_producer->set("set.test_image", 0); + break; + case PlaylistState::AudioOnly: + m_producer->set("set.test_audio", 0); + break; + default: + //error + break; + } m_currentState = state; if (ptr->isClip(m_id)) { // if this is false, the clip is being created. Don't update model in that case QModelIndex ix = ptr->makeClipIndexFromID(m_id); diff --git a/src/timeline2/model/timelinefunctions.cpp b/src/timeline2/model/timelinefunctions.cpp --- a/src/timeline2/model/timelinefunctions.cpp +++ b/src/timeline2/model/timelinefunctions.cpp @@ -420,22 +420,6 @@ Fun local_undo = []() { return true; }; Fun local_redo = []() { return true; }; bool result = timeline->m_allClips[clipId]->setClipState(status, local_undo, local_redo); - Fun operation = [timeline, clipId]() { - int trackId = timeline->getClipTrackId(clipId); - // in order to make the producer change effective, we need to unplant / replant the clip in int track - if (trackId != -1) { - timeline->getTrackById(trackId)->replugClip(clipId); - } - return true; - }; - result = result && operation(); - if (!result) { - bool undone = local_undo(); - Q_ASSERT(undone); - return false; - } - auto reverse = operation; - UPDATE_UNDO_REDO_NOLOCK(operation, reverse, local_undo, local_redo); UPDATE_UNDO_REDO_NOLOCK(local_redo, local_undo, undo, redo); return result; }