[vlmc-devel] ClipHelper: Use flags to manage available outputs

Yikai Lu git at videolan.org
Wed Jun 1 18:14:47 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Tue May  3 12:51:19 2016 +0900| [2fa953c06e0d0b7f679d710e0bc155b67e7f37b2] | committer: Hugo Beauzée-Luyssen

ClipHelper: Use flags to manage available outputs

Since we don't separate tracks according to TrackType, we have to let ClipHelper know which TrackType(s) are available to generate buffers.

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

> https://code.videolan.org/videolan/vlmc/commit/2fa953c06e0d0b7f679d710e0bc155b67e7f37b2
---

 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



More information about the Vlmc-devel mailing list