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

Add recent MLT rotate feature to easily rotate a video clip from clip properties

parent 6e0ede64
Pipeline #126474 passed with stage
in 11 minutes and 47 seconds
......@@ -1251,10 +1251,10 @@ void ProjectClip::setProperties(const QMap<QString, QString> &properties, bool r
}
// Some properties also need to be passed to track producers
QStringList timelineProperties{
QStringLiteral("force_aspect_ratio"), QStringLiteral("set.force_full_luma"), QStringLiteral("full_luma"), QStringLiteral("threads"),
QStringLiteral("force_colorspace"), QStringLiteral("force_tff"), QStringLiteral("force_progressive"), QStringLiteral("video_delay")
QStringLiteral("force_aspect_ratio"), QStringLiteral("set.force_full_luma"), QStringLiteral("full_luma"), QStringLiteral("threads"),
QStringLiteral("force_colorspace"), QStringLiteral("force_tff"), QStringLiteral("force_progressive"), QStringLiteral("video_delay")
};
QStringList forceReloadProperties{QStringLiteral("autorotate"), QStringLiteral("templatetext"), QStringLiteral("resource"), QStringLiteral("force_fps"), QStringLiteral("set.test_image"), QStringLiteral("video_index"), QStringLiteral("disable_exif")};
QStringList forceReloadProperties{QStringLiteral("rotate"),QStringLiteral("autorotate"), QStringLiteral("templatetext"), QStringLiteral("resource"), QStringLiteral("force_fps"), QStringLiteral("set.test_image"), QStringLiteral("video_index"), QStringLiteral("disable_exif")};
QStringList keys{QStringLiteral("luma_duration"), QStringLiteral("luma_file"), QStringLiteral("fade"), QStringLiteral("ttl"), QStringLiteral("softness"), QStringLiteral("crop"), QStringLiteral("animation")};
QVector<int> updateRoles;
while (i.hasNext()) {
......
......@@ -302,10 +302,10 @@ bool ClipController::isValid()
const char *ClipController::getPassPropertiesList(bool passLength)
{
if (!passLength) {
return "kdenlive:proxy,kdenlive:originalurl,force_aspect_num,force_aspect_den,force_aspect_ratio,force_fps,force_progressive,force_tff,threads,force_"
return "kdenlive:proxy,kdenlive:originalurl,rotate,force_aspect_num,force_aspect_den,force_aspect_ratio,force_fps,force_progressive,force_tff,threads,force_"
"colorspace,set.force_full_luma,file_hash,autorotate,disable_exif,xmldata,video_index,audio_index,set.test_image,set.test_audio";
}
return "kdenlive:proxy,kdenlive:originalurl,force_aspect_num,force_aspect_den,force_aspect_ratio,force_fps,force_progressive,force_tff,threads,force_"
return "kdenlive:proxy,kdenlive:originalurl,rotate,force_aspect_num,force_aspect_den,force_aspect_ratio,force_fps,force_progressive,force_tff,threads,force_"
"colorspace,set.force_full_luma,templatetext,file_hash,autorotate,disable_exif,xmldata,length,video_index,audio_index,set.test_image,set.test_audio";
}
......
......@@ -596,6 +596,33 @@ ClipPropertiesController::ClipPropertiesController(ClipController *controller, Q
hlay->addWidget(box);
fpBox->addLayout(hlay);
// Rotate
int rotate = 0;
if (m_properties->property_exists("rotate")) {
rotate = m_properties->get_int("rotate");
m_originalProperties.insert(QStringLiteral("rotate"), QString::number(rotate));
}
hlay = new QHBoxLayout;
auto *label = new QLabel(i18n("Force rotate"), this);
combo = new QComboBox(this);
combo->setObjectName(QStringLiteral("rotate_value"));
combo->addItem(i18n("0"), 0);
combo->addItem(i18n("90"), 90);
combo->addItem(i18n("180"), 180);
combo->addItem(i18n("270"), 270);
if (rotate > 0) {
combo->setCurrentIndex(combo->findData(rotate));
}
// Disable force rotate when autorotate is disabled
combo->setEnabled(!box->isChecked());
connect(box, &QCheckBox::stateChanged, this, [combo](int state) {
combo->setEnabled(state != Qt::Unchecked);
});
connect(combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &ClipPropertiesController::slotComboValueChanged);
hlay->addWidget(label);
hlay->addWidget(combo);
fpBox->addLayout(hlay);
// Decoding threads
QString threads = m_properties->get("threads");
m_originalProperties.insert(QStringLiteral("threads"), threads);
......@@ -970,8 +997,8 @@ ClipPropertiesController::ClipPropertiesController(ClipController *controller, Q
box->setObjectName(QStringLiteral("set.force_full_luma"));
box->setChecked(!force_luma.isEmpty());
hlay->addWidget(box);
fpBox->addLayout(hlay);
hlay->addStretch(10);
fpBox->addLayout(hlay);
// Check for variable frame rate
if (m_properties->get_int("meta.media.variable_frame_rate")) {
......
......@@ -224,7 +224,6 @@ void ThumbnailCache::invalidateThumbsForClip(const QString &binId)
bool ok = false;
// Video thumbs
QDir thumbFolder = getDir(false, &ok);
//QDir audioThumbFolder = getDir(true, &ok);
if (ok && m_storedOnDisk.find(binId) != m_storedOnDisk.end()) {
// Remove persistent cache
for (int pos : m_storedOnDisk.at(binId)) {
......
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