X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fframework%2Fmlt_playlist.c;h=acf0fd26d0961324bd28cebeb521894f690551db;hb=2e354c12a6ae418b3bf3c526b3370b98a717f70b;hp=7399d51cfc22eed23c72a7234577973787a725e0;hpb=fc5ebbfed65635009b29bdd52a1c0deebadc9157;p=melted diff --git a/src/framework/mlt_playlist.c b/src/framework/mlt_playlist.c index 7399d51..acf0fd2 100644 --- a/src/framework/mlt_playlist.c +++ b/src/framework/mlt_playlist.c @@ -84,6 +84,10 @@ mlt_playlist mlt_playlist_init( ) // Specify the eof condition mlt_properties_set( mlt_playlist_properties( this ), "eof", "pause" ); mlt_properties_set( mlt_playlist_properties( this ), "resource", "" ); + mlt_properties_set( mlt_playlist_properties( this ), "mlt_type", "mlt_producer" ); + + this->size = 10; + this->list = malloc( this->size * sizeof( playlist_entry * ) ); } return this; @@ -167,8 +171,7 @@ static int mlt_playlist_virtual_append( mlt_playlist this, mlt_producer producer { int i; this->list = realloc( this->list, ( this->size + 10 ) * sizeof( playlist_entry * ) ); - for ( i = this->size; i < this->size + 10; i ++ ) - this->list[ i ] = NULL; + for ( i = this->size; i < this->size + 10; i ++ ) this->list[ i ] = NULL; this->size += 10; } @@ -178,7 +181,7 @@ static int mlt_playlist_virtual_append( mlt_playlist this, mlt_producer producer this->list[ this->count ]->frame_out = out; this->list[ this->count ]->frame_count = out - in + 1; - mlt_properties_set( mlt_producer_properties( producer ), "eof", "continue" ); + mlt_properties_set( mlt_producer_properties( producer ), "eof", "pause" ); mlt_producer_set_speed( producer, 0 ); @@ -198,6 +201,8 @@ static mlt_producer mlt_playlist_virtual_seek( mlt_playlist this ) // Map playlist position to real producer in virtual playlist mlt_position position = mlt_producer_frame( &this->parent ); + mlt_position original = position; + // Total number of frames int64_t total = 0; @@ -240,10 +245,11 @@ static mlt_producer mlt_playlist_virtual_seek( mlt_playlist this ) { playlist_entry *entry = this->list[ this->count - 1 ]; mlt_producer this_producer = mlt_playlist_producer( this ); - mlt_producer_seek( this_producer, total - 1 - mlt_producer_get_in( this_producer ) ); + mlt_producer_seek( this_producer, original - 1 ); producer = entry->producer; mlt_producer_seek( producer, entry->frame_out ); mlt_producer_set_speed( this_producer, 0 ); + mlt_producer_set_speed( producer, 0 ); } else if ( !strcmp( eof, "loop" ) && total > 0 ) { @@ -546,18 +552,17 @@ int mlt_playlist_move( mlt_playlist this, int src, int dest ) else if ( current == dest ) current = src; + src_entry = this->list[ src ]; if ( src > dest ) { - int t = dest; - dest = src; - src = t; + for ( i = src; i > dest; i -- ) + this->list[ i ] = this->list[ i - 1 ]; + } + else + { + for ( i = src; i < dest; i ++ ) + this->list[ i ] = this->list[ i + 1 ]; } - - src_entry = this->list[ src ]; - - for ( i = src + 1; i <= dest; i ++ ) - this->list[ i - 1 ] = this->list[ i ]; - this->list[ dest ] = src_entry; mlt_playlist_get_clip_info( this, ¤t_info, current ); @@ -640,7 +645,11 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i void mlt_playlist_close( mlt_playlist this ) { + int i = 0; mlt_producer_close( &this->parent ); mlt_producer_close( &this->blank ); + for ( i = 0; i < this->count; i ++ ) + free( this->list[ i ] ); + free( this->list ); free( this ); }