[vlmc-devel] MLTTrack: Implement replaceWithBlank

Hugo Beauzée-Luyssen hugo at beauzee.fr
Fri Jul 29 15:34:30 CEST 2016


On 07/29/2016 03:30 PM, yikei lu wrote:
> If I use remove( int index ), the producer will be removed and blank
> is not inserted therefore causing wrong length of blanks and tracks.
>
> 2016-07-29 22:24 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
>>> 20:57:17 2016 +0900| [4e16dae848732a1496673e0c5d66417b25011e2f] | committer:
>>> Yikai Lu
>>>
>>> MLTTrack: Implement replaceWithBlank
>>>
>>>>
>>>> https://code.videolan.org/videolan/vlmc/commit/4e16dae848732a1496673e0c5d66417b25011e2f
>>>
>>> ---
>>>
>>>  src/Backend/ITrack.h         | 1 +
>>>  src/Backend/MLT/MLTTrack.cpp | 7 +++++++
>>>  src/Backend/MLT/MLTTrack.h   | 1 +
>>>  3 files changed, 9 insertions(+)
>>>
>>> diff --git a/src/Backend/ITrack.h b/src/Backend/ITrack.h
>>> index 9e2b836..bf9b9d1 100644
>>> --- a/src/Backend/ITrack.h
>>> +++ b/src/Backend/ITrack.h
>>> @@ -34,6 +34,7 @@ namespace Backend
>>>          virtual ~ITrack() = default;
>>>
>>>          virtual bool        insertAt( IInput& input, int64_t startFrame )
>>> = 0;
>>> +        virtual void        replaceWithBlank( int index ) = 0;
>>>          virtual bool        append( IInput& input ) = 0;
>>>          virtual bool        remove( int index ) = 0;
>>>          // src and dist are indexes.
>>> diff --git a/src/Backend/MLT/MLTTrack.cpp b/src/Backend/MLT/MLTTrack.cpp
>>> index 033e0af..bf546f3 100644
>>> --- a/src/Backend/MLT/MLTTrack.cpp
>>> +++ b/src/Backend/MLT/MLTTrack.cpp
>>> @@ -88,6 +88,13 @@ MLTTrack::insertAt( Backend::IInput& input, int64_t
>>> startFrame )
>>>      return !playlist()->insert_at( (int)startFrame, mltInput->producer(),
>>> 1 );
>>>  }
>>>
>>> +void
>>> +MLTTrack::replaceWithBlank( int index )
>>> +{
>>> +    std::unique_ptr<Mlt::Producer> mltProducer(
>>> playlist()->replace_with_blank( index ) );
>>> +    playlist()->consolidate_blanks( 0 );
>>> +}
>>> +
>>>  bool
>>>  MLTTrack::append( Backend::IInput& input )
>>>  {
>>> diff --git a/src/Backend/MLT/MLTTrack.h b/src/Backend/MLT/MLTTrack.h
>>> index 1e77c7b..dadd543 100644
>>> --- a/src/Backend/MLT/MLTTrack.h
>>> +++ b/src/Backend/MLT/MLTTrack.h
>>> @@ -52,6 +52,7 @@ class MLTTrack : public ITrack, public MLTInput
>>>          virtual Mlt::Producer*  producer() const override;
>>>
>>>          virtual bool        insertAt( IInput& input, int64_t startFrame )
>>> override;
>>> +        virtual void        replaceWithBlank( int index ) override;
>>>          virtual bool        append( IInput& input ) override;
>>>          virtual bool        remove( int index ) override;
>>>          virtual bool        move( int src, int dist ) override;
>>>
>>> _______________________________________________
>>> Vlmc-devel mailing list
>>> Vlmc-devel at videolan.org
>>> https://mailman.videolan.org/listinfo/vlmc-devel
>>>
>>
>> Out of curiosity, what's this method purpose? Or more specifically, I
>> suppose it's replacing a media with a blank area, but what's the difference
>> with deleting a media?
>>
>> Regards,
>>
>> _______________________________________________
>> 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
>

Ok I forgot about tracks being playlist.
All clear now :)

However, this seems like an MLT implementation detail, and I'm not so 
high on exposing it publicly.

Regards,


More information about the Vlmc-devel mailing list