Fix extract frame retrieving wrong frame when clip fps != project fps

BUG: 409927
parent 25b6af3a
Pipeline #6077 passed with stage
in 26 minutes and 28 seconds
......@@ -1036,7 +1036,7 @@ void Monitor::slotExtractCurrentFrame(QString frameName, bool addToProject)
QString framesFolder = KRecentDirs::dir(QStringLiteral(":KdenliveFramesFolder"));
if (framesFolder.isEmpty()) {
framesFolder = QDir::homePath();
framesFolder = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
}
QScopedPointer<QDialog> dlg(new QDialog(this));
QScopedPointer<KFileWidget> fileWidget(new KFileWidget(QUrl::fromLocalFile(framesFolder), dlg.data()));
......@@ -1096,7 +1096,7 @@ void Monitor::slotExtractCurrentFrame(QString frameName, bool addToProject)
if (addToProject) {
QString folderInfo = pCore->bin()->getCurrentFolder();
pCore->bin()->droppedUrls(QList<QUrl>() << QUrl::fromLocalFile(selectedFile), folderInfo);
pCore->bin()->droppedUrls(QList<QUrl> {QUrl::fromLocalFile(selectedFile)}, folderInfo);
}
}
}
......
......@@ -251,7 +251,13 @@ QImage MonitorProxy::extractFrame(int frame_position, const QString &path, int w
tmpProd->attach(converter);
// TODO: paste effects
// Clip(*tmpProd).addEffects(*q->m_producer);
tmpProd->seek(q->m_producer->position());
double projectFps = pCore->getCurrentFps();
double currentFps = tmpProfile->fps();
if (qFuzzyCompare(projectFps, currentFps)) {
tmpProd->seek(q->m_producer->position());
} else {
tmpProd->seek(q->m_producer->position() * currentFps / projectFps);
}
frame = tmpProd->get_frame();
img = KThumb::getFrame(frame, width, height);
delete frame;
......
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