[vlmc-devel] [PATCH 12/12] WorkflowRenderer: Pass nbChannels and sampleRate to startRenderToFile()
Yikai Lu
luyikei.qmltu at gmail.com
Sun May 22 08:36:56 CEST 2016
---
src/Gui/MainWindow.cpp | 10 ++++++---
src/Gui/MainWindow.h | 5 +++--
src/Gui/export/RendererSettings.cpp | 14 ++++++++++++
src/Gui/export/RendererSettings.h | 2 ++
src/Gui/export/RendererSettings.ui | 43 +++++++++++++++++++++++++++++++------
src/Renderer/ConsoleRenderer.cpp | 4 +++-
src/Renderer/WorkflowRenderer.cpp | 5 ++++-
src/Renderer/WorkflowRenderer.h | 3 ++-
8 files changed, 72 insertions(+), 14 deletions(-)
diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index 79ee286..0937fd0 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -606,7 +606,8 @@ MainWindow::checkVideoLength()
bool
MainWindow::renderVideo( const QString& outputFileName, quint32 width, quint32 height,
double fps, const QString& ar,
- quint32 vbitrate, quint32 abitrate )
+ quint32 vbitrate, quint32 abitrate,
+ quint32 nbChannels, quint32 sampleRate )
{
WorkflowFileRendererDialog dialog( width, height );
dialog.setModal( true );
@@ -614,7 +615,8 @@ MainWindow::renderVideo( const QString& outputFileName, quint32 width, quint32 h
if ( m_projectPreview->getAbstractRenderer()->isRendering() == true )
m_projectPreview->stop();
Core::instance()->workflowRenderer()->startRenderToFile( outputFileName, width, height,
- fps, ar, vbitrate, abitrate );
+ fps, ar, vbitrate, abitrate,
+ nbChannels, sampleRate );
if ( dialog.exec() == QDialog::Rejected )
return false;
@@ -638,8 +640,10 @@ MainWindow::renderVideoSettings( bool shareOnInternet )
quint32 vbitrate = settings.videoBitrate();
quint32 abitrate = settings.audioBitrate();
auto ar = settings.aspectRatio();
+ auto nbChannels = settings.nbChannels();
+ auto sampleRate = settings.sampleRate();
- return renderVideo( outputFileName, width, height, fps, ar, vbitrate, abitrate );
+ return renderVideo( outputFileName, width, height, fps, ar, vbitrate, abitrate, nbChannels, sampleRate );
}
QDockWidget*
diff --git a/src/Gui/MainWindow.h b/src/Gui/MainWindow.h
index 8f97d3a..85b3662 100644
--- a/src/Gui/MainWindow.h
+++ b/src/Gui/MainWindow.h
@@ -108,12 +108,13 @@ private:
/**
* \brief Renders video by the parameters: outputFileName, width, height,
- * fps, vbitrate, abitrate
+ * fps, vbitrate, abitrate, nbChannels, sampleRate
* Also, displays a rendering dialog with snapshots and progress.
* \return true if video renders well or not cancelled by the user.
*/
bool renderVideo( const QString& outputFileName, quint32 width, quint32 height,
- double fps, const QString& ar, quint32 vbitrate, quint32 abitrate );
+ double fps, const QString& ar, quint32 vbitrate, quint32 abitrate,
+ quint32 nbChannels, quint32 sampleRate );
/**
* \brief Gets video parameters from RendererSettings Dialog
diff --git a/src/Gui/export/RendererSettings.cpp b/src/Gui/export/RendererSettings.cpp
index 1a14a94..d805ca1 100644
--- a/src/Gui/export/RendererSettings.cpp
+++ b/src/Gui/export/RendererSettings.cpp
@@ -53,6 +53,8 @@ RendererSettings::RendererSettings( bool shareOnInternet )
m_ui.fps->setValue( project->fps() );
m_ui.videoQuality->setValue( project->videoBitrate() );
m_ui.audioQuality->setValue( project->audioBitrate() );
+ m_ui.nbChannels->setValue( project->nbChannels() );
+ m_ui.sampleRate->setValue( project->sampleRate() );
QCompleter* completer = new QCompleter( this );
completer->setModel( new QDirModel( completer ) );
@@ -171,6 +173,18 @@ RendererSettings::aspectRatio() const
}
quint32
+RendererSettings::nbChannels() const
+{
+ return m_ui.nbChannels->value();
+}
+
+quint32
+RendererSettings::sampleRate() const
+{
+ return m_ui.sampleRate->value();
+}
+
+quint32
RendererSettings::videoBitrate() const
{
return m_ui.videoQuality->value();
diff --git a/src/Gui/export/RendererSettings.h b/src/Gui/export/RendererSettings.h
index 025979d..2cbd257 100644
--- a/src/Gui/export/RendererSettings.h
+++ b/src/Gui/export/RendererSettings.h
@@ -50,6 +50,8 @@ class RendererSettings : public QDialog
quint32 height() const;
double fps() const;
QString aspectRatio() const;
+ quint32 nbChannels() const;
+ quint32 sampleRate() const;
quint32 videoBitrate() const;
quint32 audioBitrate() const;
QString outputFileName() const;
diff --git a/src/Gui/export/RendererSettings.ui b/src/Gui/export/RendererSettings.ui
index dcfaa08..3de1f94 100644
--- a/src/Gui/export/RendererSettings.ui
+++ b/src/Gui/export/RendererSettings.ui
@@ -138,14 +138,14 @@
</property>
</widget>
</item>
- <item row="7" column="0">
+ <item row="9" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Video Codec</string>
</property>
</widget>
</item>
- <item row="7" column="1">
+ <item row="9" column="1">
<widget class="QComboBox" name="videoCodec">
<property name="enabled">
<bool>false</bool>
@@ -157,14 +157,14 @@
</item>
</widget>
</item>
- <item row="8" column="0">
+ <item row="10" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Audio Codec</string>
</property>
</widget>
</item>
- <item row="8" column="1">
+ <item row="10" column="1">
<widget class="QComboBox" name="audioCodec">
<property name="enabled">
<bool>false</bool>
@@ -176,7 +176,7 @@
</item>
</widget>
</item>
- <item row="10" column="0" colspan="2">
+ <item row="12" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -186,7 +186,7 @@
</property>
</widget>
</item>
- <item row="9" column="0">
+ <item row="11" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -274,6 +274,37 @@
</property>
</widget>
</item>
+ <item row="7" column="0">
+ <widget class="QLabel" name="label_8">
+ <property name="text">
+ <string>Audio Channels</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="1">
+ <widget class="QSpinBox" name="nbChannels">
+ <property name="value">
+ <number>2</number>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="0">
+ <widget class="QLabel" name="label_10">
+ <property name="text">
+ <string>Audio Sample Rate</string>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="1">
+ <widget class="QSpinBox" name="sampleRate">
+ <property name="maximum">
+ <number>10000</number>
+ </property>
+ <property name="value">
+ <number>4800</number>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<resources/>
diff --git a/src/Renderer/ConsoleRenderer.cpp b/src/Renderer/ConsoleRenderer.cpp
index ee45730..0ed8a7b 100644
--- a/src/Renderer/ConsoleRenderer.cpp
+++ b/src/Renderer/ConsoleRenderer.cpp
@@ -62,6 +62,8 @@ ConsoleRenderer::startRender()
project->fps(),
project->aspectRatio(),
project->videoBitrate(),
- project->audioBitrate()
+ project->audioBitrate(),
+ project->nbChannels(),
+ project->sampleRate()
);
}
diff --git a/src/Renderer/WorkflowRenderer.cpp b/src/Renderer/WorkflowRenderer.cpp
index bd4ebb7..49108f4 100644
--- a/src/Renderer/WorkflowRenderer.cpp
+++ b/src/Renderer/WorkflowRenderer.cpp
@@ -218,7 +218,8 @@ WorkflowRenderer::start()
void
WorkflowRenderer::startRenderToFile( const QString& outputFileName, quint32 width, quint32 height,
double fps, const QString& ar,
- quint32 vbitrate, quint32 abitrate )
+ quint32 vbitrate, quint32 abitrate,
+ quint32 nbChannels, quint32 sampleRate )
{
if ( m_isRendering == true )
return ;
@@ -226,6 +227,8 @@ WorkflowRenderer::startRenderToFile( const QString& outputFileName, quint32 widt
m_height = height;
m_outputFps = fps;
m_aspectRatio = ar;
+ m_nbChannels = nbChannels;
+ m_rate = sampleRate;
setRenderTarget( std::unique_ptr<Backend::IRenderTarget>( new Backend::FileTarget( qPrintable( outputFileName ) ) ) );
setupRenderer();
diff --git a/src/Renderer/WorkflowRenderer.h b/src/Renderer/WorkflowRenderer.h
index 59cfc94..17e9054 100644
--- a/src/Renderer/WorkflowRenderer.h
+++ b/src/Renderer/WorkflowRenderer.h
@@ -134,7 +134,8 @@ class WorkflowRenderer : public AbstractRenderer
void startRenderToFile( const QString& outputFileName, quint32 width, quint32 height,
double fps, const QString& ar,
- quint32 vbitrate, quint32 abitrate );
+ quint32 vbitrate, quint32 abitrate,
+ quint32 nbChannels, quint32 sampleRate );
private:
void start();
--
1.9.1
More information about the Vlmc-devel
mailing list