[vlmc-devel] [PATCH] Rename GenericRenderer to AbstractRenderer
Yikai Lu
luyikei.qmltu at gmail.com
Mon Apr 25 16:12:14 CEST 2016
---
src/CMakeLists.txt | 2 +-
src/Gui/MainWindow.cpp | 4 +-
src/Gui/preview/PreviewRuler.cpp | 2 +-
src/Gui/preview/PreviewRuler.h | 6 +-
src/Gui/preview/PreviewWidget.cpp | 6 +-
src/Gui/preview/PreviewWidget.h | 8 +-
src/Renderer/AbstractRenderer.cpp | 65 ++++++++++++++
src/Renderer/AbstractRenderer.h | 173 ++++++++++++++++++++++++++++++++++++++
src/Renderer/ClipRenderer.cpp | 2 +-
src/Renderer/ClipRenderer.h | 4 +-
src/Renderer/GenericRenderer.cpp | 65 --------------
src/Renderer/GenericRenderer.h | 173 --------------------------------------
src/Renderer/WorkflowRenderer.cpp | 2 +-
src/Renderer/WorkflowRenderer.h | 4 +-
14 files changed, 258 insertions(+), 258 deletions(-)
create mode 100644 src/Renderer/AbstractRenderer.cpp
create mode 100644 src/Renderer/AbstractRenderer.h
delete mode 100644 src/Renderer/GenericRenderer.cpp
delete mode 100644 src/Renderer/GenericRenderer.h
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0a28b24..238bffa 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -65,7 +65,7 @@ SET(VLMC_SRCS
Project/Workspace.cpp
Project/WorkspaceWorker.cpp
Project/RecentProjects.cpp
- Renderer/GenericRenderer.cpp
+ Renderer/AbstractRenderer.cpp
Renderer/WorkflowRenderer.cpp
Services/AbstractSharingService.h
Services/UploaderIODevice.cpp
diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index 6ab17fa..3f3a895 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -119,7 +119,7 @@ MainWindow::MainWindow( Backend::IBackend* backend, QWidget *parent )
//Connecting Library stuff:
- const ClipRenderer* clipRenderer = qobject_cast<const ClipRenderer*>( m_clipPreview->getGenericRenderer() );
+ const ClipRenderer* clipRenderer = qobject_cast<const ClipRenderer*>( m_clipPreview->getAbstractRenderer() );
Q_ASSERT( clipRenderer != nullptr );
connect( m_mediaLibrary, SIGNAL( clipSelected( Clip* ) ),
clipRenderer, SLOT( setClip( Clip* ) ) );
@@ -610,7 +610,7 @@ MainWindow::renderVideo( const QString& outputFileName, quint32 width, quint32 h
WorkflowFileRendererDialog dialog( width, height );
dialog.setModal( true );
dialog.setOutputFileName( outputFileName );
- if ( m_projectPreview->getGenericRenderer()->isRendering() == true )
+ if ( m_projectPreview->getAbstractRenderer()->isRendering() == true )
m_projectPreview->stop();
Core::instance()->workflowRenderer()->startRenderToFile( outputFileName, width, height,
fps, ar, vbitrate, abitrate );
diff --git a/src/Gui/preview/PreviewRuler.cpp b/src/Gui/preview/PreviewRuler.cpp
index e69b3d3..88aec96 100644
--- a/src/Gui/preview/PreviewRuler.cpp
+++ b/src/Gui/preview/PreviewRuler.cpp
@@ -38,7 +38,7 @@ PreviewRuler::PreviewRuler( QWidget* parent ) :
}
void
-PreviewRuler::setRenderer( GenericRenderer* renderer )
+PreviewRuler::setRenderer( AbstractRenderer* renderer )
{
if ( m_renderer )
m_renderer->disconnect( this );
diff --git a/src/Gui/preview/PreviewRuler.h b/src/Gui/preview/PreviewRuler.h
index ce86648..6f9cabd 100644
--- a/src/Gui/preview/PreviewRuler.h
+++ b/src/Gui/preview/PreviewRuler.h
@@ -25,7 +25,7 @@
#include <QWidget>
#include <QPaintEvent>
-#include "Renderer/GenericRenderer.h"
+#include "Renderer/AbstractRenderer.h"
#define MARK_XSMALL 3
#define MARK_SMALL 5
@@ -46,7 +46,7 @@ public:
PreviewRuler( QWidget* parent = 0 );
virtual ~PreviewRuler() { }
- void setRenderer( GenericRenderer* renderer );
+ void setRenderer( AbstractRenderer* renderer );
void setMarker( Marker m );
void hideMarker( Marker m );
qint64 getMarker( Marker m ) const;
@@ -65,7 +65,7 @@ private slots:
void clear();
private:
- GenericRenderer* m_renderer;
+ AbstractRenderer* m_renderer;
qint64 m_frame;
qint64 m_markerStart;
qint64 m_markerStop;
diff --git a/src/Gui/preview/PreviewWidget.cpp b/src/Gui/preview/PreviewWidget.cpp
index 51a5435..e5b9675 100644
--- a/src/Gui/preview/PreviewWidget.cpp
+++ b/src/Gui/preview/PreviewWidget.cpp
@@ -66,7 +66,7 @@ PreviewWidget::~PreviewWidget()
}
void
-PreviewWidget::setRenderer(GenericRenderer *renderer)
+PreviewWidget::setRenderer(AbstractRenderer *renderer)
{
delete m_renderer;
m_renderer = renderer;
@@ -179,8 +179,8 @@ PreviewWidget::on_pushButtonPreviousFrame_clicked()
m_renderer->previousFrame();
}
-const GenericRenderer*
-PreviewWidget::getGenericRenderer() const
+const AbstractRenderer*
+PreviewWidget::getAbstractRenderer() const
{
return m_renderer;
}
diff --git a/src/Gui/preview/PreviewWidget.h b/src/Gui/preview/PreviewWidget.h
index 8737652..4be3b43 100644
--- a/src/Gui/preview/PreviewWidget.h
+++ b/src/Gui/preview/PreviewWidget.h
@@ -27,7 +27,7 @@
#include <QWidget>
#include "Workflow/MainWorkflow.h"
-class GenericRenderer;
+class AbstractRenderer;
class RendererEventWatcher;
namespace Ui {
@@ -42,8 +42,8 @@ class PreviewWidget : public QWidget
public:
explicit PreviewWidget( QWidget* parent = nullptr );
virtual ~PreviewWidget();
- const GenericRenderer* getGenericRenderer() const;
- void setRenderer( GenericRenderer *renderer );
+ const AbstractRenderer* getAbstractRenderer() const;
+ void setRenderer( AbstractRenderer *renderer );
/**
* @brief setClipEdition Allows to enable/disable markers & create clip buttons
*/
@@ -51,7 +51,7 @@ public:
private:
Ui::PreviewWidget* m_ui;
- GenericRenderer* m_renderer;
+ AbstractRenderer* m_renderer;
bool m_previewStopped;
protected:
diff --git a/src/Renderer/AbstractRenderer.cpp b/src/Renderer/AbstractRenderer.cpp
new file mode 100644
index 0000000..877fde8
--- /dev/null
+++ b/src/Renderer/AbstractRenderer.cpp
@@ -0,0 +1,65 @@
+/*****************************************************************************
+ * AbstractRenderer.cpp: Describe a common behavior for every renderers
+ *****************************************************************************
+ * Copyright (C) 2008-2016 VideoLAN
+ *
+ * Authors: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
+ *
+ * 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 "AbstractRenderer.h"
+#include "preview/RenderWidget.h"
+#include <QtGlobal>
+
+AbstractRenderer::AbstractRenderer()
+ : m_sourceRenderer( nullptr )
+ , m_paused( false )
+ , m_isRendering( false )
+{
+ m_eventWatcher = new RendererEventWatcher;
+}
+
+AbstractRenderer::~AbstractRenderer()
+{
+ delete m_sourceRenderer;
+ delete m_eventWatcher;
+}
+
+bool
+AbstractRenderer::isPaused() const
+{
+ return m_paused;
+}
+
+bool
+AbstractRenderer::isRendering() const
+{
+ return m_isRendering;
+}
+
+void
+AbstractRenderer::setRenderTarget( std::unique_ptr<Backend::IRenderTarget> target )
+{
+ m_renderTarget = std::move( target );
+}
+
+#ifdef WITH_GUI
+RendererEventWatcher*
+AbstractRenderer::eventWatcher()
+{
+ return m_eventWatcher;
+}
+#endif
diff --git a/src/Renderer/AbstractRenderer.h b/src/Renderer/AbstractRenderer.h
new file mode 100644
index 0000000..87fb789
--- /dev/null
+++ b/src/Renderer/AbstractRenderer.h
@@ -0,0 +1,173 @@
+/*****************************************************************************
+ * AbstractRenderer.h: Describe a common behavior for every renderers
+ *****************************************************************************
+ * Copyright (C) 2008-2016 VideoLAN
+ *
+ * Authors: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
+ *
+ * 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 ABSTRACTRENDERER_H
+#define ABSTRACTRENDERER_H
+
+#include "config.h"
+#include <memory>
+#include <QObject>
+
+#include "Workflow/Types.h"
+#include "Tools/RendererEventWatcher.h"
+#include "Backend/IRenderTarget.h"
+
+class Clip;
+class Media;
+
+/**
+ * \class Common base for every renderer.
+ */
+class AbstractRenderer : public QObject
+{
+ Q_OBJECT
+ Q_DISABLE_COPY( AbstractRenderer )
+
+protected:
+ explicit AbstractRenderer();
+
+public:
+ virtual ~AbstractRenderer();
+
+ /**
+ * \brief Set the output volume.
+ * \param volume the volume (int)
+ * \sa getVolume()
+ */
+ virtual void setVolume( int volume ) = 0;
+
+ /**
+ * \brief Play or pause the media.
+ *
+ * This method is renderer dependant. It has to be implemented in the
+ * underlying renderer implementation.
+ * When this method is called :
+ * - if the render has not started the render is started
+ * - if the render has started and is not paused, the render will pause
+ * - if the render has started and is paused, the render will unpause
+ * \param forcePause Will force the pause if true.
+ * \sa stop()
+ */
+ virtual void togglePlayPause() = 0;
+
+ /**
+ * \brief Render the next frame
+ * \sa previousFrame()
+ */
+ virtual void nextFrame() = 0;
+
+ /**
+ * \brief Render the previous frame
+ * \sa nextFrame();
+ */
+ virtual void previousFrame() = 0;
+
+ /**
+ * \brief Stop the renderer.
+ * \sa togglePlayPause( bool );
+ */
+ virtual void stop() = 0;
+
+ /**
+ * \brief Return the volume
+ * \return The Return the volume the audio level (int)
+ * \sa setVolume( int )
+ */
+ virtual int getVolume() const = 0;
+
+ /**
+ * \brief Return the length in milliseconds
+ * \return The length of the underlying rendered target in milliseconds
+ * \sa getLength()
+ */
+ virtual qint64 getLengthMs() const = 0;
+
+ /**
+ * \brief Return the current frame number
+ * \return The current frame
+ */
+ virtual qint64 getCurrentFrame() const = 0;
+
+ /**
+ * \brief Return the number of frames per second
+ * \return The current fps
+ */
+ virtual float getFps() const = 0;
+
+ /**
+ * \brief Return the length in frames
+ * \warning The returned value may not be accurate as it depends on FPS, that
+ * can be badly computed
+ * \return The length that has to be rendered in frames
+ * \sa getLengthMs()
+ */
+ virtual qint64 length() const = 0;
+
+ /**
+ * \brief Return true if the renderer is paused
+ * \return true if the renderer is paused. false otherwise.
+ */
+ bool isPaused() const;
+
+ /**
+ * \brief Return true if the renderer is currently rendering.
+ * \return true if the renderer is currently rendering. false otherwise.
+ * Note that a paused renderer is still rendering
+ * \sa isPaused()
+ */
+ bool isRendering() const;
+
+ void setRenderTarget( std::unique_ptr<Backend::IRenderTarget> target );
+
+ RendererEventWatcher* eventWatcher();
+protected:
+ Backend::ISourceRenderer* m_sourceRenderer;
+ RendererEventWatcher* m_eventWatcher;
+
+ /**
+ * \brief This flag allows us to know if the render is paused
+ * or not, without using libvlc, especially for the render preview.
+ * If the video is stopped, then this flag will be equal to false
+ * \warning This is not thread safe.
+ * \sa isPaused()
+ */
+ bool m_paused;
+ bool m_isRendering;
+
+ std::unique_ptr<Backend::IRenderTarget> m_renderTarget;
+
+public slots:
+ /**
+ * \brief This SLOT will be called when the time cursor has changed.
+ *
+ * This mainly means that the current rendered frame should change.
+ * \param newFrame The new frame to render from.
+ */
+ virtual void previewWidgetCursorChanged( qint64 newFrame ) = 0;
+
+
+signals:
+ void frameChanged( qint64 newFrame,
+ Vlmc::FrameChangedReason reason );
+};
+
+#endif // ABSTRACTRENDERER_H
diff --git a/src/Renderer/ClipRenderer.cpp b/src/Renderer/ClipRenderer.cpp
index 8da108d..c8f74b4 100644
--- a/src/Renderer/ClipRenderer.cpp
+++ b/src/Renderer/ClipRenderer.cpp
@@ -34,7 +34,7 @@
#include "Gui/preview/RenderWidget.h"
ClipRenderer::ClipRenderer() :
- GenericRenderer(),
+ AbstractRenderer(),
m_clipLoaded( false ),
m_selectedClip( nullptr ),
m_begin( 0 ),
diff --git a/src/Renderer/ClipRenderer.h b/src/Renderer/ClipRenderer.h
index 7146ccd..c5cc48f 100644
--- a/src/Renderer/ClipRenderer.h
+++ b/src/Renderer/ClipRenderer.h
@@ -23,14 +23,14 @@
#ifndef CLIPRENDERER_H
#define CLIPRENDERER_H
-#include "GenericRenderer.h"
+#include "AbstractRenderer.h"
#include <QObject>
class Clip;
class Media;
-class ClipRenderer : public GenericRenderer
+class ClipRenderer : public AbstractRenderer
{
Q_OBJECT
Q_DISABLE_COPY( ClipRenderer )
diff --git a/src/Renderer/GenericRenderer.cpp b/src/Renderer/GenericRenderer.cpp
deleted file mode 100644
index fdfcea9..0000000
--- a/src/Renderer/GenericRenderer.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*****************************************************************************
- * GenericRenderer.cpp: Describe a common behavior for every renderers
- *****************************************************************************
- * Copyright (C) 2008-2016 VideoLAN
- *
- * Authors: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
- *
- * 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 "GenericRenderer.h"
-#include "preview/RenderWidget.h"
-#include <QtGlobal>
-
-GenericRenderer::GenericRenderer()
- : m_sourceRenderer( nullptr )
- , m_paused( false )
- , m_isRendering( false )
-{
- m_eventWatcher = new RendererEventWatcher;
-}
-
-GenericRenderer::~GenericRenderer()
-{
- delete m_sourceRenderer;
- delete m_eventWatcher;
-}
-
-bool
-GenericRenderer::isPaused() const
-{
- return m_paused;
-}
-
-bool
-GenericRenderer::isRendering() const
-{
- return m_isRendering;
-}
-
-void
-GenericRenderer::setRenderTarget( std::unique_ptr<Backend::IRenderTarget> target )
-{
- m_renderTarget = std::move( target );
-}
-
-#ifdef WITH_GUI
-RendererEventWatcher*
-GenericRenderer::eventWatcher()
-{
- return m_eventWatcher;
-}
-#endif
diff --git a/src/Renderer/GenericRenderer.h b/src/Renderer/GenericRenderer.h
deleted file mode 100644
index b63ec22..0000000
--- a/src/Renderer/GenericRenderer.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/*****************************************************************************
- * GenericRenderer.h: Describe a common behavior for every renderers
- *****************************************************************************
- * Copyright (C) 2008-2016 VideoLAN
- *
- * Authors: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
- *
- * 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 GENERICRENDERER_H
-#define GENERICRENDERER_H
-
-#include "config.h"
-#include <memory>
-#include <QObject>
-
-#include "Workflow/Types.h"
-#include "Tools/RendererEventWatcher.h"
-#include "Backend/IRenderTarget.h"
-
-class Clip;
-class Media;
-
-/**
- * \class Common base for every renderer.
- */
-class GenericRenderer : public QObject
-{
- Q_OBJECT
- Q_DISABLE_COPY( GenericRenderer )
-
-protected:
- explicit GenericRenderer();
-
-public:
- virtual ~GenericRenderer();
-
- /**
- * \brief Set the output volume.
- * \param volume the volume (int)
- * \sa getVolume()
- */
- virtual void setVolume( int volume ) = 0;
-
- /**
- * \brief Play or pause the media.
- *
- * This method is renderer dependant. It has to be implemented in the
- * underlying renderer implementation.
- * When this method is called :
- * - if the render has not started the render is started
- * - if the render has started and is not paused, the render will pause
- * - if the render has started and is paused, the render will unpause
- * \param forcePause Will force the pause if true.
- * \sa stop()
- */
- virtual void togglePlayPause() = 0;
-
- /**
- * \brief Render the next frame
- * \sa previousFrame()
- */
- virtual void nextFrame() = 0;
-
- /**
- * \brief Render the previous frame
- * \sa nextFrame();
- */
- virtual void previousFrame() = 0;
-
- /**
- * \brief Stop the renderer.
- * \sa togglePlayPause( bool );
- */
- virtual void stop() = 0;
-
- /**
- * \brief Return the volume
- * \return The Return the volume the audio level (int)
- * \sa setVolume( int )
- */
- virtual int getVolume() const = 0;
-
- /**
- * \brief Return the length in milliseconds
- * \return The length of the underlying rendered target in milliseconds
- * \sa getLength()
- */
- virtual qint64 getLengthMs() const = 0;
-
- /**
- * \brief Return the current frame number
- * \return The current frame
- */
- virtual qint64 getCurrentFrame() const = 0;
-
- /**
- * \brief Return the number of frames per second
- * \return The current fps
- */
- virtual float getFps() const = 0;
-
- /**
- * \brief Return the length in frames
- * \warning The returned value may not be accurate as it depends on FPS, that
- * can be badly computed
- * \return The length that has to be rendered in frames
- * \sa getLengthMs()
- */
- virtual qint64 length() const = 0;
-
- /**
- * \brief Return true if the renderer is paused
- * \return true if the renderer is paused. false otherwise.
- */
- bool isPaused() const;
-
- /**
- * \brief Return true if the renderer is currently rendering.
- * \return true if the renderer is currently rendering. false otherwise.
- * Note that a paused renderer is still rendering
- * \sa isPaused()
- */
- bool isRendering() const;
-
- void setRenderTarget( std::unique_ptr<Backend::IRenderTarget> target );
-
- RendererEventWatcher* eventWatcher();
-protected:
- Backend::ISourceRenderer* m_sourceRenderer;
- RendererEventWatcher* m_eventWatcher;
-
- /**
- * \brief This flag allows us to know if the render is paused
- * or not, without using libvlc, especially for the render preview.
- * If the video is stopped, then this flag will be equal to false
- * \warning This is not thread safe.
- * \sa isPaused()
- */
- bool m_paused;
- bool m_isRendering;
-
- std::unique_ptr<Backend::IRenderTarget> m_renderTarget;
-
-public slots:
- /**
- * \brief This SLOT will be called when the time cursor has changed.
- *
- * This mainly means that the current rendered frame should change.
- * \param newFrame The new frame to render from.
- */
- virtual void previewWidgetCursorChanged( qint64 newFrame ) = 0;
-
-
-signals:
- void frameChanged( qint64 newFrame,
- Vlmc::FrameChangedReason reason );
-};
-
-#endif // GENERICRENDERER_H
diff --git a/src/Renderer/WorkflowRenderer.cpp b/src/Renderer/WorkflowRenderer.cpp
index f467d2c..23556bd 100644
--- a/src/Renderer/WorkflowRenderer.cpp
+++ b/src/Renderer/WorkflowRenderer.cpp
@@ -32,7 +32,7 @@
#include "Project/Project.h"
#include "Media/Clip.h"
#include "EffectsEngine/EffectInstance.h"
-#include "GenericRenderer.h"
+#include "AbstractRenderer.h"
#include "Backend/IBackend.h"
#include "Backend/ISource.h"
#include "Backend/Target/FileTarget.h"
diff --git a/src/Renderer/WorkflowRenderer.h b/src/Renderer/WorkflowRenderer.h
index 5e846b6..59cfc94 100644
--- a/src/Renderer/WorkflowRenderer.h
+++ b/src/Renderer/WorkflowRenderer.h
@@ -23,7 +23,7 @@
#ifndef WORKFLOWRENDERER_H
#define WORKFLOWRENDERER_H
-#include "GenericRenderer.h"
+#include "AbstractRenderer.h"
#include "Backend/ISourceRenderer.h"
#include "Workflow/MainWorkflow.h"
@@ -42,7 +42,7 @@ class QWidget;
class QWaitCondition;
class QMutex;
-class WorkflowRenderer : public GenericRenderer
+class WorkflowRenderer : public AbstractRenderer
{
Q_OBJECT
Q_DISABLE_COPY( WorkflowRenderer )
--
1.9.1
More information about the Vlmc-devel
mailing list