Commit c8bbbd43 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Adding export GUI

This only allows redering resolution choosing at the moment
parent b8528548
...@@ -38,6 +38,7 @@ SET(VLMC_SRCS ...@@ -38,6 +38,7 @@ SET(VLMC_SRCS
Gui/TagWidget.cpp Gui/TagWidget.cpp
Gui/UndoStack.cpp Gui/UndoStack.cpp
Gui/WorkflowFileRendererDialog.cpp Gui/WorkflowFileRendererDialog.cpp
Gui/export/RendererSettings.cpp
Gui/import/ImportController.cpp Gui/import/ImportController.cpp
Gui/import/ImportMediaCellView.cpp Gui/import/ImportMediaCellView.cpp
Gui/import/ImportMediaListController.cpp Gui/import/ImportMediaListController.cpp
...@@ -118,6 +119,7 @@ SET (VLMC_HDRS ...@@ -118,6 +119,7 @@ SET (VLMC_HDRS
Gui/ClickableLabel.h Gui/ClickableLabel.h
Gui/ClipProperty.h Gui/ClipProperty.h
Gui/DockWidgetManager.h Gui/DockWidgetManager.h
Gui/export/RendererSettings.h
Gui/FileInfoListModel.h Gui/FileInfoListModel.h
Gui/import/ImportController.h Gui/import/ImportController.h
Gui/import/ImportMediaCellView.h Gui/import/ImportMediaCellView.h
...@@ -184,6 +186,7 @@ SET (VLMC_HDRS ...@@ -184,6 +186,7 @@ SET (VLMC_HDRS
) )
SET(VLMC_UIS SET(VLMC_UIS
Gui/export/RendererSettings.ui
Gui/import/ui/ImportController.ui Gui/import/ui/ImportController.ui
Gui/library/StackViewNavController.ui Gui/library/StackViewNavController.ui
Gui/library/ui/MediaCellView.ui Gui/library/ui/MediaCellView.ui
......
...@@ -376,17 +376,12 @@ void MainWindow::on_actionRender_triggered() ...@@ -376,17 +376,12 @@ void MainWindow::on_actionRender_triggered()
QMessageBox::warning( NULL, tr ( "VLMC Renderer" ), tr( "There is nothing to render." ) ); QMessageBox::warning( NULL, tr ( "VLMC Renderer" ), tr( "There is nothing to render." ) );
return ; return ;
} }
QString outputFileName =
QFileDialog::getSaveFileName( NULL, tr ( "Enter the output file name" ),
QDir::currentPath(), "Videos(*.avi *.mpg)" );
if ( outputFileName.length() == 0 )
return ;
else else
{ {
m_renderer->killRenderer(); m_renderer->killRenderer();
if ( m_fileRenderer ) if ( m_fileRenderer )
delete m_fileRenderer; delete m_fileRenderer;
m_fileRenderer = new WorkflowFileRenderer( outputFileName ); m_fileRenderer = new WorkflowFileRenderer();
m_fileRenderer->initializeRenderer(); m_fileRenderer->initializeRenderer();
m_fileRenderer->run(); m_fileRenderer->run();
} }
......
/*****************************************************************************
* RendererSettings.cpp: Edit the output file parameters
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "RendererSettings.h"
#include "SettingsManager.h"
#include "ui_RendererSettings.h"
#include <QFileDialog>
#include <QMessageBox>
RendererSettings::RendererSettings()
{
m_ui.setupUi( this );
connect( m_ui.outputFileNameButton, SIGNAL(clicked() ),
this, SLOT(selectOutputFileName() ) );
const SettingValue *width = SettingsManager::getInstance()->getValue( "project",
"VideoProjectWidth" );
const SettingValue *height = SettingsManager::getInstance()->getValue( "project",
"VideoProjectHeight" );
const SettingValue *outputFps = SettingsManager::getInstance()->getValue( "VLMC",
"VLMCOutPutFPS" );
m_ui.width->setValue( width->get().toInt() );
m_ui.height->setValue( height->get().toInt() );
m_ui.fps->setValue( outputFps->get().toDouble() );
}
void
RendererSettings::selectOutputFileName()
{
QString outputFileName =
QFileDialog::getSaveFileName( NULL, tr ( "Enter the output file name" ),
QDir::currentPath(), "Videos(*.avi *.mpg)" );
m_ui.outputFileName->setText( outputFileName );
}
void
RendererSettings::accept()
{
if ( width() <= 0 || height() <= 0 || outputFileName().isEmpty() == true ||
fps() <= .0f )
{
QMessageBox::warning( this, "Invalid parameters",
"Please enter valid rendering parameters" );
}
else
QDialog::accept();
}
quint32
RendererSettings::width() const
{
return m_ui.width->value();
}
quint32
RendererSettings::height() const
{
return m_ui.height->value();
}
double
RendererSettings::fps() const
{
return m_ui.fps->value();
}
quint32
RendererSettings::videoBitrate() const
{
return m_ui.videoQuality->value();
}
quint32
RendererSettings::audioBitrate() const
{
return m_ui.audioQuality->value();
}
QString
RendererSettings::outputFileName() const
{
return m_ui.outputFileName->text();
}
/*****************************************************************************
* RendererSettings.h: Edit the output file parameters
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef RENDERERSETTINGS_H
#define RENDERERSETTINGS_H
#include <QDialog>
#include "ui_RendererSettings.h"
class RendererSettings : public QDialog
{
Q_OBJECT
public:
RendererSettings();
quint32 width() const;
quint32 height() const;
double fps() const;
quint32 videoBitrate() const;
quint32 audioBitrate() const;
QString outputFileName() const;
private slots:
void selectOutputFileName();
virtual void accept();
private:
Ui::RendererSettings m_ui;
};
#endif // RENDERERSETTINGS_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>RendererSettings</class>
<widget class="QDialog" name="RendererSettings">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Output file</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="outputFileName"/>
</item>
<item>
<widget class="QPushButton" name="outputFileNameButton">
<property name="text">
<string>Select...</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Width</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="width">
<property name="minimum">
<number>320</number>
</property>
<property name="maximum">
<number>1920</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Height</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="height">
<property name="minimum">
<number>200</number>
</property>
<property name="maximum">
<number>1080</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>FPS</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="fps">
<property name="enabled">
<bool>false</bool>
</property>
<property name="value">
<double>29.969999999999999</double>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Video quality</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Audio quality</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QSlider" name="audioQuality">
<property name="minimum">
<number>8</number>
</property>
<property name="maximum">
<number>512</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Video codec</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="videoCodec">
<property name="enabled">
<bool>false</bool>
</property>
<item>
<property name="text">
<string>H264</string>
</property>
</item>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Audio codec</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QComboBox" name="audioCodec">
<property name="enabled">
<bool>false</bool>
</property>
<item>
<property name="text">
<string>AAC</string>
</property>
</item>
</widget>
</item>
<item row="9" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="8" 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="4" column="1">
<widget class="QSlider" name="videoQuality">
<property name="minimum">
<number>8</number>
</property>
<property name="maximum">
<number>8192</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>RendererSettings</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>RendererSettings</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
...@@ -26,12 +26,12 @@ ...@@ -26,12 +26,12 @@
#include "VLCMedia.h" #include "VLCMedia.h"
#include "LightVideoFrame.h" #include "LightVideoFrame.h"
#include "VLCMediaPlayer.h" #include "VLCMediaPlayer.h"
#include "export/RendererSettings.h"
#include <QTime> #include <QTime>
WorkflowFileRenderer::WorkflowFileRenderer( const QString& outputFileName ) : WorkflowFileRenderer::WorkflowFileRenderer() :
WorkflowRenderer(), WorkflowRenderer(),
m_outputFileName( outputFileName ),
m_image( NULL ) m_image( NULL )
{ {
} }
...@@ -47,10 +47,23 @@ void WorkflowFileRenderer::run() ...@@ -47,10 +47,23 @@ void WorkflowFileRenderer::run()
m_mainWorkflow->setCurrentFrame( 0, MainWorkflow::Renderer ); m_mainWorkflow->setCurrentFrame( 0, MainWorkflow::Renderer );
m_width = width(); //Setup dialog box for querying render parameters.
m_height = height(); RendererSettings *settings = new RendererSettings;
m_outputFps = 30.0; if ( settings->exec() == QDialog::Rejected )
setupRenderer( m_width, m_height, m_outputFps ); {
delete settings;
return ;
}
m_outputFileName = settings->outputFileName();
quint32 width = settings->width();
quint32 height = settings->height();
double fps = settings->fps();
quint32 vbitrate = settings->videoBitrate();
quint32 abitrate = settings->audioBitrate();
delete settings;
setupRenderer( width, height, fps );
setupDialog( width, height );
//Media as already been created and mainly initialized by the WorkflowRenderer //Media as already been created and mainly initialized by the WorkflowRenderer
QString transcodeStr = ":sout=#transcode{vcodec=h264,vb=800,acodec=a52,ab=128,no-hurry-up}" QString transcodeStr = ":sout=#transcode{vcodec=h264,vb=800,acodec=a52,ab=128,no-hurry-up}"
...@@ -73,10 +86,8 @@ void WorkflowFileRenderer::run() ...@@ -73,10 +86,8 @@ void WorkflowFileRenderer::run()
m_pts = 0; m_pts = 0;
m_audioPts = 0; m_audioPts = 0;
setupDialog();
m_mainWorkflow->setFullSpeedRender( true ); m_mainWorkflow->setFullSpeedRender( true );
m_mainWorkflow->startRender( m_width, m_height ); m_mainWorkflow->startRender( width, height );
m_mediaPlayer->play(); m_mediaPlayer->play();
} }
...@@ -120,22 +131,26 @@ WorkflowFileRenderer::lock( void *datas, qint64 *dts, qint64 *pts, quint32 *flag ...@@ -120,22 +131,26 @@ WorkflowFileRenderer::lock( void *datas, qint64 *dts, qint64 *pts, quint32 *flag
return ret; return ret;
} }
void WorkflowFileRenderer::unlock( void *datas, size_t size, void* buff ) void
WorkflowFileRenderer::unlock( void *datas, size_t size, void* buff )
{ {
WorkflowRenderer::unlock( datas, size, buff ); WorkflowRenderer::unlock( datas, size, buff );
} }
void WorkflowFileRenderer::__frameChanged( qint64 frame, MainWorkflow::FrameChangedReason ) void
WorkflowFileRenderer::__frameChanged( qint64 frame, MainWorkflow::FrameChangedReason )
{ {
m_dialog->setProgressBarValue( frame * 100 / m_mainWorkflow->getLengthFrame() ); m_dialog->setProgressBarValue( frame * 100 / m_mainWorkflow->getLengthFrame() );
} }
void* WorkflowFileRenderer::getLockCallback() void*
WorkflowFileRenderer::getLockCallback()
{ {
return (void*)&WorkflowFileRenderer::lock; return (void*)&WorkflowFileRenderer::lock;
} }
void* WorkflowFileRenderer::getUnlockCallback() void*
WorkflowFileRenderer::getUnlockCallback()
{ {
return (void*)&WorkflowFileRenderer::unlock; return (void*)&WorkflowFileRenderer::unlock;
} }
...@@ -157,9 +172,9 @@ WorkflowFileRenderer::height() const ...@@ -157,9 +172,9 @@ WorkflowFileRenderer::height() const
} }
void void
WorkflowFileRenderer::setupDialog() WorkflowFileRenderer::setupDialog( quint32 width, quint32 height )
{ {
m_dialog = new WorkflowFileRendererDialog( m_width, m_height ); m_dialog = new WorkflowFileRendererDialog( width, height );
m_dialog->setModal( true ); m_dialog->setModal( true );
m_dialog->setOutputFileName( m_outputFileName ); m_dialog->setOutputFileName( m_outputFileName );
connect( m_dialog->m_ui.cancelButton, SIGNAL( clicked() ), this, SLOT( cancelButtonClicked() ) ); connect( m_dialog->m_ui.cancelButton, SIGNAL( clicked() ), this, SLOT( cancelButtonClicked() ) );
......
...@@ -35,7 +35,7 @@ class WorkflowFileRenderer : public WorkflowRenderer ...@@ -35,7 +35,7 @@ class WorkflowFileRenderer : public WorkflowRenderer
Q_DISABLE_COPY( WorkflowFileRenderer ) Q_DISABLE_COPY( WorkflowFileRenderer )
public: public:
WorkflowFileRenderer( const QString& outputFileName ); WorkflowFileRenderer();
virtual ~WorkflowFileRenderer(); virtual ~WorkflowFileRenderer();
static int lock( void* datas, qint64 *dts, qint64 *pts, quint32 *flags, static int lock( void* datas, qint64 *dts, qint64 *pts, quint32 *flags,
...@@ -46,9 +46,10 @@ public: ...@@ -46,9 +46,10 @@ public:
virtual float getFps() const; virtual float getFps() const;
private: private:
void setupDialog(); void setupDialog( quint32 width, quint32 height );
private: private:
const QString m_outputFileName; QString m_outputFileName;
WorkflowFileRendererDialog* m_dialog; WorkflowFileRendererDialog* m_dialog;
QImage* m_image; QImage* m_image;
QTime m_time; QTime m_time;
......
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