[vlmc-devel] Make Helper more abstract

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


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Thu Jun 23 14:21:16 2016 +0900| [f431b53cd584b81a4bced102a3d5e65e14a14def] | committer: Yikai Lu

Make Helper more abstract

> https://code.videolan.org/videolan/vlmc/commit/f431b53cd584b81a4bced102a3d5e65e14a14def
---

 src/EffectsEngine/EffectHelper.cpp |  4 ++--
 src/Media/Clip.cpp                 |  4 ++--
 src/Workflow/Helper.cpp            | 44 +-------------------------------------
 src/Workflow/Helper.h              | 16 ++++++--------
 4 files changed, 12 insertions(+), 56 deletions(-)

diff --git a/src/EffectsEngine/EffectHelper.cpp b/src/EffectsEngine/EffectHelper.cpp
index 311d5a6..34cc969 100644
--- a/src/EffectsEngine/EffectHelper.cpp
+++ b/src/EffectsEngine/EffectHelper.cpp
@@ -45,7 +45,7 @@ conv( std::string str, SettingValue::Type type )
 
 EffectHelper::EffectHelper( const char* id, qint64 begin, qint64 end,
                             const QString &uuid ) :
-    Helper( begin, end, uuid ),
+    Helper( uuid ),
     m_filter( new Backend::MLT::MLTFilter( id ) ),
     m_service( nullptr ),
     m_filterInfo( nullptr )
@@ -63,7 +63,7 @@ EffectHelper::EffectHelper( const QString& id, qint64 begin, qint64 end, const Q
 }
 
 EffectHelper::EffectHelper( Backend::IFilter *filter, const QString& uuid )
-    : Helper( filter->begin(), filter->end(), uuid )
+    : Helper( uuid )
     , m_filter( dynamic_cast<Backend::MLT::MLTFilter*>( filter ) )
     , m_service( nullptr )
     , m_filterInfo( nullptr )
diff --git a/src/Media/Clip.cpp b/src/Media/Clip.cpp
index 542b376..785fb5f 100644
--- a/src/Media/Clip.cpp
+++ b/src/Media/Clip.cpp
@@ -35,7 +35,7 @@
 #include <QVariant>
 
 Clip::Clip( Media *media, qint64 begin /*= 0*/, qint64 end /*= Backend::IProducer::EndOfMedia */, const QString& uuid /*= QString()*/ ) :
-        Workflow::Helper( begin, end, uuid ),
+        Workflow::Helper( uuid ),
         m_media( media ),
         m_producer( m_media->producer()->cut( begin, end ) ),
         m_parent( media->baseClip() ),
@@ -47,7 +47,7 @@ Clip::Clip( Media *media, qint64 begin /*= 0*/, qint64 end /*= Backend::IProduce
 
 Clip::Clip( Clip *parent, qint64 begin /*= -1*/, qint64 end /*= -2*/,
             const QString &uuid /*= QString()*/ ) :
-        Workflow::Helper( begin, end, uuid ),
+        Workflow::Helper( uuid ),
         m_media( parent->media() ),
         m_rootClip( parent->rootClip() ),
         m_parent( parent )
diff --git a/src/Workflow/Helper.cpp b/src/Workflow/Helper.cpp
index 3aad434..d9d633e 100644
--- a/src/Workflow/Helper.cpp
+++ b/src/Workflow/Helper.cpp
@@ -24,9 +24,7 @@
 
 using namespace Workflow;
 
-Helper::Helper( qint64 begin /*= 0*/, qint64 end /*= -1*/, const QString &uuid/* = QString()*/ ) :
-    m_begin( begin ),
-    m_end( end )
+Helper::Helper( const QString &uuid/* = QString()*/ )
 {
     if ( uuid.isNull() == true )
         m_uuid = QUuid::createUuid();
@@ -38,46 +36,6 @@ Helper::~Helper()
 {
 }
 
-qint64
-Helper::begin() const
-{
-    return m_begin;
-}
-
-qint64
-Helper::end() const
-{
-    return m_end;
-}
-
-void
-Helper::setBegin( qint64 begin )
-{
-    m_begin = begin;
-    emit lengthUpdated();
-}
-
-void
-Helper::setEnd(qint64 end)
-{
-    m_end = end;
-    emit lengthUpdated();
-}
-
-void
-Helper::setBoundaries( qint64 begin, qint64 end )
-{
-    m_begin = begin;
-    m_end = end;
-    emit lengthUpdated();
-}
-
-qint64
-Helper::length() const
-{
-    return m_end - m_begin;
-}
-
 const QUuid&
 Helper::uuid() const
 {
diff --git a/src/Workflow/Helper.h b/src/Workflow/Helper.h
index feff455..18525b9 100644
--- a/src/Workflow/Helper.h
+++ b/src/Workflow/Helper.h
@@ -34,21 +34,19 @@ namespace   Workflow
         Q_OBJECT
 
         protected: //This class is not meant to be used by itself.
-            Helper( qint64 begin = 0, qint64 end = -1, const QString &uuid = QString() );
+            Helper( const QString &uuid = QString() );
             ~Helper();
 
         public:
             virtual const QUuid&    uuid() const;
-            virtual qint64          begin() const;
-            virtual qint64          end() const;
-            virtual void            setBegin( qint64 begin );
-            virtual void            setEnd( qint64 end );
-            virtual qint64          length() const;
-            virtual void            setBoundaries( qint64 begin, qint64 end );
+            virtual qint64          begin() const = 0;
+            virtual qint64          end() const = 0;
+            virtual void            setBegin( qint64 begin ) = 0;
+            virtual void            setEnd( qint64 end ) = 0;
+            virtual qint64          length() const = 0;
+            virtual void            setBoundaries( qint64 begin, qint64 end ) = 0;
 
         protected:
-            qint64                  m_begin;
-            qint64                  m_end;
             QUuid                   m_uuid;
 
         signals:



More information about the Vlmc-devel mailing list