New export profiles file format, export is now working as expected

svn path=/branches/KDE4/; revision=2044
parent f4e1c8d9
......@@ -19,4 +19,4 @@ FIND_PACKAGE(LIBFFMPEG REQUIRED)
add_subdirectory(src src/cmake_bindir)
add_subdirectory(renderer renderer/cmake_bindir)
add_subdirectory(effects )
\ No newline at end of file
add_subdirectory(export )
\ No newline at end of file
INSTALL (FILES
profiles.xml
DESTINATION share/apps/kdenlive/export)
<profiles>
<group name="HDV" renderer="avformat" extension="m2t" type="av">
<profile name="PAL 1080 50i" standard="PAL" args="f=mpegts vcodec=mpeg2video s=1440x1080 b=19700k ab=384000 g=12 ildct=1 ilme=1 profile=hdv_1080_50i" />
<profile name="PAL 720 25p" standard="PAL" args="f=mpegts vcodec=mpeg2video s=1280x720 b=19700k ab=384000 g=12 profile=hdv_720_25p" />
<profile name="NTSC 1080 60i" standard="NTSC" args="f=mpegts vcodec=mpeg2video s=1440x1080 b=19700k ab=384000 g=15 ildct=1 ilme=1 profile=hdv_1080_60i" />
<profile name="NTSC 720 30p" standard="NTSC" args="f=mpegts vcodec=mpeg2video s=1280x720 b=19700k ab=384000 g=15 profile=hdv_720_30p" />
</group>
<group name="DV" renderer="avformat" type="av">
<profile name="PAL Raw" standard="PAL" extension="dv" args="f=dv ildct=1 pix_fmt=yuv420p s=720x576 profile=dv_pal" />
<profile name="PAL Raw DV50" standard="PAL" extension="dv" args="f=dv ildct=1 pix_fmt=yuv422p s=720x576 profile=dv_pal" />
<profile name="PAL AVI" standard="PAL" extension="avi" args="f=avi vcodec=dvvideo ildct=1 pix_fmt=yuv420p acodec=pcm_s16le s=720x576 profile=dv_pal" />
<profile name="PAL AVI DV50" standard="PAL" extension="avi" args="f=avi vcodec=dvvideo ildct=1 pix_fmt=yuv422p s=720x576 profile=dv_pal" />
<profile name="NTSC Raw" standard="NTSC" extension="dv" args="f=dv ildct=1 pix_fmt=yuv411p s=720x480 profile=dv_ntsc" />
<profile name="NTSC Raw DV50" standard="NTSC" extension="dv" args="f=dv ildct=1 pix_fmt=yuv422p s=720x480 profile=dv_ntsc" />
<profile name="NTSC AVI" standard="NTSC" extension="avi" args="f=avi vcodec=dvvideo ildct=1 pix_fmt=yuv411p acodec=pcm_s16le s=720x480 profile=dv_ntsc" />
<profile name="NTSC AVI DV50" standard="NTSC" extension="avi" args="f=avi vcodec=dvvideo ildct=1 pix_fmt=yuv422p s=720x480 profile=dv_ntsc" />
</group>
</profiles>
\ No newline at end of file
......@@ -483,7 +483,7 @@ void MainWindow::slotRenderProject() {
m_renderWidget->show();
}
void MainWindow::slotDoRender(const QString &dest, const QStringList &args, bool zoneOnly, bool playAfter) {
void MainWindow::slotDoRender(const QString &dest, const QStringList &avformat_args, bool zoneOnly, bool playAfter) {
if (dest.isEmpty()) return;
int in;
int out;
......@@ -502,7 +502,7 @@ void MainWindow::slotDoRender(const QString &dest, const QStringList &args, bool
if (zoneOnly) args << "in=" + QString::number(in) << "out=" + QString::number(out);
QString videoPlayer = "-";
if (playAfter) videoPlayer = "kmplayer";
args << "inigo" << videoPlayer << temp.fileName() << dest;
args << "inigo" << videoPlayer << temp.fileName() << dest << avformat_args;
QProcess::startDetached("kdenlive_render", args);
}
}
......@@ -561,7 +561,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
connect(effectStack, SIGNAL(changeEffectState(ClipItem*, QDomElement, bool)), trackView->projectView(), SLOT(slotChangeEffectState(ClipItem*, QDomElement, bool)));
connect(effectStack, SIGNAL(refreshEffectStack(ClipItem*)), trackView->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
m_activeTimeline = trackView;
if (m_renderWidget) m_renderWidget->setDocumentStandard(doc->getDocumentStandard());
m_monitorManager->setTimecode(doc->timecode());
doc->setRenderer(m_projectMonitor->render);
m_commandStack->setActiveStack(doc->commandStack());
......
......@@ -134,7 +134,7 @@ private slots:
void slotSwitchVideoThumbs();
void slotSwitchAudioThumbs();
void slotRenderProject();
void slotDoRender(const QString &dest, const QStringList &args, bool zoneOnly, bool playAfter);
void slotDoRender(const QString &dest, const QStringList &avformat_args, bool zoneOnly, bool playAfter);
};
#endif
......@@ -17,7 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include <QDir>
#include <QDomDocument>
#include <KStandardDirs>
#include <KDebug>
......@@ -26,11 +27,20 @@
#include "kdenlivesettings.h"
#include "renderwidget.h"
RenderWidget::RenderWidget(QWidget * parent): QDialog(parent) {
const int GroupRole = Qt::UserRole;
const int ExtensionRole = GroupRole + 1;
const int StandardRole = GroupRole + 2;
const int RenderRole = GroupRole + 3;
const int ParamsRole = GroupRole + 4;
RenderWidget::RenderWidget(QWidget * parent): QDialog(parent), m_standard("PAL") {
m_view.setupUi(this);
connect(m_view.buttonStart, SIGNAL(clicked()), this, SLOT(slotExport()));
connect(m_view.out_file, SIGNAL(textChanged(const QString &)), this, SLOT(slotUpdateButtons()));
connect(m_view.format_list, SIGNAL(currentRowChanged(int)), this, SLOT(refreshView()));
connect(m_view.size_list, SIGNAL(currentRowChanged(int)), this, SLOT(refreshParams()));
m_view.buttonStart->setEnabled(false);
parseProfiles();
}
void RenderWidget::slotUpdateButtons() {
......@@ -44,7 +54,122 @@ void RenderWidget::slotExport() {
if (KMessageBox::warningYesNo(this, i18n("File already exists. Doy you want to overwrite it ?")) != KMessageBox::Yes)
return;
}
emit doRender(m_view.out_file->url().path(), QStringList(), m_view.zone_only->isChecked(), m_view.play_after->isChecked());
emit doRender(m_view.out_file->url().path(), m_view.advanced_params->text().split(' '), m_view.zone_only->isChecked(), m_view.play_after->isChecked());
}
void RenderWidget::setDocumentStandard(QString std) {
m_standard = std;
refreshView();
}
void RenderWidget::refreshView() {
QListWidgetItem *item = m_view.format_list->currentItem();
if (!item) {
m_view.format_list->setCurrentRow(0);
item = m_view.format_list->currentItem();
}
if (!item) return;
QString std;
QString group = item->text();
QListWidgetItem *sizeItem;
bool firstSelected = false;
for (int i = 0; i < m_view.size_list->count(); i++) {
sizeItem = m_view.size_list->item(i);
std = sizeItem->data(StandardRole).toString();
if (!std.isEmpty() && !std.contains(m_standard, Qt::CaseInsensitive)) sizeItem->setHidden(true);
else if (sizeItem->data(GroupRole) == group) {
sizeItem->setHidden(false);
if (!firstSelected) m_view.size_list->setCurrentItem(sizeItem);
firstSelected = true;
} else sizeItem->setHidden(true);
}
}
void RenderWidget::refreshParams() {
QListWidgetItem *item = m_view.size_list->currentItem();
if (!item) return;
QString params = item->data(ParamsRole).toString();
QString extension = item->data(ExtensionRole).toString();
m_view.advanced_params->setText(params);
m_view.advanced_params->setToolTip(params);
KUrl url = m_view.out_file->url();
if (!url.isEmpty()) {
QString path = url.path();
int pos = path.lastIndexOf('.') + 1;
if (pos == 0) path.append('.') + extension;
else path = path.left(pos) + extension;
m_view.out_file->setUrl(KUrl(path));
} else {
m_view.out_file->setUrl(KUrl(QDir::homePath() + "/untitled." + extension));
}
}
void RenderWidget::parseProfiles() {
QString exportFile = KStandardDirs::locate("data", "kdenlive/export/profiles.xml");
QDomDocument doc;
QFile file(exportFile);
doc.setContent(&file, false);
QDomElement documentElement;
QDomElement profileElement;
QDomNodeList groups = doc.elementsByTagName("group");
if (groups.count() == 0) {
kDebug() << "// Export file: " << exportFile << " IS BROKEN";
return;
}
kDebug() << "// FOUND FFECT GROUP: " << groups.count() << " IS BROKEN";
int i = 0;
QString groupName;
QString profileName;
QString extension;
QString prof_extension;
QString renderer;
QString params;
QString standard;
QListWidgetItem *item;
while (!groups.item(i).isNull()) {
documentElement = groups.item(i).toElement();
groupName = documentElement.attribute("name", QString::null);
extension = documentElement.attribute("extension", QString::null);
renderer = documentElement.attribute("renderer", QString::null);
new QListWidgetItem(groupName, m_view.format_list);
QDomNode n = groups.item(i).firstChild();
while (!n.isNull()) {
profileElement = n.toElement();
profileName = profileElement.attribute("name");
standard = profileElement.attribute("standard");
params = profileElement.attribute("args");
prof_extension = profileElement.attribute("extension");
if (!prof_extension.isEmpty()) extension = prof_extension;
item = new QListWidgetItem(profileName, m_view.size_list);
item->setData(GroupRole, groupName);
item->setData(ExtensionRole, extension);
item->setData(RenderRole, renderer);
item->setData(StandardRole, standard);
item->setData(ParamsRole, params);
n = n.nextSibling();
}
i++;
/*
bool ladspaOk = true;
if (tag == "ladspa") {
QString library = documentElement.attribute("library", QString::null);
if (KStandardDirs::locate("ladspa_plugin", library).isEmpty()) ladspaOk = false;
}
// Parse effect file
if ((filtersList.contains(tag) || producersList.contains(tag)) && ladspaOk) {
bool isAudioEffect = false;
QDomNode propsnode = documentElement.elementsByTagName("properties").item(0);
if (!propsnode.isNull()) {
QDomElement propselement = propsnode.toElement();
*/
}
refreshView();
}
......
......@@ -31,13 +31,17 @@ class RenderWidget : public QDialog {
public:
RenderWidget(QWidget * parent = 0);
void setDocumentStandard(QString std);
private slots:
void slotUpdateButtons();
void slotExport();
void refreshView();
void refreshParams();
private:
Ui::RenderWidget_UI m_view;
QString m_standard;
void parseProfiles();
signals:
void doRender(const QString&, const QStringList &, bool, bool);
......
......@@ -5,12 +5,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>374</width>
<height>243</height>
<width>389</width>
<height>374</height>
</rect>
</property>
<property name="windowTitle" >
<string>Dialog</string>
<string>Rendering</string>
</property>
<layout class="QGridLayout" name="gridLayout_3" >
<item row="0" column="0" >
......@@ -20,102 +20,36 @@
</property>
</widget>
</item>
<item row="0" column="1" colspan="2" >
<item row="0" column="1" colspan="3" >
<widget class="KUrlRequester" name="out_file" />
</item>
<item row="1" column="0" colspan="3" >
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>Video Profile</string>
</property>
<layout class="QGridLayout" name="gridLayout_2" >
<item row="0" column="0" >
<widget class="KComboBox" name="export_profile" />
</item>
<item rowspan="2" row="0" column="1" >
<layout class="QGridLayout" name="gridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Image size:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLabel" name="label_size" >
<property name="text" >
<string>720x576</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Frame rate: </string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLabel" name="label_fps" >
<property name="text" >
<string>25</string>
</property>
</widget>
</item>
</layout>
</item>
<item rowspan="2" row="1" column="0" >
<spacer name="verticalSpacer" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1" >
<spacer name="verticalSpacer_2" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>6</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="2" >
<item row="2" column="0" colspan="3" >
<widget class="QCheckBox" name="zone_only" >
<property name="text" >
<string>Selected zone only</string>
</property>
</widget>
</item>
<item row="2" column="2" >
<item row="2" column="3" >
<widget class="QCheckBox" name="play_after" >
<property name="text" >
<string>Play after render</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QCheckBox" name="enable_params" >
<property name="text" >
<string>Parameters</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2" >
<widget class="KLineEdit" name="av_params" />
<item row="3" column="0" colspan="4" >
<layout class="QHBoxLayout" name="horizontalLayout" >
<item>
<widget class="QCheckBox" name="enable_params" >
<property name="text" >
<string>Extra parameters</string>
</property>
</widget>
</item>
<item>
<widget class="KLineEdit" name="av_params" />
</item>
</layout>
</item>
<item row="4" column="0" >
<widget class="KPushButton" name="buttonStart" >
......@@ -124,7 +58,20 @@
</property>
</widget>
</item>
<item row="4" column="1" colspan="2" >
<item row="4" column="1" >
<spacer name="horizontalSpacer" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>153</width>
<height>27</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="2" colspan="2" >
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
......@@ -134,24 +81,81 @@
</property>
</widget>
</item>
<item row="1" column="0" colspan="4" >
<widget class="KTabWidget" name="ktabwidget" >
<property name="currentIndex" >
<number>0</number>
</property>
<widget class="QWidget" name="tab_2" >
<attribute name="title" >
<string>Templates</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4" >
<item row="0" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Format</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="KListWidget" name="format_list" />
</item>
<item row="1" column="1" colspan="4" >
<widget class="KListWidget" name="size_list" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3" >
<widget class="KLineEdit" name="advanced_params" />
</item>
<item row="2" column="3" >
<widget class="QToolButton" name="buttonSave" >
<property name="text" >
<string>S</string>
</property>
</widget>
</item>
<item row="2" column="4" >
<widget class="QToolButton" name="buttonDelete" >
<property name="text" >
<string>D</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
<customwidget>
<class>KListWidget</class>
<extends>QListWidget</extends>
<header>klistwidget.h</header>
</customwidget>
<customwidget>
<class>KPushButton</class>
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
<customwidget>
<class>KTabWidget</class>
<extends>QTabWidget</extends>
<header>ktabwidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KUrlRequester</class>
<extends>QFrame</extends>
......
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