Fix cache thumbs incorrectly using full res profile

parent f8ecc140
Pipeline #15895 passed with stage
in 13 minutes and 38 seconds
......@@ -499,7 +499,10 @@ bool ProjectClip::setProducer(std::shared_ptr<Mlt::Producer> producer, bool repl
emit refreshPropertiesPanel();
if (m_clipType == ClipType::AV || m_clipType == ClipType::Video || m_clipType == ClipType::Playlist) {
QTimer::singleShot(1000, this, [this]() {
pCore->jobManager()->startJob<CacheJob>({m_binId}, -1, QString());
int loadjobId;
if (!pCore->jobManager()->hasPendingJob(m_binId, AbstractClipJob::CACHEJOB, &loadjobId)) {
pCore->jobManager()->startJob<CacheJob>({m_binId}, -1, QString());
}
});
}
replaceInTimeline();
......@@ -1493,8 +1496,7 @@ void ProjectClip::getThumbFromPercent(int percent)
} else {
// Generate percent thumbs
int id;
if (pCore->jobManager()->hasPendingJob(m_binId, AbstractClipJob::CACHEJOB, &id)) {
} else {
if (!pCore->jobManager()->hasPendingJob(m_binId, AbstractClipJob::CACHEJOB, &id)) {
pCore->jobManager()->startJob<CacheJob>({m_binId}, -1, QString(), 50);
}
}
......
......@@ -205,8 +205,7 @@ void ProjectSubClip::getThumbFromPercent(int percent)
} else {
// Generate percent thumbs
int id;
if (pCore->jobManager()->hasPendingJob(m_parentClipId, AbstractClipJob::CACHEJOB, &id)) {
} else {
if (!pCore->jobManager()->hasPendingJob(m_parentClipId, AbstractClipJob::CACHEJOB, &id)) {
pCore->jobManager()->startJob<CacheJob>({m_parentClipId}, -1, QString(), 25, m_inPoint, m_outPoint);
}
}
......
......@@ -756,13 +756,13 @@ Mlt::Profile *Core::thumbProfile()
QMutexLocker lck(&m_thumbProfileMutex);
if (!m_thumbProfile) {
m_thumbProfile = std::make_unique<Mlt::Profile>(m_currentProfile.toStdString().c_str());
/*double factor = 144. / m_thumbProfile->height();
double factor = 144. / m_thumbProfile->height();
m_thumbProfile->set_height(144);
int width = m_thumbProfile->width() * factor + 0.5;
if (width % 2 > 0) {
width ++;
}
m_thumbProfile->set_width(width);*/
m_thumbProfile->set_width(width);
}
return m_thumbProfile.get();
}
......
......@@ -89,8 +89,11 @@ bool CacheJob::startJob()
m_thumbsCount = duration / 10;
}
std::set<int> frames;
for (int i = 1; i <= m_thumbsCount; ++i) {
frames.insert(m_inPoint + (duration * i / m_thumbsCount));
double steps = qMax(pCore->getCurrentFps(), (double)duration / m_thumbsCount);
int pos = m_inPoint;
for (int i = 1; i <= m_thumbsCount && pos <= duration; ++i) {
frames.insert(pos);
pos = m_inPoint + (steps * i);
}
int size = (int)frames.size();
int count = 0;
......
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