[vlmc-devel] MLTTrack: Implement replaceWithBlank

Yikai Lu git at videolan.org
Thu Jul 28 14:39:27 CEST 2016


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;



More information about the Vlmc-devel mailing list