]> git.sesse.net Git - mlt/commitdiff
mlt_playlist.c: fix some blank-handling bugs in mlt_playlist_insert_at()
authorddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 8 Jan 2008 06:53:42 +0000 (06:53 +0000)
committerddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 8 Jan 2008 06:53:42 +0000 (06:53 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@1046 d19143bc-622f-0410-bfdd-b5b2a6649095

src/framework/mlt_playlist.c

index 240c523ef1bde847b79761564ea506b68ac1a136..7dbbd7b07c073792d7e6cccfb6f0c41014d7b101 100644 (file)
@@ -1271,7 +1271,7 @@ int mlt_playlist_insert_at( mlt_playlist this, mlt_position position, mlt_produc
                if ( clip < this->count && mlt_playlist_is_blank( this, clip ) )
                {
                        // Split and move to new clip if need be
-                       if ( position != info.start && mlt_playlist_split( this, clip, position - info.start ) == 0 )
+                       if ( position != info.start && mlt_playlist_split( this, clip, position - info.start - 1 ) == 0 )
                                mlt_playlist_get_clip_info( this, &info, ++ clip );
 
                        // Split again if need be
@@ -1301,8 +1301,12 @@ int mlt_playlist_insert_at( mlt_playlist this, mlt_position position, mlt_produc
                }
                else 
                {
-                       if ( mode == 1 )
-                               mlt_playlist_blank( this, position - mlt_properties_get_int( properties, "length" ) );
+                       if ( mode == 1 ) {
+                               if ( position == info.start ) 
+                                       mlt_playlist_remove( this, clip );
+                               else
+                                       mlt_playlist_blank( this, position - mlt_properties_get_int( properties, "length" ) - 1 );
+                       }
                        mlt_playlist_append( this, producer );
                        ret = this->count - 1;
                }