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

Hugo Beauzée-Luyssen hugo at beauzee.fr
Fri May 13 11:07:15 CEST 2016


On 05/03/2016 07:24 AM, Yikai Lu wrote:
> 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;

That seems like a no-op

> +    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