Fix invalid clip on project opening

CCBUG: 407778
parent 7c9787b8
Pipeline #3738 passed with stage
in 21 minutes and 21 seconds
......@@ -908,30 +908,11 @@ void ProjectItemModel::loadBinPlaylist(Mlt::Tractor *documentTractor, Mlt::Tract
parentId = QStringLiteral("-1");
}
qDebug() << "clip id" << id;
if (id.contains(QLatin1Char('_'))) {
// TODO refac ?
/*
// This is a track producer
QString mainId = id.section(QLatin1Char('_'), 0, 0);
// QString track = id.section(QStringLiteral("_"), 1, 1);
if (m_clipList.contains(mainId)) {
// The controller for this track producer already exists
} else {
// Create empty controller for this clip
requestClipInfo info;
info.imageHeight = 0;
info.clipId = id;
info.replaceProducer = true;
emit slotProducerReady(info, ClipController::mediaUnavailable);
}
*/
} else {
QString newId = isIdFree(id) ? id : QString::number(getFreeClipId());
producer->set("_kdenlive_processed", 1);
requestAddBinClip(newId, producer, parentId, undo, redo);
binIdCorresp[id] = newId;
qDebug() << "Loaded clip " << id << "under id" << newId;
}
QString newId = isIdFree(id) ? id : QString::number(getFreeClipId());
producer->set("_kdenlive_processed", 1);
requestAddBinClip(newId, producer, parentId, undo, redo);
binIdCorresp[id] = newId;
qDebug() << "Loaded clip " << id << "under id" << newId;
}
}
}
......
......@@ -56,9 +56,6 @@ ClipController::ClipController(const QString &clipId, const std::shared_ptr<Mlt:
qCDebug(KDENLIVE_LOG) << "// WARNING, USING INVALID PRODUCER";
return;
}
if (m_masterProducer) {
checkAudioVideo();
}
if (m_properties) {
setProducerProperty(QStringLiteral("kdenlive:id"), m_controllerBinId);
m_service = m_properties->get("mlt_service");
......@@ -69,14 +66,17 @@ ClipController::ClipController(const QString &clipId, const std::shared_ptr<Mlt:
path = m_properties->get("kdenlive:originalurl");
if (QFileInfo(path).isRelative()) {
path.prepend(pCore->currentDoc()->documentRoot());
m_properties->set("resource", path.toUtf8().constData());
}
m_usesProxy = true;
} else if (m_service != QLatin1String("color") && m_service != QLatin1String("colour") && !path.isEmpty() && QFileInfo(path).isRelative() &&
path != QLatin1String("<producer>")) {
path.prepend(pCore->currentDoc()->documentRoot());
m_properties->set("resource", path.toUtf8().constData());
}
m_path = path.isEmpty() ? QString() : QFileInfo(path).absoluteFilePath();
getInfoForProducer();
checkAudioVideo();
} else {
m_producerLock.lock();
}
......@@ -589,9 +589,13 @@ void ClipController::checkAudioVideo()
return;
}
QScopedPointer<Mlt::Frame> frame(m_masterProducer->get_frame());
// test_audio returns 1 if there is NO audio (strange but true at the time this code is written)
m_hasAudio = frame->get_int("test_audio") == 0;
m_hasVideo = frame->get_int("test_image") == 0;
if (frame->is_valid()) {
// test_audio returns 1 if there is NO audio (strange but true at the time this code is written)
m_hasAudio = frame->get_int("test_audio") == 0;
m_hasVideo = frame->get_int("test_image") == 0;
} else {
qDebug()<<"* * * *ERROR INVALID FRAME On test";
}
}
bool ClipController::hasVideo() const
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment