Commit 343a82b5 authored by luyikei's avatar luyikei
Browse files

MLTTrack: Reimplement the move function to specify position in frames

parent 4e16dae8
......@@ -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 ;
......
......@@ -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*
......
......@@ -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 ;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment