]> git.sesse.net Git - mlt/commitdiff
Fix handling of length parameter in mlt_playlist_remove_region.
authorDan Dennedy <dan@dennedy.org>
Sun, 26 Jul 2009 17:54:36 +0000 (10:54 -0700)
committerDan Dennedy <dan@dennedy.org>
Sun, 26 Jul 2009 17:54:36 +0000 (10:54 -0700)
This fixes kdenlive bug 1030.
The calls to mlt_playlist_split() inside this function appear to have forgotten that it splits _after_ the specified position.

Signed-off-by: Dan Dennedy <dan@dennedy.org>
src/framework/mlt_playlist.c

index 36ba9b7e8cf98a1a6cf982d7ea679165feb8e5a7..3a03b1bd938b368b068e085911dd8f9ccf74c407 100644 (file)
@@ -1680,7 +1680,6 @@ int mlt_playlist_remove_region( mlt_playlist this, mlt_position position, int le
        {
                mlt_properties properties = MLT_PLAYLIST_PROPERTIES( this );
                int clip_start = mlt_playlist_clip_start( this, index );
-               int clip_length = mlt_playlist_clip_length( this, index );
                int list_length = mlt_producer_get_playtime( MLT_PLAYLIST_PRODUCER( this ) );
                mlt_events_block( properties, this );
 
@@ -1689,14 +1688,13 @@ int mlt_playlist_remove_region( mlt_playlist this, mlt_position position, int le
 
                if ( clip_start < position )
                {
-                       mlt_playlist_split( this, index ++, position - clip_start );
-                       clip_length -= position - clip_start;
+                       mlt_playlist_split( this, index ++, position - clip_start - 1 );
                }
 
                while( length > 0 )
                {
                        if ( mlt_playlist_clip_length( this, index ) > length )
-                               mlt_playlist_split( this, index, length );
+                               mlt_playlist_split( this, index, length - 1 );
                        length -= mlt_playlist_clip_length( this, index );
                        mlt_playlist_remove( this, index );
                }