[vlmc-devel] [PATCH 2/8] ClipHelper: Use flags to manage available outputs

Yikai Lu luyikei.qmltu at gmail.com
Tue May 3 07:24:41 CEST 2016


Since we don't separate tracks according to TrackType, we have to let ClipHelper know which TrackType(s) are available to generate buffers.
---
 src/Workflow/ClipHelper.cpp | 17 ++++++++++++++++-
 src/Workflow/ClipHelper.h   | 15 +++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/src/Workflow/ClipHelper.cpp b/src/Workflow/ClipHelper.cpp
index 945b514..f571392 100644
--- a/src/Workflow/ClipHelper.cpp
+++ b/src/Workflow/ClipHelper.cpp
@@ -28,7 +28,8 @@ ClipHelper::ClipHelper( Clip* clip, qint64 begin /*= -1*/, qint64 end /*= -1*/,
                         const QString& uuid /*= QString()*/ ) :
     Helper( begin, end, uuid ),
     m_clip( clip ),
-    m_clipWorkflow( nullptr )
+    m_clipWorkflow( nullptr ),
+    m_formats( ClipHelper::None )
 {
     if ( begin == -1 )
         m_begin = clip->begin();
@@ -75,6 +76,20 @@ ClipHelper::setClipWorkflow( ClipWorkflow* cw )
     m_clipWorkflow = cw;
 }
 
+ClipHelper::Formats
+ClipHelper::formats() const
+{
+    return m_formats;
+}
+
+void
+ClipHelper::setFormats( Formats formats )
+{
+    if ( formats.testFlag( ClipHelper::None ) )
+        m_formats = ClipHelper::None;
+    m_formats = formats;
+}
+
 void
 ClipHelper::clipDestroyed()
 {
diff --git a/src/Workflow/ClipHelper.h b/src/Workflow/ClipHelper.h
index 8be7783..021d0f0 100644
--- a/src/Workflow/ClipHelper.h
+++ b/src/Workflow/ClipHelper.h
@@ -36,6 +36,14 @@ class   ClipHelper : public Workflow::Helper
     Q_OBJECT
 
     public:
+        enum    Format
+        {
+            None          = 0,
+            Audio         = 1 << 0,
+            Video         = 1 << 1,
+        };
+        Q_DECLARE_FLAGS( Formats, Format )
+
         ClipHelper( Clip* clip, qint64 begin = -1, qint64 end = -1,
                     const QString& uuid = QString() );
 
@@ -53,12 +61,19 @@ class   ClipHelper : public Workflow::Helper
         ClipWorkflow    *clipWorkflow();
         void            setClipWorkflow( ClipWorkflow* cw );
 
+        Formats         formats() const;
+        void            setFormats( Formats formats );
+
     private:
         Clip*           m_clip;
         ClipWorkflow*   m_clipWorkflow;
 
+        Formats         m_formats;
+
     private slots:
         void        clipDestroyed();
 };
 
+Q_DECLARE_OPERATORS_FOR_FLAGS( ClipHelper::Formats )
+
 #endif // CLIPHELPER_H
-- 
1.9.1



More information about the Vlmc-devel mailing list