From 1ba02504172f43982c821491b87f6bcf661c6f82 Mon Sep 17 00:00:00 2001 From: lilo_booter Date: Tue, 5 Oct 2004 08:33:38 +0000 Subject: [PATCH] Corrections to cloning git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@461 d19143bc-622f-0410-bfdd-b5b2a6649095 --- src/framework/mlt_multitrack.c | 20 ++++++++++++++++++-- src/framework/mlt_producer.c | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/framework/mlt_multitrack.c b/src/framework/mlt_multitrack.c index 50a9426..5d99b3f 100644 --- a/src/framework/mlt_multitrack.c +++ b/src/framework/mlt_multitrack.c @@ -381,6 +381,8 @@ mlt_position mlt_multitrack_clip( mlt_multitrack this, mlt_whence whence, int in out of sync. See playlist logic too. + + This is not as clean as it should be... */ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int index ) @@ -391,14 +393,28 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int ind // Check if we have a track for this index if ( index < this->count && this->list[ index ] != NULL ) { + // Determine the in point + int in = mlt_producer_is_cut( this->list[ index ]->producer ) ? mlt_producer_get_in( this->list[ index ]->producer ) : 0; + // Get the producer for this track - mlt_producer producer = this->list[ index ]->producer; + mlt_producer producer = mlt_producer_cut_parent( this->list[ index ]->producer ); // Obtain the current position mlt_position position = mlt_producer_frame( parent ); + // Get the clone index + int clone_index = mlt_properties_get_int( mlt_producer_properties( this->list[ index ]->producer ), "_clone" ); + + // Additionally, check if we're supposed to use a clone here + if ( clone_index > 0 ) + { + char key[ 25 ]; + sprintf( key, "_clone.%d", clone_index - 1 ); + producer = mlt_properties_get_data( mlt_producer_properties( producer ), key, NULL ); + } + // Make sure we're at the same point - mlt_producer_seek( producer, position ); + mlt_producer_seek( producer, in + position ); // Get the frame from the producer mlt_service_get_frame( mlt_producer_service( producer ), frame, 0 ); diff --git a/src/framework/mlt_producer.c b/src/framework/mlt_producer.c index d0cb522..352364a 100644 --- a/src/framework/mlt_producer.c +++ b/src/framework/mlt_producer.c @@ -440,7 +440,7 @@ static int producer_get_frame( mlt_service service, mlt_frame_ptr frame, int ind if ( clone_index > 0 ) { char key[ 25 ]; - sprintf( key, "_clone.%d", clone_index ); + sprintf( key, "_clone.%d", clone_index - 1 ); clone = mlt_properties_get_data( mlt_producer_properties( mlt_producer_cut_parent( this ) ), key, NULL ); clone = clone == NULL ? this : clone; } -- 1.7.4.4