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

Fix image / color clips if defaut duration is set to 1 frame

parent 0e8f6e7f
......@@ -116,7 +116,7 @@ void ClipCreationDialog::createColorClip(KdenliveDoc *doc, QStringList groupInfo
uint id = bin->getFreeClipId();
prod.setAttribute(QStringLiteral("id"), QString::number(id));
prod.setAttribute(QStringLiteral("in"), QStringLiteral("0"));
prod.setAttribute(QStringLiteral("out"), doc->getFramePos(doc->timecode().getTimecode(t->gentime())) - 1);
prod.setAttribute(QStringLiteral("length"), doc->getFramePos(doc->timecode().getTimecode(t->gentime())));
QMap <QString, QString> properties;
properties.insert(QStringLiteral("resource"), color);
properties.insert(QStringLiteral("kdenlive:clipname"), dia_ui.clip_name->text());
......@@ -440,7 +440,7 @@ void ClipCreationDialog::createClipsCommand(KdenliveDoc *doc, const QList<QUrl>
if (type.name().startsWith(QLatin1String("image/"))) {
prod.setAttribute(QStringLiteral("type"), (int) Image);
prod.setAttribute(QStringLiteral("in"), 0);
prod.setAttribute(QStringLiteral("out"), doc->getFramePos(KdenliveSettings::image_duration()) - 1);
prod.setAttribute(QStringLiteral("length"), doc->getFramePos(KdenliveSettings::image_duration()));
if (KdenliveSettings::autoimagetransparency()) properties.insert(QStringLiteral("kdenlive:transparency"), QStringLiteral("1"));
} else if (type.inherits(QStringLiteral("application/x-kdenlivetitle"))) {
// opening a title file
......
......@@ -407,25 +407,27 @@ void ProducerQueue::processFileProperties()
if (info.xml.hasAttribute(QStringLiteral("out"))) {
clipOut = info.xml.attribute(QStringLiteral("out")).toInt();
}
// setup length here as otherwise default length (currently 15000 frames in MLT) will be taken even if outpoint is larger
if (type == Color || type == Text || type == TextTemplate || type == QText || type == Image || type == SlideShow) {
int length;
if (info.xml.hasAttribute(QStringLiteral("length"))) {
length = info.xml.attribute(QStringLiteral("length")).toInt();
clipOut = length - 1;
clipOut = qMax(1, length - 1);
} else {
length = EffectsList::property(info.xml, QStringLiteral("length")).toInt();
clipOut = info.xml.attribute(QStringLiteral("out")).toInt() - info.xml.attribute(QStringLiteral("in")).toInt();
if (length < clipOut)
length = clipOut + 1;
clipOut -= info.xml.attribute(QStringLiteral("in")).toInt();
if (length < clipOut) {
length = clipOut == 1 ? 1 : clipOut + 1;
}
}
// Pass duration if it was forced
if (info.xml.hasAttribute(QStringLiteral("duration"))) {
duration = info.xml.attribute(QStringLiteral("duration")).toInt();
if (length < duration) {
length = duration;
if (clipOut > 0) clipOut = length - 1;
if (clipOut > 0) {
clipOut = length - 1;
}
}
}
if (duration == 0) duration = length;
......
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