[vlmc-devel] Remove VLCBackend

Yikai Lu git at videolan.org
Sun Jun 26 06:01:25 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Tue Jun 21 17:24:06 2016 +0900| [5f76c06bb0278b1ea063157c83727c843fc2131c] | committer: Yikai Lu

Remove VLCBackend

> https://code.videolan.org/videolan/vlmc/commit/5f76c06bb0278b1ea063157c83727c843fc2131c
---

 src/CMakeLists.txt       |  5 -----
 src/Gui/MainWindow.cpp   |  5 ++---
 src/Gui/MainWindow.h     |  9 +++------
 src/Main/Core.cpp        |  6 +++---
 src/Main/Core.h          |  9 +++------
 src/Main/main.cpp        | 10 +++++-----
 src/Tools/VlmcLogger.cpp | 28 ++++++++++++++--------------
 src/Tools/VlmcLogger.h   |  6 +++---
 8 files changed, 33 insertions(+), 45 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 16e66a7..ced4e48 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -75,11 +75,6 @@ SET(VLMC_SRCS
     Backend/MLT/MLTFilter.cpp
     Backend/MLT/MLTTransition.cpp
     Backend/MLT/MLTTractor.cpp
-    Backend/VLC/VLCBackend.cpp
-    Backend/VLC/VLCSourceRenderer.cpp
-    Backend/VLC/VLCVmemRenderer.cpp
-    Backend/VLC/VLCSource.cpp
-    Backend/VLC/VLCMemorySource.cpp
     EffectsEngine/EffectsEngine.cpp
     EffectsEngine/Effect.cpp
     EffectsEngine/EffectUser.cpp
diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index 2fe750f..52321c2 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -38,8 +38,7 @@
 #include "Library/Library.h"
 #include "Tools/VlmcDebug.h"
 #include "Tools/VlmcLogger.h"
-#include "EffectsEngine/EffectsEngine.h"
-#include "Backend/VLC/VLCBackend.h"
+#include "Backend/IBackend.h"
 #include "Workflow/MainWorkflow.h"
 #include "Renderer/WorkflowRenderer.h"
 #include "Renderer/ClipRenderer.h"
@@ -68,7 +67,7 @@
 #include "LanguageHelper.h"
 #include "Commands/KeyboardShortcutHelper.h"
 
-MainWindow::MainWindow( Backend::VLC::VLCBackend* backend, QWidget *parent )
+MainWindow::MainWindow( Backend::IBackend* backend, QWidget *parent )
     : QMainWindow( parent )
     , m_backend( backend )
     , m_projectPreferences( nullptr )
diff --git a/src/Gui/MainWindow.h b/src/Gui/MainWindow.h
index 5493698..cd3e698 100644
--- a/src/Gui/MainWindow.h
+++ b/src/Gui/MainWindow.h
@@ -46,10 +46,7 @@ class   WorkflowRenderer;
 
 namespace Backend
 {
-namespace VLC
-{
-class VLCBackend;
-}
+class IBackend;
 }
 
 class MainWindow : public QMainWindow
@@ -58,7 +55,7 @@ class MainWindow : public QMainWindow
     Q_DISABLE_COPY( MainWindow )
 
 public:
-    explicit MainWindow( Backend::VLC::VLCBackend* backend,
+    explicit MainWindow( Backend::IBackend* backend,
                          QWidget *parent = 0 );
     ~MainWindow();
 
@@ -131,7 +128,7 @@ private:
     Ui::MainWindow          m_ui;
     QSlider*                m_zoomSlider;
     Timeline*               m_timeline;
-    Backend::VLC::VLCBackend*      m_backend;
+    Backend::IBackend*      m_backend;
     SettingsDialog*         m_globalPreferences;
     SettingsDialog*         m_DefaultProjectPreferences;
     SettingsDialog*         m_projectPreferences;
diff --git a/src/Main/Core.cpp b/src/Main/Core.cpp
index ce68937..378f56b 100644
--- a/src/Main/Core.cpp
+++ b/src/Main/Core.cpp
@@ -28,7 +28,7 @@
 #include <QStandardPaths>
 
 
-#include <Backend/VLC/VLCBackend.h>
+#include <Backend/IBackend.h>
 #include <EffectsEngine/EffectsEngine.h>
 #include "Library/Library.h"
 #include "Project/RecentProjects.h"
@@ -40,7 +40,7 @@
 
 Core::Core()
 {
-    m_backend = Backend::getVLCBackend();
+    m_backend = Backend::instance();
     m_effectsEngine = new EffectsEngine;
     m_logger = new VlmcLogger;
 
@@ -92,7 +92,7 @@ Core::createSettings()
     m_settings->createVar( SettingValue::Bool, "private/FirstLaunchDone", false, "", "", SettingValue::Private );
 }
 
-Backend::VLC::VLCBackend*
+Backend::IBackend*
 Core::backend()
 {
     return m_backend;
diff --git a/src/Main/Core.h b/src/Main/Core.h
index cb6c696..5c16afc 100644
--- a/src/Main/Core.h
+++ b/src/Main/Core.h
@@ -36,10 +36,7 @@ class Workspace;
 
 namespace Backend
 {
-namespace VLC
-{
-    class VLCBackend;
-}
+    class IBackend;
 }
 
 namespace Commands
@@ -55,7 +52,7 @@ class Core : public QObject
     Q_OBJECT
 
     public:
-        Backend::VLC::VLCBackend*      backend();
+        Backend::IBackend*      backend();
         EffectsEngine*          effectsEngine();
         Settings*               settings();
         VlmcLogger*             logger();
@@ -83,7 +80,7 @@ class Core : public QObject
         void                    connectComponents();
 
     private:
-        Backend::VLC::VLCBackend*      m_backend;
+        Backend::IBackend*      m_backend;
         EffectsEngine*          m_effectsEngine;
         Settings*               m_settings;
         VlmcLogger*             m_logger;
diff --git a/src/Main/main.cpp b/src/Main/main.cpp
index 85320d4..93c3f4b 100644
--- a/src/Main/main.cpp
+++ b/src/Main/main.cpp
@@ -32,7 +32,7 @@
 #include "Workflow/Types.h"
 #include "Renderer/ConsoleRenderer.h"
 #include "Project/Project.h"
-#include "Backend/VLC/VLCBackend.h"
+#include "Backend/IBackend.h"
 #include "Main/Core.h"
 #ifdef WITH_GUI
 #include "Gui/MainWindow.h"
@@ -58,7 +58,7 @@
 #endif
 
 static void
-VLMCmainCommon( const QCoreApplication &app, Backend::VLC::VLCBackend** backend )
+VLMCmainCommon( const QCoreApplication &app, Backend::IBackend** backend )
 {
     app.setApplicationName( "vlmc" );
     app.setOrganizationName( "VideoLAN" );
@@ -72,7 +72,7 @@ VLMCmainCommon( const QCoreApplication &app, Backend::VLC::VLCBackend** backend
     qRegisterMetaType<QVariant>( "QVariant" );
     qRegisterMetaType<QUuid>( "QUuid" );
 
-    *backend = Backend::getVLCBackend();
+    *backend = Backend::instance();
 }
 
 /**
@@ -92,7 +92,7 @@ VLMCGuimain( int argc, char **argv )
 
     QApplication app( argc, argv );
 
-    Backend::VLC::VLCBackend* backend;
+    Backend::IBackend* backend;
     VLMCmainCommon( app, &backend );
 
     /* Load a project file */
@@ -184,7 +184,7 @@ VLMCCoremain( int argc, char **argv )
 {
     QCoreApplication app( argc, argv );
 
-    Backend::VLC::VLCBackend* backend;
+    Backend::IBackend* backend;
     VLMCmainCommon( app, &backend );
 
     /* Load a project file */
diff --git a/src/Tools/VlmcLogger.cpp b/src/Tools/VlmcLogger.cpp
index e1b0dc3..a898f8a 100644
--- a/src/Tools/VlmcLogger.cpp
+++ b/src/Tools/VlmcLogger.cpp
@@ -32,7 +32,7 @@
 
 VlmcLogger::VlmcLogger()
     : m_logFile( nullptr )
-    , m_backendLogLevel( Backend::VLC::VLCBackend::None )
+    , m_backendLogLevel( Backend::IBackend::None )
 {
 }
 
@@ -72,14 +72,14 @@ VlmcLogger::setup()
         }
     }
 
-    pos = args.indexOf( QRegExp( "--vlcverbose=.*" ) );
+    pos = args.indexOf( QRegExp( "--backendverbose=.*" ) );
     if ( pos > 0 )
     {
         QString arg = args[pos];
-        QString vlcLogLevelStr = arg.mid( 13 );
+        QString vlcLogLevelStr = arg.mid( 17 );
 
         if ( vlcLogLevelStr.length() <= 0 )
-            vlmcWarning() << tr("Invalid value supplied for argument --vlcverbose" );
+            vlmcWarning() << tr("Invalid value supplied for argument --backendverbose" );
         else
         {
             bool ok = false;
@@ -87,18 +87,18 @@ VlmcLogger::setup()
             if ( ok == true )
             {
                 if ( vlcLogLevel >= 3 )
-                    m_backendLogLevel = Backend::VLC::VLCBackend::Debug;
+                    m_backendLogLevel = Backend::IBackend::Debug;
                 else if ( vlcLogLevel == 2 )
-                    m_backendLogLevel = Backend::VLC::VLCBackend::Warning;
+                    m_backendLogLevel = Backend::IBackend::Warning;
                 else if ( vlcLogLevel == 1 )
-                    m_backendLogLevel = Backend::VLC::VLCBackend::Error;
+                    m_backendLogLevel = Backend::IBackend::Error;
             }
             else
-                vlmcWarning() << tr("Invalid value supplied for argument --vlcverbose" );
+                vlmcWarning() << tr("Invalid value supplied for argument --backendverbose" );
         }
     }
-    auto* backend = Backend::getVLCBackend();
-    backend->setLogHandler( [this]( Backend::VLC::VLCBackend::LogLevel lvl, const QString& msg ) {
+    auto* backend = Backend::instance();
+    backend->setLogHandler( [this]( Backend::IBackend::LogLevel lvl, const QString& msg ) {
         backendLogHandler( lvl, msg );
     } );
 
@@ -171,7 +171,7 @@ VlmcLogger::outputToConsole( int level, const char *msg )
 }
 
 void
-VlmcLogger::backendLogHandler( Backend::VLC::VLCBackend::LogLevel logLevel, const QString& msg )
+VlmcLogger::backendLogHandler( Backend::IBackend::LogLevel logLevel, const QString& msg )
 {
     char* newMsg = nullptr;
     if ( asprintf( &newMsg, "[%s] T #%p [Backend] %s", qPrintable( QTime::currentTime().toString( "hh:mm:ss.zzz" ) ),
@@ -187,13 +187,13 @@ VlmcLogger::backendLogHandler( Backend::VLC::VLCBackend::LogLevel logLevel, cons
     }
     switch ( logLevel )
     {
-        case Backend::VLC::VLCBackend::Debug:
+        case Backend::IBackend::Debug:
             outputToConsole( Debug, newMsg );
             break;
-        case Backend::VLC::VLCBackend::Warning:
+        case Backend::IBackend::Warning:
             outputToConsole( Verbose, newMsg );
             break;
-        case Backend::VLC::VLCBackend::Error:
+        case Backend::IBackend::Error:
             outputToConsole( Quiet, newMsg );
             break;
         default:
diff --git a/src/Tools/VlmcLogger.h b/src/Tools/VlmcLogger.h
index e9b934b..9435a70 100644
--- a/src/Tools/VlmcLogger.h
+++ b/src/Tools/VlmcLogger.h
@@ -26,7 +26,7 @@
 #include <QObject>
 #include <cstdio>
 
-#include "Backend/VLC/VLCBackend.h"
+#include "Backend/IBackend.h"
 
 /**
  *  \warning    Do not use qDebug() qWarning() etc... from here, unless you know exactly what you're doing
@@ -50,7 +50,7 @@ class   VlmcLogger : public QObject
         };
 
         static void     vlmcMessageHandler(QtMsgType type, const QMessageLogContext& context, const QString& str );
-        void            backendLogHandler( Backend::VLC::VLCBackend::LogLevel logLevel, const QString& msg );
+        void            backendLogHandler( Backend::IBackend::LogLevel logLevel, const QString& msg );
 
         void            setup();
     private:
@@ -59,7 +59,7 @@ class   VlmcLogger : public QObject
 
         FILE*                           m_logFile;
         LogLevel                        m_currentLogLevel;
-        Backend::VLC::VLCBackend::LogLevel     m_backendLogLevel;
+        Backend::IBackend::LogLevel     m_backendLogLevel;
 
     private slots:
         void            logLevelChanged( const QVariant& logLevel );



More information about the Vlmc-devel mailing list