Git commit 9fe0c6526169ff33cf3352c277bd47d8d9bd002e by Jean-Baptiste Mardel= le. 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 tri= es 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=3D=3D(const MltVideoProfi= le &point) const point.colorspace =3D=3D colorspace; } = +void MltVideoProfile::adjustWidth() +{ + width =3D (width + 7) / 8 * 8; +} + bool MltVideoProfile::operator!=3D(const MltVideoProfile &other) const { return !(*this =3D=3D 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=3D=3D(const MltVideoProfile& point) const; bool operator!=3D(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(slot= ProfileEdited())); connect(m_view.size_h, SIGNAL(valueChanged(int)), this, SLOT(slotProfi= leEdited())); connect(m_view.size_w, SIGNAL(valueChanged(int)), this, SLOT(slotProfi= leEdited())); + connect(m_view.size_w, &QAbstractSpinBox::editingFinished, this, &Prof= ilesDialog::slotAdjustWidth); + m_view.size_w->setSingleStep(8); } = = @@ -112,6 +114,16 @@ ProfilesDialog::ProfilesDialog(QString profilePath, QW= idget * parent) : connect(m_view.progressive, SIGNAL(stateChanged(int)), this, SLOT(slot= ProfileEdited())); connect(m_view.size_h, SIGNAL(valueChanged(int)), this, SLOT(slotProfi= leEdited())); connect(m_view.size_w, SIGNAL(valueChanged(int)), this, SLOT(slotProfi= leEdited())); + connect(m_view.size_w, &QAbstractSpinBox::editingFinished, this, &Prof= ilesDialog::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 =3D ProfilesDialog::getVideoPr= ofile(*blankProfile); MltVideoProfile projectProfile =3D ProfilesDialog::getVide= oProfile(*m_qmlView->profile()); + clipProfile.adjustWidth(); if (clipProfile !=3D projectProfile) { // Profiles do not match, adjust profile delete producer;