]> git.sesse.net Git - kdenlive/commitdiff
New export profiles file format, export is now working as expected
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 10 Mar 2008 21:01:01 +0000 (21:01 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 10 Mar 2008 21:01:01 +0000 (21:01 +0000)
svn path=/branches/KDE4/; revision=2044

CMakeLists.txt
export/CMakeLists.txt [new file with mode: 0644]
export/profiles.xml [new file with mode: 0644]
src/mainwindow.cpp
src/mainwindow.h
src/renderwidget.cpp
src/renderwidget.h
src/widgets/renderwidget_ui.ui

index 16ed5d0fd2e67ade097878e63623345f66000eb7..cc2e6c7c2f821db31b3493d0067961c7fd6b7446 100644 (file)
@@ -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
diff --git a/export/CMakeLists.txt b/export/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e6a43c2
--- /dev/null
@@ -0,0 +1,5 @@
+INSTALL (FILES 
+
+profiles.xml
+
+DESTINATION share/apps/kdenlive/export)
diff --git a/export/profiles.xml b/export/profiles.xml
new file mode 100644 (file)
index 0000000..d516b48
--- /dev/null
@@ -0,0 +1,20 @@
+<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
index 8852041b491bb0be85bdbaa672801f5f5c2fac3b..b579101d90f3194ad2ab2c52fad8d4327449eb4d 100644 (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());
index a284aef01d055ddecbea69a84e816e0336b5a2cd..4f0cee8c1b5a4dfc56673e40709c5dedab6a9b4e 100644 (file)
@@ -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
index 14968532f309c61d88f7ebe4e1df287f8d864062..8cb2cfc1acf39d6c1c208762b9069b148f40f91f 100644 (file)
@@ -17,7 +17,8 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
  ***************************************************************************/
 
-#include <QDir>
+
+#include <QDomDocument>
 
 #include <KStandardDirs>
 #include <KDebug>
 #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();
 }
 
 
index 55324e782c134c9ff1165676f3183f2f2d73bb88..2bbed5ffc7c62d8fdd4d8b90f5ac4ad66f35d499 100644 (file)
@@ -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);
index e8c076f2811fe9b754cc085d059a52cc6a551a98..6566530f3ea93c886936c779a4f9c9dc0829f0d5 100644 (file)
@@ -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" >
      </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" >
      </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>
      </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>