[vlmc-devel] MLTTrack: Reimplement the move function to specify position in frames
Yikai Lu
git at videolan.org
Thu Jul 28 14:39:28 CEST 2016
vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Thu Jul 28 20:59:02 2016 +0900| [343a82b5dff2c0d9c2c74babd654a096198bf6f0] | committer: Yikai Lu
MLTTrack: Reimplement the move function to specify position in frames
> https://code.videolan.org/videolan/vlmc/commit/343a82b5dff2c0d9c2c74babd654a096198bf6f0
---
src/Backend/ITrack.h | 2 +-
src/Backend/MLT/MLTTrack.cpp | 7 ++++++-
src/Workflow/TrackWorkflow.cpp | 6 +-----
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/Backend/ITrack.h b/src/Backend/ITrack.h
index bf9b9d1..1f2570e 100644
--- a/src/Backend/ITrack.h
+++ b/src/Backend/ITrack.h
@@ -37,7 +37,7 @@ namespace Backend
virtual void replaceWithBlank( int index ) = 0;
virtual bool append( IInput& input ) = 0;
virtual bool remove( int index ) = 0;
- // src and dist are indexes.
+ // src and dist are frames.
virtual bool move( int src, int dist ) = 0;
virtual IInput* clip( int index ) const = 0;
virtual IInput* clipAt( int64_t position ) const = 0 ;
diff --git a/src/Backend/MLT/MLTTrack.cpp b/src/Backend/MLT/MLTTrack.cpp
index bf546f3..89fc96a 100644
--- a/src/Backend/MLT/MLTTrack.cpp
+++ b/src/Backend/MLT/MLTTrack.cpp
@@ -114,7 +114,12 @@ MLTTrack::remove( int index )
bool
MLTTrack::move( int src, int dist )
{
- return !playlist()->move( src, dist );
+ std::unique_ptr<Mlt::Producer> prod(
+ playlist()->replace_with_blank( playlist()->get_clip_index_at( src ) ) );
+ if ( !prod )
+ return false;
+ playlist()->consolidate_blanks( 0 );
+ return !playlist()->insert_at( dist, prod.get(), 1 );
}
Backend::IInput*
diff --git a/src/Workflow/TrackWorkflow.cpp b/src/Workflow/TrackWorkflow.cpp
index d8d4a1c..b78803d 100644
--- a/src/Workflow/TrackWorkflow.cpp
+++ b/src/Workflow/TrackWorkflow.cpp
@@ -130,11 +130,7 @@ TrackWorkflow::moveClip( const QUuid& id, qint64 startingFrame )
{
auto clip = it.value();
auto track = trackFromFormats( it.value()->formats() );
- auto input = track->clipAt( it.key() );
- track->remove( track->clipIndexAt( it.key() ) );
- track->insertAt( *input, startingFrame );
- delete input;
-
+ track->move( it.key(), startingFrame );
m_clips.erase( it );
m_clips.insertMulti( startingFrame, clip );
return ;
More information about the Vlmc-devel
mailing list