void MainWindow::loadPlugins() {
- foreach (QObject *plugin, QPluginLoader::staticInstances())
- populateMenus(plugin);
+ foreach(QObject *plugin, QPluginLoader::staticInstances())
+ populateMenus(plugin);
QStringList directories = KGlobal::dirs()->findDirs("module", QString());
QStringList filters;
filters << "libkdenlive*";
foreach(const QString &folder, directories) {
- kDebug()<<"// PARSING FIOLER: "<<folder;
- QDir pluginsDir(folder);
- foreach (QString fileName, pluginsDir.entryList(filters, QDir::Files)) {
- kDebug()<<"// FOUND PLUGIN: "<<fileName<<"= "<<pluginsDir.absoluteFilePath(fileName);
- QPluginLoader loader(pluginsDir.absoluteFilePath(fileName));
- QObject *plugin = loader.instance();
- if (plugin) {
- populateMenus(plugin);
- m_pluginFileNames += fileName;
- }
- else kDebug()<<"// ERROR LOADING PLUGIN: "<<fileName<<", "<<loader.errorString ();
- }
+ kDebug() << "// PARSING FIOLER: " << folder;
+ QDir pluginsDir(folder);
+ foreach(QString fileName, pluginsDir.entryList(filters, QDir::Files)) {
+ kDebug() << "// FOUND PLUGIN: " << fileName << "= " << pluginsDir.absoluteFilePath(fileName);
+ QPluginLoader loader(pluginsDir.absoluteFilePath(fileName));
+ QObject *plugin = loader.instance();
+ if (plugin) {
+ populateMenus(plugin);
+ m_pluginFileNames += fileName;
+ } else kDebug() << "// ERROR LOADING PLUGIN: " << fileName << ", " << loader.errorString();
+ }
}
//exit(1);
}
-void MainWindow::populateMenus(QObject *plugin)
-{
- kDebug()<<"// POP MENU";
+void MainWindow::populateMenus(QObject *plugin) {
+ kDebug() << "// POP MENU";
QMenu *addMenu = static_cast<QMenu*>(factory()->container("generators", this));
ClipGenerator *iGenerator = qobject_cast<ClipGenerator *>(plugin);
- kDebug()<<"// POP MENU 2";
- if (addMenu) kDebug()<<"// POP MENU 3";
+ kDebug() << "// POP MENU 2";
+ if (addMenu) kDebug() << "// POP MENU 3";
if (iGenerator)
addToMenu(plugin, iGenerator->generators(), addMenu, SLOT(generateClip()),
- NULL);
+ NULL);
}
void MainWindow::addToMenu(QObject *plugin, const QStringList &texts,
- QMenu *menu, const char *member,
- QActionGroup *actionGroup)
-{
- kDebug()<<"// ADD to MENU"<<texts;
- foreach (QString text, texts) {
+ QMenu *menu, const char *member,
+ QActionGroup *actionGroup) {
+ kDebug() << "// ADD to MENU" << texts;
+ foreach(QString text, texts) {
QAction *action = new QAction(text, plugin);
connect(action, SIGNAL(triggered()), this, member);
menu->addAction(action);
}
}
-void MainWindow::aboutPlugins()
-{
+void MainWindow::aboutPlugins() {
//PluginDialog dialog(pluginsDir.path(), m_pluginFileNames, this);
//dialog.exec();
}
-void MainWindow::generateClip()
-{
+void MainWindow::generateClip() {
QAction *action = qobject_cast<QAction *>(sender());
ClipGenerator *iGenerator = qobject_cast<ClipGenerator *>(action->parent());
KUrl clipUrl = iGenerator->generatedClip(action->text(), m_activeDocument->projectFolder(), QStringList(), QStringList(), 25, 720, 576);
if (!clipUrl.isEmpty()) {
- m_projectList->slotAddClip(clipUrl);
+ m_projectList->slotAddClip(clipUrl);
}
}
void MainWindow::slotRenderProject() {
if (!m_renderWidget) {
m_renderWidget = new RenderWidget(this);
- connect(m_renderWidget, SIGNAL(doRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool, double, double)), this, SLOT(slotDoRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool, double, double)));
+ connect(m_renderWidget, SIGNAL(doRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool, double, double, bool)), this, SLOT(slotDoRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool, double, double, bool)));
if (m_activeDocument) {
m_renderWidget->setProfile(m_activeDocument->mltProfile());
m_renderWidget->setGuides(m_activeDocument->guidesXml(), m_activeDocument->projectDuration());
m_renderWidget->show();
}
-void MainWindow::slotDoRender(const QString &dest, const QString &render, const QStringList &overlay_args, const QStringList &avformat_args, bool zoneOnly, bool playAfter, double guideStart, double guideEnd) {
+void MainWindow::slotDoRender(const QString &dest, const QString &render, const QStringList &overlay_args, const QStringList &avformat_args, bool zoneOnly, bool playAfter, double guideStart, double guideEnd, bool resizeProfile) {
if (dest.isEmpty()) return;
int in;
int out;
KMessageBox::sorry(this, i18n("Cannot find the inigo program required for rendering (part of Mlt)"));
return;
}
- args << KdenliveSettings::rendererpath() << m_activeDocument->profilePath() << render << videoPlayer << temp.fileName() << dest << avformat_args;
+ args << KdenliveSettings::rendererpath() << m_activeDocument->profilePath() << render << videoPlayer;
+
+ for (int i = 0; i < avformat_args.count(); i++) {
+ if (avformat_args.at(i).startsWith("profile=")) {
+ if (avformat_args.at(i).section('=', 1) != m_activeDocument->profilePath()) resizeProfile = true;
+ break;
+ }
+ }
+
+ if (resizeProfile) {
+ // The rendering profile is different from project profile, so use MLT's special producer_consumer
+ args << "consumer:" + temp.fileName();
+ } else args << temp.fileName();
+ args << dest << avformat_args;
QString renderer = QCoreApplication::applicationDirPath() + QString("/kdenlive_render");
if (!QFile::exists(renderer)) renderer = "kdenlive_render";
QProcess::startDetached(renderer, args);
renderArgs.replace("%dar", "@" + QString::number(m_profile.display_aspect_num) + "/" + QString::number(m_profile.display_aspect_den));
if (m_view.force_progressive->checkState() == Qt::Checked) renderArgs.append(" progressive=1");
else if (m_view.force_progressive->checkState() == Qt::Unchecked) renderArgs.append(" progressive=0");
- emit doRender(m_view.out_file->url().path(), item->data(RenderRole).toString(), overlayargs, renderArgs.simplified().split(' '), m_view.render_zone->isChecked(), m_view.play_after->isChecked(), startPos, endPos);
+
+ // Check if the rendering profile is different from project profile,
+ // in which case we need to use the producer_comsumer from MLT
+ bool resizeProfile = false;
+
+ QString std = item->data(ParamsRole).toString();
+ if (resizeProfile == false && std.contains(" s=")) {
+ QString subsize = std.section(" s=", 1, 1);
+ subsize = subsize.section(' ', 0, 0).toLower();
+ if (subsize != "%widthx%height") {
+ const QString currentSize = QString::number(m_profile.width) + 'x' + QString::number(m_profile.height);
+ if (subsize != currentSize) resizeProfile = true;
+ }
+ }
+
+ emit doRender(m_view.out_file->url().path(), item->data(RenderRole).toString(), overlayargs, renderArgs.simplified().split(' '), m_view.render_zone->isChecked(), m_view.play_after->isChecked(), startPos, endPos, resizeProfile);
}
void RenderWidget::setProfile(MltVideoProfile profile) {