Commit affc9a74 authored by Julius Künzel's avatar Julius Künzel 💬
Browse files

[Image Sequences] Fix loop option

BUG: 382432
parent a65e316c
......@@ -101,7 +101,7 @@ ProjectClip::ProjectClip(const QString &id, const QIcon &thumb, const std::share
hash();
m_boundaryTimer.setSingleShot(true);
m_boundaryTimer.setInterval(500);
if (m_hasLimitedDuration) {
if (hasLimitedDuration()) {
connect(&m_boundaryTimer, &QTimer::timeout, this, &ProjectClip::refreshBounds);
}
connect(m_markerModel.get(), &MarkerListModel::modelChanged, this,
......@@ -606,7 +606,7 @@ bool ProjectClip::setProducer(std::shared_ptr<Mlt::Producer> producer, bool gene
m_videoProducers.clear();
m_timewarpProducers.clear();
emit refreshPropertiesPanel();
if (m_hasLimitedDuration) {
if (hasLimitedDuration()) {
connect(&m_boundaryTimer, &QTimer::timeout, this, &ProjectClip::refreshBounds);
} else {
disconnect(&m_boundaryTimer, &QTimer::timeout, this, &ProjectClip::refreshBounds);
......
......@@ -35,7 +35,7 @@ ClipController::ClipController(const QString &clipId, const std::shared_ptr<Mlt:
, m_audioInfo(nullptr)
, m_videoIndex(0)
, m_clipType(ClipType::Unknown)
, m_hasLimitedDuration(true)
, m_forceLimitedDuration(false)
, m_hasMultipleVideoStreams(false)
, m_effectStack(producer ? EffectStackModel::construct(producer, {ObjectType::BinClip, clipId.toInt()}, pCore->undoStack()) : nullptr)
, m_hasAudio(false)
......@@ -245,41 +245,33 @@ void ClipController::getInfoForProducer()
} else if (m_service == QLatin1String("qimage") || m_service == QLatin1String("pixbuf")) {
if (m_path.contains(QLatin1Char('%')) || m_path.contains(QStringLiteral("/.all.")) || m_path.contains(QStringLiteral("\\.all."))) {
m_clipType = ClipType::SlideShow;
m_hasLimitedDuration = true;
} else {
m_clipType = ClipType::Image;
m_hasLimitedDuration = false;
}
} else if (m_service == QLatin1String("colour") || m_service == QLatin1String("color")) {
m_clipType = ClipType::Color;
// Required for faster compositing
m_masterProducer->set("mlt_image_format", "rgb");
m_hasLimitedDuration = false;
} else if (m_service == QLatin1String("kdenlivetitle")) {
if (!m_path.isEmpty()) {
m_clipType = ClipType::TextTemplate;
} else {
m_clipType = ClipType::Text;
}
m_hasLimitedDuration = false;
} else if (m_service == QLatin1String("xml") || m_service == QLatin1String("consumer")) {
m_clipType = ClipType::Playlist;
} else if (m_service == QLatin1String("webvfx")) {
m_clipType = ClipType::WebVfx;
} else if (m_service == QLatin1String("qtext")) {
m_clipType = ClipType::QText;
m_hasLimitedDuration = false;
} else if (m_service == QLatin1String("qml")) {
m_clipType = ClipType::Qml;
m_hasLimitedDuration = false;
} else if (m_service == QLatin1String("blipflash")) {
// Mostly used for testing
m_clipType = ClipType::AV;
m_hasLimitedDuration = true;
} else if (m_service == QLatin1String("glaxnimate")) {
// Mostly used for testing
m_clipType = ClipType::Animation;
m_hasLimitedDuration = true;
} else {
m_clipType = ClipType::Unknown;
}
......@@ -294,7 +286,7 @@ void ClipController::getInfoForProducer()
}
}
if (!m_hasLimitedDuration) {
if (!hasLimitedDuration()) {
int playtime = m_masterProducer->time_to_frames(m_masterProducer->get("kdenlive:duration"));
if (playtime <= 0) {
// Fix clips having missing kdenlive:duration
......@@ -306,12 +298,31 @@ void ClipController::getInfoForProducer()
bool ClipController::hasLimitedDuration() const
{
return m_hasLimitedDuration;
if (m_forceLimitedDuration) {
return true;
}
switch (m_clipType) {
case ClipType::SlideShow:
return getProducerIntProperty(QStringLiteral("loop")) == 1 ? false : true;
case ClipType::Image:
case ClipType::Color:
case ClipType::TextTemplate:
case ClipType::Text:
case ClipType::QText:
case ClipType::Qml:
return false;
case ClipType::AV:
case ClipType::Animation:
return true;
default:
return true;
}
}
void ClipController::forceLimitedDuration()
{
m_hasLimitedDuration = true;
m_forceLimitedDuration = true;
}
std::shared_ptr<Mlt::Producer> ClipController::originalProducer()
......@@ -450,7 +461,7 @@ GenTime ClipController::getPlaytime() const
return GenTime();
}
double fps = pCore->getCurrentFps();
if (!m_hasLimitedDuration) {
if (!hasLimitedDuration()) {
int playtime = m_masterProducer->time_to_frames(m_masterProducer->get("kdenlive:duration"));
return GenTime(playtime == 0 ? m_masterProducer->get_playtime() : playtime, fps);
}
......@@ -463,7 +474,7 @@ int ClipController::getFramePlaytime() const
if (!m_masterProducer || !m_masterProducer->is_valid()) {
return 0;
}
if (!m_hasLimitedDuration) {
if (!hasLimitedDuration()) {
int playtime = m_masterProducer->time_to_frames(m_masterProducer->get("kdenlive:duration"));
return playtime == 0 ? m_masterProducer->get_length() : playtime;
}
......
......@@ -232,7 +232,7 @@ protected:
QString m_path;
int m_videoIndex;
ClipType::ProducerType m_clipType;
bool m_hasLimitedDuration;
bool m_forceLimitedDuration;
bool m_hasMultipleVideoStreams;
QMutex m_effectMutex;
void getInfoForProducer();
......
  • mentioned in commit 5010483e

    Toggle commit list
  • What this loop should do? I enable it in a image sequence but I see no difference.

  • Enabling the loop option, the clip becomes endless (like a color or image clip), extending the sequence over its normal length, it will loop.

  • It's working. If loop is enabled you can/have to lengthen the image sequence clip by dragging.

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