[vlmc-devel] commit: WorkflowFileRenderer doesn't do GUI stuff anymore when WITH_GUI isn 't defined. (Hugo Beauzee-Luyssen )
git at videolan.org
git at videolan.org
Sat Mar 20 16:29:35 CET 2010
vlmc | branch: master | Hugo Beauzee-Luyssen <beauze.h at gmail.com> | Fri Mar 19 00:54:25 2010 +0100| [349abe15afe0be3e12fc0c096b5214a527ca81dc] | committer: Hugo Beauzee-Luyssen
WorkflowFileRenderer doesn't do GUI stuff anymore when WITH_GUI isn't defined.
Warning: Nasty code, nasty ifdefs, to refactore ASAP
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=349abe15afe0be3e12fc0c096b5214a527ca81dc
---
src/Main/main.cpp | 1 +
src/Renderer/WorkflowFileRenderer.cpp | 41 +++++++++++++++++++++++++--------
src/Renderer/WorkflowFileRenderer.h | 6 +++++
3 files changed, 38 insertions(+), 10 deletions(-)
diff --git a/src/Main/main.cpp b/src/Main/main.cpp
index 3d4df39..66d0285 100644
--- a/src/Main/main.cpp
+++ b/src/Main/main.cpp
@@ -24,6 +24,7 @@
#include "ProjectManager.h"
#include <QCoreApplication>
+#include <QtDebug>
/**
* VLMC Entry point
diff --git a/src/Renderer/WorkflowFileRenderer.cpp b/src/Renderer/WorkflowFileRenderer.cpp
index 6908f02..841266e 100644
--- a/src/Renderer/WorkflowFileRenderer.cpp
+++ b/src/Renderer/WorkflowFileRenderer.cpp
@@ -26,10 +26,13 @@
#include "VLCMedia.h"
#include "LightVideoFrame.h"
#include "VLCMediaPlayer.h"
-#include "export/RendererSettings.h"
+#ifdef WITH_GUI
+# include "export/RendererSettings.h"
+#endif
#include <QTime>
+#ifdef WITH_GUI
WorkflowFileRenderer::WorkflowFileRenderer() :
WorkflowRenderer(),
m_image( NULL )
@@ -40,6 +43,7 @@ WorkflowFileRenderer::~WorkflowFileRenderer()
{
delete m_image;
}
+#endif
void WorkflowFileRenderer::run()
{
@@ -47,6 +51,7 @@ void WorkflowFileRenderer::run()
m_mainWorkflow->setCurrentFrame( 0, MainWorkflow::Renderer );
+#ifdef WITH_GUI
//Setup dialog box for querying render parameters.
RendererSettings *settings = new RendererSettings;
if ( settings->exec() == QDialog::Rejected )
@@ -61,9 +66,17 @@ void WorkflowFileRenderer::run()
quint32 vbitrate = settings->videoBitrate();
quint32 abitrate = settings->audioBitrate();
delete settings;
-
+#else
+ quint32 width = VLMC_PROJECT_GET_UINT( "video/VideoProjectWidth" );
+ quint32 height = VLMC_PROJECT_GET_UINT( "video/VideoProjectHeight" );
+ double fps = VLMC_PROJECT_GET_DOUBLE( "video/VLMCOutputFPS" );
+ quint32 vbitrate = 4000;
+ quint32 abitrate = 400;
+#endif
setupRenderer( width, height, fps );
+#ifdef WITH_GUI
setupDialog( width, height );
+#endif
//Media as already been created and mainly initialized by the WorkflowRenderer
QString transcodeStr = ":sout=#transcode{vcodec=h264,vb=" + QString::number( vbitrate ) +
@@ -100,17 +113,11 @@ void WorkflowFileRenderer::stop()
WorkflowRenderer::killRenderer();
}
-void WorkflowFileRenderer::cancelButtonClicked()
-{
- stop();
- disconnect();
- m_dialog->done( 0 );
-}
-
void
WorkflowFileRenderer::__endReached()
{
- cancelButtonClicked();
+ stop();
+ disconnect();
}
float WorkflowFileRenderer::getFps() const
@@ -126,12 +133,14 @@ WorkflowFileRenderer::lock( void *datas, qint64 *dts, qint64 *pts, quint32 *flag
EsHandler* handler = reinterpret_cast<EsHandler*>( datas );
WorkflowFileRenderer* self = static_cast<WorkflowFileRenderer*>( handler->self );
+#ifdef WITH_GUI
if ( self->m_time.isValid() == false ||
self->m_time.elapsed() >= 1000 )
{
self->emit imageUpdated( (uchar*)self->m_renderVideoFrame );
self->m_time.restart();
}
+#endif
return ret;
}
@@ -144,7 +153,9 @@ WorkflowFileRenderer::unlock( void *datas, size_t size, void* buff )
void
WorkflowFileRenderer::__frameChanged( qint64 frame, MainWorkflow::FrameChangedReason )
{
+#ifdef WITH_GUI
m_dialog->setProgressBarValue( frame * 100 / m_mainWorkflow->getLengthFrame() );
+#endif
}
void*
@@ -171,6 +182,7 @@ WorkflowFileRenderer::height() const
return VLMC_GET_UINT( "video/VideoProjectHeight" );
}
+#ifdef WITH_GUI
void
WorkflowFileRenderer::setupDialog( quint32 width, quint32 height )
{
@@ -184,3 +196,12 @@ WorkflowFileRenderer::setupDialog( quint32 width, quint32 height )
Qt::QueuedConnection );
m_dialog->show();
}
+
+void
+WorkflowFileRenderer::cancelButtonClicked()
+{
+ stop();
+ disconnect();
+ m_dialog->done( 0 );
+}
+#endif
diff --git a/src/Renderer/WorkflowFileRenderer.h b/src/Renderer/WorkflowFileRenderer.h
index 00d8649..fdf6e59 100644
--- a/src/Renderer/WorkflowFileRenderer.h
+++ b/src/Renderer/WorkflowFileRenderer.h
@@ -25,7 +25,9 @@
#include "Workflow/MainWorkflow.h"
#include "WorkflowRenderer.h"
+#ifdef WITH_GUI
#include "WorkflowFileRendererDialog.h"
+#endif
#include <QTime>
@@ -35,8 +37,10 @@ class WorkflowFileRenderer : public WorkflowRenderer
Q_DISABLE_COPY( WorkflowFileRenderer )
public:
+#ifdef WITH_GUI
WorkflowFileRenderer();
virtual ~WorkflowFileRenderer();
+#endif
static int lock( void* datas, qint64 *dts, qint64 *pts, quint32 *flags,
size_t *bufferSize, void **buffer );
@@ -50,9 +54,11 @@ private:
private:
QString m_outputFileName;
+#ifdef WITH_GUI
WorkflowFileRendererDialog* m_dialog;
QImage* m_image;
QTime m_time;
+#endif
protected:
virtual void* getLockCallback();
More information about the Vlmc-devel
mailing list