#include "kdenlivesettings.h"
#include "ui_saveprofile_ui.h"
#include "timecode.h"
+#include "profilesdialog.h"
#include <KStandardDirs>
#include <KDebug>
RenderWidget::RenderWidget(const QString &projectfolder, bool enableProxy, QWidget * parent) :
QDialog(parent),
m_projectFolder(projectfolder),
- m_blockProcessing(false)
+ m_blockProcessing(false),
+ m_isPal(true)
{
m_view.setupUi(this);
setWindowTitle(i18n("Rendering"));
m_view.proxy_render->setHidden(!enableProxy);
- m_view.encoder_threads->setMaximum(QThread::idealThreadCount());
- m_view.encoder_threads->setValue(KdenliveSettings::encodethreads());
- connect(m_view.encoder_threads, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateEncodeThreads(int)));
-
+ m_view.encoder_threads->setMaximum(QThread::idealThreadCount());
+ m_view.encoder_threads->setValue(KdenliveSettings::encodethreads());
+ connect(m_view.encoder_threads, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateEncodeThreads(int)));
+
m_view.rescale_keep->setChecked(KdenliveSettings::rescalekeepratio());
connect(m_view.rescale_width, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateRescaleWidth(int)));
connect(m_view.rescale_height, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateRescaleHeight(int)));
connect(m_view.guide_end, SIGNAL(activated(int)), this, SLOT(slotCheckStartGuidePosition()));
connect(m_view.guide_start, SIGNAL(activated(int)), this, SLOT(slotCheckEndGuidePosition()));
- connect(m_view.format_selection, SIGNAL(activated(int)), this, SLOT(refreshView()));
connect(m_view.tc_overlay, SIGNAL(toggled(bool)), m_view.tc_type, SLOT(setEnabled(bool)));
m_view.buttonRender->setEnabled(false);
bool resizeProfile = (subsize != currentSize);
QStringList paramsList = renderArgs.split(" ", QString::SkipEmptyParts);
for (int i = 0; i < paramsList.count(); i++) {
- if (paramsList.at(i).startsWith("profile=")) {
+ if (paramsList.at(i).startsWith("mlt_profile=")) {
if (paramsList.at(i).section('=', 1) != m_profile.path) resizeProfile = true;
break;
}
if (group == "dvd") {
if (m_view.open_dvd->isChecked()) {
renderItem->setData(0, Qt::UserRole, group);
- if (renderArgs.contains("profile=")) {
+ if (renderArgs.contains("mlt_profile=")) {
// rendering profile contains an MLT profile, so pass it to the running jog item, useful for dvd
- QString prof = renderArgs.section("profile=", 1, 1);
+ QString prof = renderArgs.section("mlt_profile=", 1, 1);
prof = prof.section(' ', 0, 0);
kDebug() << "// render profile: " << prof;
renderItem->setData(0, Qt::UserRole + 1, prof);
m_profile = profile;
//WARNING: this way to tell the video standard is a bit hackish...
if (m_profile.description.contains("pal", Qt::CaseInsensitive) || m_profile.description.contains("25", Qt::CaseInsensitive) || m_profile.description.contains("50", Qt::CaseInsensitive))
- m_view.format_selection->setCurrentIndex(0);
+ m_isPal = true;
else
- m_view.format_selection->setCurrentIndex(1);
+ m_isPal = false;
m_view.scanning_list->setCurrentIndex(0);
m_view.rescale_width->setValue(KdenliveSettings::defaultrescalewidth());
if (!m_view.rescale_keep->isChecked()) {
if (m_view.destination_list->currentIndex() > 0)
destination = m_view.destination_list->itemData(m_view.destination_list->currentIndex()).toString();
KIcon brokenIcon("dialog-close");
+ KIcon warningIcon("dialog-warning");
if (m_view.format_list->currentItem()->data(TwoPassRole).canConvert(QVariant::Bool))
m_view.checkTwoPass->setEnabled(m_view.format_list->currentItem()->data(TwoPassRole).toBool());
const QColor disabled = scheme.foreground(KColorScheme::InactiveText).color();
const QColor disabledbg = scheme.background(KColorScheme::NegativeBackground).color();
-
+ double project_framerate = (double) m_profile.frame_rate_num / m_profile.frame_rate_den;
for (int i = 0; i < m_renderItems.count(); i++) {
sizeItem = m_renderItems.at(i);
QListWidgetItem *dupItem = NULL;
if ((sizeItem->data(GroupRole).toString() == group || sizeItem->data(GroupRole).toString().isEmpty()) && sizeItem->data(MetaGroupRole).toString() == destination) {
std = sizeItem->data(StandardRole).toString();
if (!std.isEmpty()) {
- if (std.contains("PAL", Qt::CaseInsensitive) && m_view.format_selection->currentIndex() == 0) dupItem = sizeItem->clone();
- else if (std.contains("NTSC", Qt::CaseInsensitive) && m_view.format_selection->currentIndex() == 1) dupItem = sizeItem->clone();
+ if (std.contains("PAL", Qt::CaseInsensitive) && m_isPal) dupItem = sizeItem->clone();
+ else if (std.contains("NTSC", Qt::CaseInsensitive) && !m_isPal) dupItem = sizeItem->clone();
} else {
dupItem = sizeItem->clone();
}
if (dupItem) {
m_view.size_list->addItem(dupItem);
- // Make sure the selected profile uses an installed avformat codec / format
std = dupItem->data(ParamsRole).toString();
+ // Make sure the selected profile uses the same frame rate as project profile
+ if (std.contains("mlt_profile=")) {
+ QString profile = std.section("mlt_profile=", 1, 1).section(' ', 0, 0);
+ MltVideoProfile p = ProfilesDialog::getVideoProfile(profile);
+ if (p.frame_rate_den > 0) {
+ double profile_rate = (double) p.frame_rate_num / p.frame_rate_den;
+ if ((int) (1000.0 * profile_rate) != (int) (1000.0 * project_framerate)) {
+ dupItem->setToolTip(i18n("Frame rate (%1) not compatible with project profile (%2)", profile_rate, project_framerate));
+ dupItem->setIcon(brokenIcon);
+ dupItem->setForeground(disabled);
+ }
+ }
+ }
+
+ // Make sure the selected profile uses an installed avformat codec / format
if (!formatsList.isEmpty()) {
QString format;
if (std.startsWith("f=")) format = std.section("f=", 1, 1);
if (!formatsList.contains(format)) {
kDebug() << "***** UNSUPPORTED F: " << format;
//sizeItem->setHidden(true);
- //sizeItem->setFlags(Qt::ItemIsSelectable);
+ //sizeItem-item>setFlags(Qt::ItemIsSelectable);
dupItem->setToolTip(i18n("Unsupported video format: %1", format));
dupItem->setIcon(brokenIcon);
dupItem->setForeground(disabled);
}
}
}
+ if (std.contains(" profile=") || std.startsWith("profile=")) {
+ // changed in MLT commit d8a3a5c9190646aae72048f71a39ee7446a3bd45
+ // (http://www.mltframework.org/gitweb/mlt.git?p=mltframework.org/mlt.git;a=commit;h=d8a3a5c9190646aae72048f71a39ee7446a3bd45)
+ dupItem->setToolTip(i18n("This render profile uses a 'profile' parameter.<br />Unless you know what you are doing you will probably have to change it to 'mlt_profile'."));
+ dupItem->setIcon(warningIcon);
+ }
}
}
}
{
// Format not available (e.g. codec not installed); Disable start button
QListWidgetItem *item = m_view.size_list->currentItem();
+ errorMessage(item->toolTip());
if (!item || item->isHidden()) {
m_view.advanced_params->clear();
m_view.buttonRender->setEnabled(false);
} else m_view.errorBox->setHidden(true);
}
+void RenderWidget::errorMessage(const QString &message)
+{
+ if (!message.isEmpty()) {
+ m_view.errorLabel->setText(message);
+ m_view.errorBox->setHidden(false);
+ }
+ else {
+ m_view.errorBox->setHidden(true);
+ m_view.errorLabel->setText(QString());
+ }
+}
+
+
void RenderWidget::slotUpdateEncodeThreads(int val)
{
KdenliveSettings::setEncodethreads(val);