]> git.sesse.net Git - mlt/commitdiff
Corrections to cloning
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 5 Oct 2004 08:33:38 +0000 (08:33 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 5 Oct 2004 08:33:38 +0000 (08:33 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@461 d19143bc-622f-0410-bfdd-b5b2a6649095

src/framework/mlt_multitrack.c
src/framework/mlt_producer.c

index 50a9426d9c1c507df26566ea71a12fcf1f3e7207..5d99b3fa63832ecd6525c7f04ba68ad91173318d 100644 (file)
@@ -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 );
index d0cb522e3bc279d9c5a225786cfd7854dbdbf34b..352364ab6f43a8ec79d5d7a52d0f14ae64c05765 100644 (file)
@@ -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;
                }