X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fframework%2Fmlt_playlist.c;h=1ed7603c029d5a79cc525c8faeff5f118b3111dc;hb=cc8b6005abe30b5f0816b5aa6b87aa6867275228;hp=32179aa35d7a8f5bc07a6f7f208ef1cdf67511c2;hpb=426c659c0b9d0667e2399e60cf81341a51ac040f;p=melted diff --git a/src/framework/mlt_playlist.c b/src/framework/mlt_playlist.c index 32179aa..1ed7603 100644 --- a/src/framework/mlt_playlist.c +++ b/src/framework/mlt_playlist.c @@ -79,6 +79,9 @@ mlt_playlist mlt_playlist_init( ) // Indicate that this producer is a playlist mlt_properties_set_data( mlt_playlist_properties( this ), "playlist", this, 0, NULL, NULL ); + + // Specify the eof condition + mlt_properties_set( mlt_playlist_properties( this ), "eof", "pause" ); } return this; @@ -194,6 +197,9 @@ static mlt_producer mlt_playlist_virtual_seek( mlt_playlist this ) int64_t position = mlt_producer_frame_position( &this->parent, pos ); int64_t total = 0; + mlt_properties properties = mlt_playlist_properties( this ); + char *eof = mlt_properties_get( properties, "eof" ); + // Loop through the virtual playlist int i = 0; @@ -206,7 +212,6 @@ static mlt_producer mlt_playlist_virtual_seek( mlt_playlist this ) { // Found it, now break producer = this->list[ i ]->producer; - position += this->list[ i ]->frame_in; break; } else @@ -219,15 +224,29 @@ static mlt_producer mlt_playlist_virtual_seek( mlt_playlist this ) // Seek in real producer to relative position if ( producer != NULL ) { + position += this->list[ i ]->frame_in; + position += mlt_producer_frame_position( producer, mlt_producer_get_in( producer ) ); mlt_producer_seek_frame( producer, position ); } - else if ( total > 0 ) + else if ( !strcmp( eof, "pause" ) && total > 0 ) { playlist_entry *entry = this->list[ this->count - 1 ]; mlt_producer this_producer = mlt_playlist_producer( this ); mlt_producer_seek_frame( this_producer, total - 1 ); producer = entry->producer; - mlt_producer_seek_frame( producer, entry->frame_out ); + position = mlt_producer_frame_position( producer, mlt_producer_get_in( producer ) ); + mlt_producer_seek_frame( producer, position + entry->frame_out ); + mlt_producer_set_speed( producer, 0 ); + } + else if ( !strcmp( eof, "loop" ) && total > 0 ) + { + playlist_entry *entry = this->list[ 0 ]; + mlt_producer this_producer = mlt_playlist_producer( this ); + mlt_producer_seek_frame( this_producer, 0 ); + producer = entry->producer; + position = entry->frame_in; + position += mlt_producer_frame_position( producer, mlt_producer_get_in( producer ) ); + mlt_producer_seek_frame( producer, position ); } else { @@ -398,8 +417,9 @@ int mlt_playlist_clear( mlt_playlist this ) int mlt_playlist_append( mlt_playlist this, mlt_producer producer ) { // Append to virtual list + int64_t in = mlt_producer_frame_position( producer, mlt_producer_get_in( producer ) ); int64_t out = mlt_producer_frame_position( producer, mlt_producer_get_out( producer ) ); - return mlt_playlist_virtual_append( this, producer, 0, out ); + return mlt_playlist_virtual_append( this, producer, 0, out - in ); } /** Append a producer to the playlist with in/out points.