Fix 1 frame offset in fade out

CCBUG: 416811
parent d623ed40
Pipeline #15607 passed with stage
in 14 minutes and 5 seconds
......@@ -516,7 +516,7 @@ QVariant AssetParameterModel::parseAttribute(const ObjectId &owner, const QStrin
int width = profile->width();
int height = profile->height();
int in = pCore->getItemIn(owner);
int out = in + pCore->getItemDuration(owner);
int out = in + pCore->getItemDuration(owner) - 1;
int frame_duration = pCore->getDurationFromString(KdenliveSettings::fade_duration());
// replace symbols in the double parameter
content.replace(QLatin1String("%maxWidth"), QString::number(width))
......
......@@ -53,7 +53,7 @@ PositionEditWidget::PositionEditWidget(std::shared_ptr<AssetParameterModel> mode
// emit the signal of the base class when appropriate
connect(this->m_slider, &QAbstractSlider::valueChanged, [this](int val) {
if (m_inverted) {
val = m_model->data(m_index, AssetParameterModel::ParentInRole).toInt() + m_model->data(m_index, AssetParameterModel::ParentDurationRole).toInt() -
val = m_model->data(m_index, AssetParameterModel::ParentInRole).toInt() + m_model->data(m_index, AssetParameterModel::ParentDurationRole).toInt() - 1 -
val;
} else if (!m_model->data(m_index, AssetParameterModel::RelativePosRole).toBool()) {
val += m_model->data(m_index, AssetParameterModel::ParentInRole).toInt();
......@@ -100,7 +100,7 @@ void PositionEditWidget::slotRefresh()
if (value.isNull()) {
val = m_model->data(m_index, AssetParameterModel::DefaultRole).toInt();
if (m_inverted) {
val = -val;
val = -val - 1;
}
} else {
if (value.userType() == QMetaType::QString) {
......@@ -112,7 +112,7 @@ void PositionEditWidget::slotRefresh()
if (val < 0) {
val = -val;
} else {
val = max - val;
val = max - val - 1;
}
}
}
......
......@@ -3722,7 +3722,7 @@ void Bin::reloadAllProducers()
// We need to set a temporary id before all outdated producers are replaced;
int jobId = pCore->jobManager()->startJob<LoadJob>({clip->clipId()}, -1, QString(), xml);
ThumbnailCache::get()->invalidateThumbsForClip(clip->clipId(), true);
pCore->jobManager()->startJob<ThumbJob>({clip->clipId()}, jobId, QString(), 150, -1, true, true);
pCore->jobManager()->startJob<ThumbJob>({clip->clipId()}, jobId, QString(), -1, true, true);
pCore->jobManager()->startJob<AudioThumbJob>({clip->clipId()}, jobId, QString());
}
}
......
......@@ -312,7 +312,7 @@ void ProjectClip::reloadProducer(bool refreshOnly, bool audioStreamChanged, bool
ThumbnailCache::get()->invalidateThumbsForClip(clipId(), false);
pCore->jobManager()->discardJobs(clipId(), AbstractClipJob::THUMBJOB);
m_thumbsProducer.reset();
pCore->jobManager()->startJob<ThumbJob>({clipId()}, loadjobId, QString(), 150, -1, true, true);
pCore->jobManager()->startJob<ThumbJob>({clipId()}, loadjobId, QString(), -1, true, true);
} else {
// If another load job is running?
if (loadjobId > -1) {
......@@ -332,7 +332,7 @@ void ProjectClip::reloadProducer(bool refreshOnly, bool audioStreamChanged, bool
}
ThumbnailCache::get()->invalidateThumbsForClip(clipId(), reloadAudio);
int loadJob = pCore->jobManager()->startJob<LoadJob>({clipId()}, loadjobId, QString(), xml);
pCore->jobManager()->startJob<ThumbJob>({clipId()}, loadJob, QString(), 150, -1, true, true);
pCore->jobManager()->startJob<ThumbJob>({clipId()}, loadJob, QString(), -1, true, true);
if (audioStreamChanged) {
discardAudioThumb();
pCore->jobManager()->startJob<AudioThumbJob>({clipId()}, loadjobId, QString());
......@@ -1490,7 +1490,7 @@ void ProjectClip::getThumbFromPercent(int percent)
int id;
if (pCore->jobManager()->hasPendingJob(m_binId, AbstractClipJob::CACHEJOB, &id)) {
} else {
pCore->jobManager()->startJob<CacheJob>({m_binId}, -1, QString(), 150, 50);
pCore->jobManager()->startJob<CacheJob>({m_binId}, -1, QString(), 50);
}
}
}
......
......@@ -688,13 +688,13 @@ bool ProjectItemModel::requestAddBinClip(QString &id, const QDomElement &descrip
qDebug() << "/////////// added " << res;
if (res) {
int loadJob = pCore->jobManager()->startJob<LoadJob>({id}, -1, QString(), description, std::bind(readyCallBack, id));
int thumbJob = pCore->jobManager()->startJob<ThumbJob>({id}, loadJob, QString(), 150, 0, true);
int thumbJob = pCore->jobManager()->startJob<ThumbJob>({id}, loadJob, QString(), 0, true);
ClipType::ProducerType type = new_clip->clipType();
if (type == ClipType::AV || type == ClipType::Audio || type == ClipType::Playlist || type == ClipType::Unknown) {
pCore->jobManager()->startJob<AudioThumbJob>({id}, loadJob, QString());
}
if (type == ClipType::AV || type == ClipType::Video || type == ClipType::Playlist || type == ClipType::Unknown) {
pCore->jobManager()->startJob<CacheJob>({id}, thumbJob, QString(), 150);
pCore->jobManager()->startJob<CacheJob>({id}, thumbJob, QString());
}
}
return res;
......@@ -728,7 +728,7 @@ bool ProjectItemModel::requestAddBinClip(QString &id, const std::shared_ptr<Mlt:
new_clip->importEffects(producer);
if (new_clip->sourceExists()) {
int blocking = pCore->jobManager()->getBlockingJobId(id, AbstractClipJob::LOADJOB);
pCore->jobManager()->startJob<ThumbJob>({id}, blocking, QString(), 150, -1, true);
pCore->jobManager()->startJob<ThumbJob>({id}, blocking, QString(), -1, true);
pCore->jobManager()->startJob<AudioThumbJob>({id}, blocking, QString());
}
}
......@@ -754,7 +754,7 @@ bool ProjectItemModel::requestAddBinSubClip(QString &id, int in, int out, const
bool res = addItem(new_clip, subId, undo, redo);
if (res) {
int parentJob = pCore->jobManager()->getBlockingJobId(subId, AbstractClipJob::LOADJOB);
pCore->jobManager()->startJob<ThumbJob>({id}, parentJob, QString(), 150, -1, true);
pCore->jobManager()->startJob<ThumbJob>({id}, parentJob, QString(), -1, true);
}
return res;
}
......
......@@ -207,7 +207,7 @@ void ProjectSubClip::getThumbFromPercent(int percent)
int id;
if (pCore->jobManager()->hasPendingJob(m_parentClipId, AbstractClipJob::CACHEJOB, &id)) {
} else {
pCore->jobManager()->startJob<CacheJob>({m_parentClipId}, -1, QString(), 150, 25, m_inPoint, m_outPoint);
pCore->jobManager()->startJob<CacheJob>({m_parentClipId}, -1, QString(), 25, m_inPoint, m_outPoint);
}
}
}
......
......@@ -447,7 +447,6 @@ bool EffectStackModel::appendEffect(const QString &effectId, bool makeCurrent)
if (res) {
int inFades = 0;
int outFades = 0;
if (effectId == QLatin1String("fadein") || effectId == QLatin1String("fade_from_black")) {
int duration = effect->filter().get_length() - 1;
int in = pCore->getItemIn(m_ownerId);
......@@ -695,7 +694,7 @@ bool EffectStackModel::adjustFadeLength(int duration, bool fromStart, bool audio
in = ptr->get_int("in");
}
int itemDuration = pCore->getItemDuration(m_ownerId);
int out = in + itemDuration;
int out = in + itemDuration - 1;
int oldDuration = -1;
QList<QModelIndex> indexes;
for (int i = 0; i < rootItem->childCount(); ++i) {
......@@ -704,7 +703,7 @@ bool EffectStackModel::adjustFadeLength(int duration, bool fromStart, bool audio
if (oldDuration == -1) {
oldDuration = effect->filter().get_length();
}
effect->filter().set("out", out - 1);
effect->filter().set("out", out);
duration = qMin(itemDuration, duration);
effect->filter().set("in", out - duration);
indexes << getIndexFromItem(effect);
......
......@@ -34,7 +34,7 @@
#include <set>
CacheJob::CacheJob(const QString &binId, int imageHeight, int thumbsCount, int inPoint, int outPoint)
CacheJob::CacheJob(const QString &binId, int thumbsCount, int inPoint, int outPoint)
: AbstractClipJob(CACHEJOB, binId)
, m_imageHeight(pCore->thumbProfile()->height())
, m_imageWidth(pCore->thumbProfile()->width())
......
......@@ -42,7 +42,7 @@ public:
@param frameNumber is the frame to extract. Leave to -1 for default
@param persistent: if true, we will use the persistent cache (for query and saving)
*/
CacheJob(const QString &binId, int imageHeight, int thumbsCount = 10, int inPoint = 0, int outPoint = 0);
CacheJob(const QString &binId, int thumbsCount = 10, int inPoint = 0, int outPoint = 0);
const QString getDescription() const override;
......
......@@ -32,7 +32,7 @@
#include <QScopedPointer>
#include <mlt++/MltProducer.h>
ThumbJob::ThumbJob(const QString &binId, int imageHeight, int frameNumber, bool persistent, bool reloadAllThumbs)
ThumbJob::ThumbJob(const QString &binId, int frameNumber, bool persistent, bool reloadAllThumbs)
: AbstractClipJob(THUMBJOB, binId)
, m_frameNumber(frameNumber)
, m_imageHeight(pCore->thumbProfile()->height())
......
......@@ -43,7 +43,7 @@ public:
@param frameNumber is the frame to extract. Leave to -1 for default
@param persistent: if true, we will use the persistent cache (for query and saving)
*/
ThumbJob(const QString &binId, int imageHeight, int frameNumber = -1, bool persistent = false, bool reloadAllThumbs = false);
ThumbJob(const QString &binId, int frameNumber = -1, bool persistent = false, bool reloadAllThumbs = false);
const QString getDescription() const override;
......
......@@ -828,9 +828,6 @@ Rectangle {
root.autoScrolling = timeline.autoScroll
anchors.right = parent.right
var duration = clipRoot.fadeOut
if (duration > 0) {
duration += 1
}
timeline.adjustFade(clipRoot.clipId, 'fadeout', duration, startFadeOut)
bubbleHelp.hide()
}
......@@ -843,7 +840,7 @@ Rectangle {
lastDuration = duration
timeline.adjustFade(clipRoot.clipId, 'fadeout', duration, -1)
// Show fade duration as time in a "bubble" help.
var s = timeline.simplifiedTC(clipRoot.fadeOut + (clipRoot.fadeOut > 0 ? 1 : 0))
var s = timeline.simplifiedTC(clipRoot.fadeOut)
bubbleHelp.show(clipRoot.x + x, parentTrack.y + parentTrack.height, s)
}
}
......
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