]> git.sesse.net Git - mlt/commitdiff
Fix playlist corruption with long blanks (kdenlive-2219).
authorDan Dennedy <dan@dennedy.org>
Sun, 10 Jul 2011 18:40:33 +0000 (11:40 -0700)
committerDan Dennedy <dan@dennedy.org>
Sun, 10 Jul 2011 18:40:33 +0000 (11:40 -0700)
src/framework/mlt_playlist.c

index 3f8f36895d1129d1d02437046e5b2e5e90edb839..356b0d79de09543136165e8c1b8adfe05e41980c 100644 (file)
@@ -234,8 +234,10 @@ static int mlt_playlist_virtual_append( mlt_playlist self, mlt_producer source,
        // If we have a cut, then use the in/out points from the cut
        if ( mlt_producer_is_blank( source )  )
        {
+               mlt_position length = out - in + 1;
+
                // Make sure the blank is long enough to accomodate the length specified
-               if ( out - in + 1 > mlt_producer_get_length( &self->blank ) )
+               if ( length > mlt_producer_get_length( &self->blank ) )
                {
                        mlt_properties blank_props = MLT_PRODUCER_PROPERTIES( &self->blank );
                        mlt_events_block( blank_props, blank_props );
@@ -259,6 +261,10 @@ static int mlt_playlist_virtual_append( mlt_playlist self, mlt_producer source,
                }
 
                properties = MLT_PRODUCER_PROPERTIES( producer );
+
+               // Make sure this cut of blank is long enough
+               if ( length > mlt_producer_get_length( producer ) )
+                       mlt_properties_set_int( properties, "length", length );
        }
        else if ( mlt_producer_is_cut( source ) )
        {
@@ -920,14 +926,18 @@ int mlt_playlist_resize_clip( mlt_playlist self, int clip, mlt_position in, mlt_
 
                if ( mlt_producer_is_blank( producer ) )
                {
-                       // Make sure the blank is long enough to accomodate the length specified
-                       if ( out - in + 1 > mlt_producer_get_length( &self->blank ) )
+                       mlt_position length = out - in + 1;
+
+                       // Make sure the parent blank is long enough to accomodate the length specified
+                       if ( length > mlt_producer_get_length( &self->blank ) )
                        {
                                mlt_properties blank_props = MLT_PRODUCER_PROPERTIES( &self->blank );
-                               mlt_properties_set_int( blank_props, "length", out - in + 1 );
-                               mlt_properties_set_int( MLT_PRODUCER_PROPERTIES( producer ), "length", out - in + 1 );
+                               mlt_properties_set_int( blank_props, "length", length );
                                mlt_producer_set_in_and_out( &self->blank, 0, out - in );
                        }
+                       // Make sure this cut of blank is long enough
+                       if ( length > mlt_producer_get_length( producer ) )
+                               mlt_properties_set_int( MLT_PRODUCER_PROPERTIES( producer ), "length", length );
                }
 
                if ( in < 0 )