Commit 3d01a69e authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix bin clip not correctly reloaded on profile change, causing missing audio thumbs

parent 887b986c
Pipeline #118382 failed with stage
in 5 minutes and 5 seconds
......@@ -4317,7 +4317,8 @@ void Bin::reloadAllProducers(bool reloadThumbs)
QDomDocument doc;
QDomElement xml = clip->toXml(doc, false, false);
// Make sure we reload clip length
if (clip->clipType() == ClipType::AV || clip->clipType() == ClipType::Video || clip->clipType() == ClipType::Audio || clip->clipType() == ClipType::Playlist) {
ClipType::ProducerType type = clip->clipType();
if (type == ClipType::AV || type == ClipType::Video || type == ClipType::Audio || type == ClipType::Playlist) {
xml.removeAttribute(QStringLiteral("out"));
Xml::removeXmlProperty(xml, QStringLiteral("length"));
}
......@@ -4331,8 +4332,6 @@ void Bin::reloadAllProducers(bool reloadThumbs)
clip->setClipStatus(FileStatus::StatusWaiting);
pCore->taskManager.discardJobs({ObjectType::BinClip, clip->clipId().toInt()}, AbstractTask::NOJOBTYPE, true);
clip->discardAudioThumb();
// We need to set a temporary id before all outdated producers are replaced;
//int jobId = pCore->jobManager()->startJob<LoadJob>({clip->clipId()}, -1, QString(), xml);
if (reloadThumbs) {
ThumbnailCache::get()->invalidateThumbsForClip(clip->clipId());
}
......
......@@ -681,7 +681,6 @@ bool ProjectItemModel::addItem(const std::shared_ptr<AbstractProjectItem> &item,
Q_ASSERT(item->isInModel());
if (res) {
Fun checkAudio = item->getAudio_lambda();
checkAudio();
PUSH_LAMBDA(checkAudio, operation);
UPDATE_UNDO_REDO(operation, reverse, undo, redo);
}
......
......@@ -42,6 +42,7 @@ void AudioLevelsTask::start(const ObjectId &owner, QObject* object, bool force)
AudioLevelsTask* task = new AudioLevelsTask(owner, object);
// See if there is already a task for this MLT service and resource.
if (pCore->taskManager.hasPendingJob(owner, AbstractTask::AUDIOTHUMBJOB)) {
qDebug()<<"AUDIO LEVELS TASK STARTED TWICE!!!!";
delete task;
task = 0;
}
......@@ -73,14 +74,16 @@ void AudioLevelsTask::run()
}
std::shared_ptr<Mlt::Producer> producer = binClip->originalProducer();
if ((producer == nullptr) || !producer->is_valid()) {
QMetaObject::invokeMethod(pCore.get(), "displayBinMessage", Qt::QueuedConnection, Q_ARG(QString, i18n("Audio thumbs: cannot open file %1", binClip->url())),
QMetaObject::invokeMethod(pCore.get(), "displayBinMessage", Qt::QueuedConnection, Q_ARG(QString, i18n("Audio thumbs: cannot open file %1", QFileInfo(binClip->url()).fileName())),
Q_ARG(int, int(KMessageWidget::Warning)));
pCore->taskManager.taskDone(m_owner.second, this);
return;
}
int lengthInFrames = producer->get_length(); // Multiply this if we want more than 1 sample per frame
if (lengthInFrames == INT_MAX) {
if (lengthInFrames == INT_MAX || lengthInFrames == 0) {
// This is a broken file or live feed, don't attempt to generate audio thumbnails
QMetaObject::invokeMethod(pCore.get(), "displayBinMessage", Qt::QueuedConnection, Q_ARG(QString, i18n("Audio thumbs: unknown file length for %1", QFileInfo(binClip->url()).fileName())),
Q_ARG(int, int(KMessageWidget::Warning)));
pCore->taskManager.taskDone(m_owner.second, this);
return;
}
......
......@@ -432,6 +432,9 @@ void ClipLoadTask::run()
default:
if (!service.isEmpty()) {
service.append(QChar(':'));
if (service == QLatin1String("avformat-novalidate:")) {
service = QStringLiteral("avformat:");
}
producer = loadResource(resource, service);
} else {
producer = std::make_shared<Mlt::Producer>(*pCore->getProjectProfile(), nullptr, resource.toUtf8().constData());
......
Supports Markdown
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