[vlmc-devel] Workflow: Imeplement addEffect

yikei lu luyikei.qmltu at gmail.com
Fri Jul 29 16:45:50 CEST 2016


Indeed, you are right!

2016-07-29 23:44 GMT+09:00 Hugo Beauzée-Luyssen <hugo at beauzee.fr>:
> On 07/28/2016 02:39 PM, Yikai Lu wrote:
>>
>> vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Thu Jul 28
>> 18:01:00 2016 +0900| [8b6524ed707025dc7ca4654118addf066ac8f99b] | committer:
>> Yikai Lu
>>
>> Workflow: Imeplement addEffect
>>
>>>
>>> https://code.videolan.org/videolan/vlmc/commit/8b6524ed707025dc7ca4654118addf066ac8f99b
>>
>> ---
>>
>>  src/Workflow/MainWorkflow.cpp | 27 +++++++++++++++++++++++++++
>>  src/Workflow/MainWorkflow.h   |  3 +++
>>  2 files changed, 30 insertions(+)
>>
>> diff --git a/src/Workflow/MainWorkflow.cpp b/src/Workflow/MainWorkflow.cpp
>> index 41caab8..88f5a84 100644
>> --- a/src/Workflow/MainWorkflow.cpp
>> +++ b/src/Workflow/MainWorkflow.cpp
>> @@ -30,6 +30,7 @@
>>  #include "Backend/MLT/MLTMultiTrack.h"
>>  #include "Backend/MLT/MLTTrack.h"
>>  #include "Renderer/AbstractRenderer.h"
>> +#include "EffectsEngine/EffectHelper.h"
>>  #ifdef WITH_GUI
>>  #include "Gui/WorkflowFileRendererDialog.h"
>>  #endif
>> @@ -304,6 +305,32 @@ MainWorkflow::linkClips( const QString& uuidA, const
>> QString& uuidB )
>>                  }
>>  }
>>
>> +QString
>> +MainWorkflow::addEffect( const QString &clipUuid, const QString &effectId
>> )
>> +{
>> +    EffectHelper* newEffect = nullptr;
>> +
>> +    try
>> +    {
>> +        newEffect = new EffectHelper( effectId );
>
>
> You should create newEffect as a shared_ptr to begin with, in case no clip
> match the given UUID. With the current code, this would leak newEffect.
>
>
>> +    }
>> +    catch( Backend::InvalidServiceException& e )
>> +    {
>> +        return QStringLiteral( "" );
>> +    }
>> +
>> +    for ( auto clip : m_clips )
>> +        if ( clip->uuid().toString() == clipUuid )
>> +        {
>> +            Commands::trigger( new Commands::Effect::Add(
>> +                                   std::shared_ptr<EffectHelper>(
>> newEffect ), clip->input() )
>> +                               );
>> +            return newEffect->uuid().toString();
>> +        }
>> +
>> +    return QStringLiteral( "" );
>> +}
>> +
>>  bool
>>  MainWorkflow::startRenderToFile( const QString &outputFileName, quint32
>> width, quint32 height,
>>                                   double fps, const QString &ar, quint32
>> vbitrate, quint32 abitrate,
>> diff --git a/src/Workflow/MainWorkflow.h b/src/Workflow/MainWorkflow.h
>> index f7a5400..8bc5169 100644
>> --- a/src/Workflow/MainWorkflow.h
>> +++ b/src/Workflow/MainWorkflow.h
>> @@ -161,6 +161,9 @@ class   MainWorkflow : public QObject
>>          Q_INVOKABLE
>>          void                    linkClips( const QString& uuidA, const
>> QString& uuidB );
>>
>> +        Q_INVOKABLE
>> +        QString                 addEffect( const QString& clipUuid, const
>> QString& effectId );
>> +
>>          bool                    startRenderToFile( const QString&
>> outputFileName, quint32 width, quint32 height,
>>                                                     double fps, const
>> QString& ar, quint32 vbitrate, quint32 abitrate,
>>                                                     quint32 nbChannels,
>> quint32 sampleRate );
>>
>> _______________________________________________
>> Vlmc-devel mailing list
>> Vlmc-devel at videolan.org
>> https://mailman.videolan.org/listinfo/vlmc-devel
>>
>
> _______________________________________________
> Vlmc-devel mailing list
> Vlmc-devel at videolan.org
> https://mailman.videolan.org/listinfo/vlmc-devel


More information about the Vlmc-devel mailing list