[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdenlive] src: MLT's project profiles must be a multiple of 8, so enforce it when user tries to set
From: Jean-Baptiste Mardelle <jb () kdenlive ! org>
Date: 2015-12-31 23:31:31
Message-ID: E1aEmgt-0001HB-IU () scm ! kde ! org
[Download RAW message or body]
Git commit 9fe0c6526169ff33cf3352c277bd47d8d9bd002e by Jean-Baptiste Mardelle.
Committed on 31/12/2015 at 23:31.
Pushed by mardelle into branch 'master'.
MLT's project profiles must be a multiple of 8, so enforce it when user tries to set a incorrect value
CCBUG: 357326
M +5 -0 src/definitions.cpp
M +2 -0 src/definitions.h
M +12 -0 src/dialogs/profilesdialog.cpp
M +2 -0 src/dialogs/profilesdialog.h
M +1 -0 src/renderer.cpp
http://commits.kde.org/kdenlive/9fe0c6526169ff33cf3352c277bd47d8d9bd002e
diff --git a/src/definitions.cpp b/src/definitions.cpp
index 5a789e7..1dfc9f6 100644
--- a/src/definitions.cpp
+++ b/src/definitions.cpp
@@ -80,6 +80,11 @@ bool MltVideoProfile::operator==(const MltVideoProfile &point) const
point.colorspace == colorspace;
}
+void MltVideoProfile::adjustWidth()
+{
+ width = (width + 7) / 8 * 8;
+}
+
bool MltVideoProfile::operator!=(const MltVideoProfile &other) const {
return !(*this == other);
}
diff --git a/src/definitions.h b/src/definitions.h
index 8a41daa..ec7d2c4 100644
--- a/src/definitions.h
+++ b/src/definitions.h
@@ -242,6 +242,8 @@ public:
int display_aspect_num;
int display_aspect_den;
int colorspace;
+ // A profile's width should always be a multiple of 8
+ void adjustWidth();
MltVideoProfile();
bool operator==(const MltVideoProfile& point) const;
bool operator!=(const MltVideoProfile &other) const;
diff --git a/src/dialogs/profilesdialog.cpp b/src/dialogs/profilesdialog.cpp
index e1e5cec..e331fab 100644
--- a/src/dialogs/profilesdialog.cpp
+++ b/src/dialogs/profilesdialog.cpp
@@ -71,6 +71,8 @@ ProfilesDialog::ProfilesDialog(QWidget * parent) :
connect(m_view.progressive, SIGNAL(stateChanged(int)), this, SLOT(slotProfileEdited()));
connect(m_view.size_h, SIGNAL(valueChanged(int)), this, SLOT(slotProfileEdited()));
connect(m_view.size_w, SIGNAL(valueChanged(int)), this, SLOT(slotProfileEdited()));
+ connect(m_view.size_w, &QAbstractSpinBox::editingFinished, this, &ProfilesDialog::slotAdjustWidth);
+ m_view.size_w->setSingleStep(8);
}
@@ -112,6 +114,16 @@ ProfilesDialog::ProfilesDialog(QString profilePath, QWidget * parent) :
connect(m_view.progressive, SIGNAL(stateChanged(int)), this, SLOT(slotProfileEdited()));
connect(m_view.size_h, SIGNAL(valueChanged(int)), this, SLOT(slotProfileEdited()));
connect(m_view.size_w, SIGNAL(valueChanged(int)), this, SLOT(slotProfileEdited()));
+ connect(m_view.size_w, &QAbstractSpinBox::editingFinished, this, &ProfilesDialog::slotAdjustWidth);
+ m_view.size_w->setSingleStep(8);
+}
+
+void ProfilesDialog::slotAdjustWidth()
+{
+ // A profile's width should always be a multiple of 8
+ m_view.size_w->blockSignals(true);
+ m_view.size_w->setValue((m_view.size_w->value() + 7) / 8 * 8);
+ m_view.size_w->blockSignals(false);
}
void ProfilesDialog::slotProfileEdited()
diff --git a/src/dialogs/profilesdialog.h b/src/dialogs/profilesdialog.h
index 39caf49..14c0d9d 100644
--- a/src/dialogs/profilesdialog.h
+++ b/src/dialogs/profilesdialog.h
@@ -89,6 +89,8 @@ private slots:
void slotDeleteProfile();
void slotSetDefaultProfile();
void slotProfileEdited();
+ /** @brief Make sure the profile's width is always a multiple of 8 */
+ void slotAdjustWidth();
virtual void accept();
virtual void reject();
diff --git a/src/renderer.cpp b/src/renderer.cpp
index c951c1a..52925cc 100644
--- a/src/renderer.cpp
+++ b/src/renderer.cpp
@@ -614,6 +614,7 @@ void Render::processFileProperties()
blankProfile->from_producer(*producer);
MltVideoProfile clipProfile = ProfilesDialog::getVideoProfile(*blankProfile);
MltVideoProfile projectProfile = ProfilesDialog::getVideoProfile(*m_qmlView->profile());
+ clipProfile.adjustWidth();
if (clipProfile != projectProfile) {
// Profiles do not match, adjust profile
delete producer;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic