Commit 349abe15 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

WorkflowFileRenderer doesn't do GUI stuff anymore when WITH_GUI isn't defined.

Warning: Nasty code, nasty ifdefs, to refactore ASAP
parent 53c98538
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "ProjectManager.h" #include "ProjectManager.h"
#include <QCoreApplication> #include <QCoreApplication>
#include <QtDebug>
/** /**
* VLMC Entry point * VLMC Entry point
......
...@@ -26,10 +26,13 @@ ...@@ -26,10 +26,13 @@
#include "VLCMedia.h" #include "VLCMedia.h"
#include "LightVideoFrame.h" #include "LightVideoFrame.h"
#include "VLCMediaPlayer.h" #include "VLCMediaPlayer.h"
#include "export/RendererSettings.h" #ifdef WITH_GUI
# include "export/RendererSettings.h"
#endif
#include <QTime> #include <QTime>
#ifdef WITH_GUI
WorkflowFileRenderer::WorkflowFileRenderer() : WorkflowFileRenderer::WorkflowFileRenderer() :
WorkflowRenderer(), WorkflowRenderer(),
m_image( NULL ) m_image( NULL )
...@@ -40,6 +43,7 @@ WorkflowFileRenderer::~WorkflowFileRenderer() ...@@ -40,6 +43,7 @@ WorkflowFileRenderer::~WorkflowFileRenderer()
{ {
delete m_image; delete m_image;
} }
#endif
void WorkflowFileRenderer::run() void WorkflowFileRenderer::run()
{ {
...@@ -47,6 +51,7 @@ void WorkflowFileRenderer::run() ...@@ -47,6 +51,7 @@ void WorkflowFileRenderer::run()
m_mainWorkflow->setCurrentFrame( 0, MainWorkflow::Renderer ); m_mainWorkflow->setCurrentFrame( 0, MainWorkflow::Renderer );
#ifdef WITH_GUI
//Setup dialog box for querying render parameters. //Setup dialog box for querying render parameters.
RendererSettings *settings = new RendererSettings; RendererSettings *settings = new RendererSettings;
if ( settings->exec() == QDialog::Rejected ) if ( settings->exec() == QDialog::Rejected )
...@@ -61,9 +66,17 @@ void WorkflowFileRenderer::run() ...@@ -61,9 +66,17 @@ void WorkflowFileRenderer::run()
quint32 vbitrate = settings->videoBitrate(); quint32 vbitrate = settings->videoBitrate();
quint32 abitrate = settings->audioBitrate(); quint32 abitrate = settings->audioBitrate();
delete settings; 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 ); setupRenderer( width, height, fps );
#ifdef WITH_GUI
setupDialog( width, height ); setupDialog( width, height );
#endif
//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=" + QString::number( vbitrate ) + QString transcodeStr = ":sout=#transcode{vcodec=h264,vb=" + QString::number( vbitrate ) +
...@@ -100,17 +113,11 @@ void WorkflowFileRenderer::stop() ...@@ -100,17 +113,11 @@ void WorkflowFileRenderer::stop()
WorkflowRenderer::killRenderer(); WorkflowRenderer::killRenderer();
} }
void WorkflowFileRenderer::cancelButtonClicked()
{
stop();
disconnect();
m_dialog->done( 0 );
}
void void
WorkflowFileRenderer::__endReached() WorkflowFileRenderer::__endReached()
{ {
cancelButtonClicked(); stop();
disconnect();
} }
float WorkflowFileRenderer::getFps() const float WorkflowFileRenderer::getFps() const
...@@ -126,12 +133,14 @@ WorkflowFileRenderer::lock( void *datas, qint64 *dts, qint64 *pts, quint32 *flag ...@@ -126,12 +133,14 @@ WorkflowFileRenderer::lock( void *datas, qint64 *dts, qint64 *pts, quint32 *flag
EsHandler* handler = reinterpret_cast<EsHandler*>( datas ); EsHandler* handler = reinterpret_cast<EsHandler*>( datas );
WorkflowFileRenderer* self = static_cast<WorkflowFileRenderer*>( handler->self ); WorkflowFileRenderer* self = static_cast<WorkflowFileRenderer*>( handler->self );
#ifdef WITH_GUI
if ( self->m_time.isValid() == false || if ( self->m_time.isValid() == false ||
self->m_time.elapsed() >= 1000 ) self->m_time.elapsed() >= 1000 )
{ {
self->emit imageUpdated( (uchar*)self->m_renderVideoFrame ); self->emit imageUpdated( (uchar*)self->m_renderVideoFrame );
self->m_time.restart(); self->m_time.restart();
} }
#endif
return ret; return ret;
} }
...@@ -144,7 +153,9 @@ WorkflowFileRenderer::unlock( void *datas, size_t size, void* buff ) ...@@ -144,7 +153,9 @@ WorkflowFileRenderer::unlock( void *datas, size_t size, void* buff )
void void
WorkflowFileRenderer::__frameChanged( qint64 frame, MainWorkflow::FrameChangedReason ) WorkflowFileRenderer::__frameChanged( qint64 frame, MainWorkflow::FrameChangedReason )
{ {
#ifdef WITH_GUI
m_dialog->setProgressBarValue( frame * 100 / m_mainWorkflow->getLengthFrame() ); m_dialog->setProgressBarValue( frame * 100 / m_mainWorkflow->getLengthFrame() );
#endif
} }
void* void*
...@@ -171,6 +182,7 @@ WorkflowFileRenderer::height() const ...@@ -171,6 +182,7 @@ WorkflowFileRenderer::height() const
return VLMC_GET_UINT( "video/VideoProjectHeight" ); return VLMC_GET_UINT( "video/VideoProjectHeight" );
} }
#ifdef WITH_GUI
void void
WorkflowFileRenderer::setupDialog( quint32 width, quint32 height ) WorkflowFileRenderer::setupDialog( quint32 width, quint32 height )
{ {
...@@ -184,3 +196,12 @@ WorkflowFileRenderer::setupDialog( quint32 width, quint32 height ) ...@@ -184,3 +196,12 @@ WorkflowFileRenderer::setupDialog( quint32 width, quint32 height )
Qt::QueuedConnection ); Qt::QueuedConnection );
m_dialog->show(); m_dialog->show();
} }
void
WorkflowFileRenderer::cancelButtonClicked()
{
stop();
disconnect();
m_dialog->done( 0 );
}
#endif
...@@ -25,7 +25,9 @@ ...@@ -25,7 +25,9 @@
#include "Workflow/MainWorkflow.h" #include "Workflow/MainWorkflow.h"
#include "WorkflowRenderer.h" #include "WorkflowRenderer.h"
#ifdef WITH_GUI
#include "WorkflowFileRendererDialog.h" #include "WorkflowFileRendererDialog.h"
#endif
#include <QTime> #include <QTime>
...@@ -35,8 +37,10 @@ class WorkflowFileRenderer : public WorkflowRenderer ...@@ -35,8 +37,10 @@ class WorkflowFileRenderer : public WorkflowRenderer
Q_DISABLE_COPY( WorkflowFileRenderer ) Q_DISABLE_COPY( WorkflowFileRenderer )
public: public:
#ifdef WITH_GUI
WorkflowFileRenderer(); WorkflowFileRenderer();
virtual ~WorkflowFileRenderer(); virtual ~WorkflowFileRenderer();
#endif
static int lock( void* datas, qint64 *dts, qint64 *pts, quint32 *flags, static int lock( void* datas, qint64 *dts, qint64 *pts, quint32 *flags,
size_t *bufferSize, void **buffer ); size_t *bufferSize, void **buffer );
...@@ -50,9 +54,11 @@ private: ...@@ -50,9 +54,11 @@ private:
private: private:
QString m_outputFileName; QString m_outputFileName;
#ifdef WITH_GUI
WorkflowFileRendererDialog* m_dialog; WorkflowFileRendererDialog* m_dialog;
QImage* m_image; QImage* m_image;
QTime m_time; QTime m_time;
#endif
protected: protected:
virtual void* getLockCallback(); virtual void* getLockCallback();
......
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