]> git.sesse.net Git - mlt/blobdiff - src/framework/mlt_playlist.c
Corrections after valgrinding
[mlt] / src / framework / mlt_playlist.c
index a78ad6df19eaee917accbd68e4b8339e74c1ec17..59dfea40f57935d0d97851d06b34949400a63f5a 100644 (file)
@@ -872,14 +872,14 @@ int mlt_playlist_split_at( mlt_playlist this, mlt_position position, int left )
 
 int mlt_playlist_join( mlt_playlist this, int clip, int count, int merge )
 {
-       int error = clip < 0 || ( clip ) >= this->count;
+       int error = clip < 0 || clip >= this->count;
        if ( error == 0 )
        {
                int i = clip;
                mlt_playlist new_clip = mlt_playlist_init( );
                mlt_events_block( MLT_PLAYLIST_PROPERTIES( this ), this );
                if ( clip + count >= this->count )
-                       count = this->count - clip;
+                       count = this->count - clip - 1;
                for ( i = 0; i <= count; i ++ )
                {
                        playlist_entry *entry = this->list[ clip ];
@@ -1172,7 +1172,7 @@ void mlt_playlist_consolidate_blanks( mlt_playlist this, int keep_length )
                        }
                }
 
-               if ( !keep_length )
+               if ( !keep_length && this->count > 0 )
                {
                        playlist_entry *last = this->list[ this->count - 1 ];
                        if ( mlt_producer_is_blank( last->producer ) )
@@ -1192,6 +1192,14 @@ int mlt_playlist_is_blank( mlt_playlist this, int clip )
        return this == NULL || mlt_producer_is_blank( mlt_playlist_get_clip( this, clip ) );
 }
 
+/** Determine if the specified position is a blank.
+*/
+
+int mlt_playlist_is_blank_at( mlt_playlist this, int position )
+{
+       return this == NULL || mlt_producer_is_blank( mlt_playlist_get_clip_at( this, position ) );
+}
+
 /** Replace the specified clip with a blank and return the clip.
 */
 
@@ -1321,7 +1329,7 @@ int mlt_playlist_clip_start( mlt_playlist this, int clip )
        mlt_playlist_clip_info info;
        if ( mlt_playlist_get_clip_info( this, &info, clip ) == 0 )
                return info.start;
-       return 0;
+       return clip < 0 ? 0 : mlt_producer_get_playtime( MLT_PLAYLIST_PRODUCER( this ) ) + 1;
 }
 
 int mlt_playlist_clip_length( mlt_playlist this, int clip )