]> git.sesse.net Git - mlt/commitdiff
partial corrections to serialisation
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Thu, 15 Jan 2004 11:17:45 +0000 (11:17 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Thu, 15 Jan 2004 11:17:45 +0000 (11:17 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@79 d19143bc-622f-0410-bfdd-b5b2a6649095

26 files changed:
mlt/src/framework/mlt_frame.c
mlt/src/framework/mlt_multitrack.c
mlt/src/framework/mlt_playlist.c
mlt/src/framework/mlt_producer.c
mlt/src/framework/mlt_properties.c
mlt/src/framework/mlt_tractor.c
mlt/src/framework/mlt_transition.c
mlt/src/framework/mlt_transition.h
mlt/src/inigo/inigo.c
mlt/src/modules/core/transition_composite.c
mlt/src/modules/core/transition_luma.c
mlt/src/modules/inigo/producer_inigo.c
mlt/src/tests/charlie.c
src/framework/mlt_frame.c
src/framework/mlt_multitrack.c
src/framework/mlt_playlist.c
src/framework/mlt_producer.c
src/framework/mlt_properties.c
src/framework/mlt_tractor.c
src/framework/mlt_transition.c
src/framework/mlt_transition.h
src/inigo/inigo.c
src/modules/core/transition_composite.c
src/modules/core/transition_luma.c
src/modules/inigo/producer_inigo.c
src/tests/charlie.c

index 1c36cf0d66f3df84d3a810e88d6bb54494eff10c..f8f07870035051b0f7a03b056cdfefc0e6d504d6 100644 (file)
@@ -93,8 +93,7 @@ int mlt_frame_is_test_audio( mlt_frame this )
 
 double mlt_frame_get_aspect_ratio( mlt_frame this )
 {
-       mlt_properties properties = mlt_frame_properties( this );
-       return mlt_properties_get_double( properties, "aspect_ratio" );
+       return mlt_properties_get_double( mlt_frame_properties( this ), "aspect_ratio" );
 }
 
 /** Set the aspect ratio of the frame.
@@ -102,8 +101,7 @@ double mlt_frame_get_aspect_ratio( mlt_frame this )
 
 int mlt_frame_set_aspect_ratio( mlt_frame this, double value )
 {
-       mlt_properties properties = mlt_frame_properties( this );
-       return mlt_properties_set_double( properties, "aspect_ratio", value );
+       return mlt_properties_set_double( mlt_frame_properties( this ), "aspect_ratio", value );
 }
 
 /** Get the position of this frame.
@@ -111,8 +109,7 @@ int mlt_frame_set_aspect_ratio( mlt_frame this, double value )
 
 mlt_position mlt_frame_get_position( mlt_frame this )
 {
-       mlt_properties properties = mlt_frame_properties( this );
-       return mlt_properties_get_position( properties, "position" );
+       return mlt_properties_get_position( mlt_frame_properties( this ), "position" );
 }
 
 /** Set the position of this frame.
@@ -120,8 +117,7 @@ mlt_position mlt_frame_get_position( mlt_frame this )
 
 int mlt_frame_set_position( mlt_frame this, mlt_position value )
 {
-       mlt_properties properties = mlt_frame_properties( this );
-       return mlt_properties_set_position( properties, "position", value );
+       return mlt_properties_set_position( mlt_frame_properties( this ), "position", value );
 }
 
 /** Stack a get_image callback.
index 59b2383227cf3fa2061eb3cc8124368c3dd695e2..28d598f5dc9600ffeb3855cad7043294417ff57a 100644 (file)
@@ -61,6 +61,7 @@ mlt_multitrack mlt_multitrack_init( )
                        producer->get_frame = producer_get_frame;
                        mlt_properties_set_data( properties, "multitrack", this, 0, NULL, NULL );
                        mlt_properties_set( properties, "log_id", "multitrack" );
+                       mlt_properties_set( properties, "resource", "<mulitrack>" );
                }
                else
                {
index ff9e27386ba3ec2960a54e715934073b6061d919..8bdbe4bda67a069f0b3e9ed74943cf5d70109b84 100644 (file)
@@ -81,6 +81,7 @@ 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", "<playlist>" );
        }
        
        return this;
@@ -175,6 +176,8 @@ 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_producer_set_speed( producer, 0 );
 
        this->count ++;
index f4e5bd591f86333027db308d0e13f1853cf55938..c8a3e69e2699112f5167797d54d69e0896e5acbd 100644 (file)
@@ -61,7 +61,8 @@ int mlt_producer_init( mlt_producer this, void *child )
                mlt_properties_set_position( properties, "out", 1799999 );
                mlt_properties_set_position( properties, "length", 1800000 );
                mlt_properties_set_double( properties, "aspect_ratio", 4.0 / 3.0 );
-               mlt_properties_set( properties, "log_id", "multitrack" );
+               mlt_properties_set( properties, "eof", "pause" );
+               mlt_properties_set( properties, "resource", "<producer>" );
 
                // Override service get_frame
                parent->get_frame = producer_get_frame;
@@ -91,10 +92,13 @@ mlt_properties mlt_producer_properties( mlt_producer this )
 
 int mlt_producer_seek( mlt_producer this, mlt_position position )
 {
+       // Determine eof handling
+       char *eof = mlt_properties_get( mlt_producer_properties( this ), "eof" );
+
        // Check bounds
        if ( position < 0 )
                position = 0;
-       else if ( position > mlt_producer_get_playtime( this ) )
+       else if ( !strcmp( eof, "pause" ) && position >= mlt_producer_get_playtime( this ) )
                position = mlt_producer_get_playtime( this ) - 1;
 
        // Set the position
@@ -119,7 +123,11 @@ mlt_position mlt_producer_position( mlt_producer this )
 
 mlt_position mlt_producer_frame( mlt_producer this )
 {
-       return mlt_properties_get_double( mlt_producer_properties( this ), "frame" );
+       //char *resource = mlt_properties_get( mlt_producer_properties( this ), "resource" );
+       //mlt_position frame = mlt_properties_get_position( mlt_producer_properties( this ), "frame" );
+       //mlt_position position = mlt_properties_get_position( mlt_producer_properties( this ), "position" );
+       //fprintf( stderr, "%s: %lld %lld\n", resource, frame, position );
+       return mlt_properties_get_position( mlt_producer_properties( this ), "frame" );
 }
 
 /** Set the playing speed.
@@ -214,7 +222,7 @@ mlt_position mlt_producer_get_length( mlt_producer this )
 
 void mlt_producer_prepare_next( mlt_producer this )
 {
-       mlt_producer_seek( this, mlt_producer_frame( this ) + mlt_producer_get_speed( this ) );
+       mlt_producer_seek( this, mlt_producer_position( this ) + mlt_producer_get_speed( this ) );
 }
 
 /** Get a frame.
@@ -225,13 +233,11 @@ static int producer_get_frame( mlt_service service, mlt_frame_ptr frame, int ind
        int result = 1;
        mlt_producer this = service->child;
 
+       // Determine eof handling
+       char *eof = mlt_properties_get( mlt_producer_properties( this ), "eof" );
+
        // A properly instatiated producer will have a get_frame method...
-       if ( this->get_frame != NULL )
-       {
-               // Get the frame from the implementation
-               result = this->get_frame( this, frame, index );
-       }
-       else
+       if ( this->get_frame == NULL || ( !strcmp( eof, "continue" ) && mlt_producer_position( this ) > mlt_producer_get_out( this ) ) )
        {
                // Generate a test frame
                *frame = mlt_frame_init( );
@@ -242,6 +248,11 @@ static int producer_get_frame( mlt_service service, mlt_frame_ptr frame, int ind
                // Calculate the next position
                mlt_producer_prepare_next( this );
        }
+       else
+       {
+               // Get the frame from the implementation
+               result = this->get_frame( this, frame, index );
+       }
 
        // Copy the fps and speed of the producer onto the frame
        mlt_properties properties = mlt_frame_properties( *frame );
index d047da0c2ae503d23fd2c32d64695ca5e3e6717b..a0f39f224ced812e278e6c72cc9cdd5d5abe1d82 100644 (file)
@@ -342,13 +342,9 @@ void mlt_properties_close( mlt_properties this )
        property_list *list = this->private;
        int index = 0;
 
-       int debug = mlt_properties_get_int( this, "debug" );
-
        // Clean up names and values
        for ( index = 0; index < list->count; index ++ )
        {
-               if ( debug )
-                       fprintf( stderr, "closing %s\n", list->name[ index ] );
                free( list->name[ index ] );
                mlt_property_close( list->value[ index ] );
        }
index 8d6247d40d1ca2c76ee1f33586bb0c104d3444a2..72f9e724723b01779e26da30c633eab1d7b96154 100644 (file)
@@ -55,6 +55,7 @@ mlt_tractor mlt_tractor_init( )
                if ( mlt_producer_init( producer, this ) == 0 )
                {
                        producer->get_frame = producer_get_frame;
+                       mlt_properties_set( mlt_producer_properties( producer ), "resource", "<tractor>" );
                }
                else
                {
@@ -119,6 +120,8 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra
                int looking = 1;
                int done = 0;
                mlt_frame temp = NULL;
+               mlt_frame store[ 10 ];
+               int count = 0;
 
                // Get the properties of the parent producer
                mlt_properties properties = mlt_producer_properties( parent );
@@ -154,25 +157,28 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra
                                // Use this as output if we don't have one already
                                *frame = temp;
                        }
-                       else if ( ( !mlt_frame_is_test_card( temp ) || !mlt_frame_is_test_audio( temp ) ) && 
-                                           mlt_producer_frame( parent ) == mlt_properties_get_position( mlt_frame_properties( temp ), "position" ) )
+                       else if ( ( !mlt_frame_is_test_card( temp ) || !mlt_frame_is_test_audio( temp ) ) && looking &&
+                                           mlt_producer_position( parent ) == mlt_properties_get_position( mlt_frame_properties( temp ), "position" ) )
                        {
                                *frame = temp;
                                looking = 0;
                        }
-                       else if ( ( !mlt_frame_is_test_card( temp ) || !mlt_frame_is_test_audio( temp ) ) && looking )
-                       {
-                               // This is the one we want and we can stop looking
-                               *frame = temp;
-                               looking = 0;
-                       }
                        else
                        {
-                               // We discard all other frames
-                               mlt_frame_close( temp );
+                               // We store all other frames for now
+                               store[ count ++ ] = temp;
                        }
                }
 
+               // Now place all the unused frames on to the properties (will be destroyed automatically)
+               while ( count -- )
+               {
+                       mlt_properties frame_properties = mlt_frame_properties( *frame );
+                       char label[ 30 ];
+                       sprintf( label, "tractor_%d", count );
+                       mlt_properties_set_data( frame_properties, label, store[ count ], 0, ( mlt_destructor )mlt_frame_close, NULL );
+               }
+
                // Prepare the next frame
                mlt_producer_prepare_next( parent );
 
index 50715501dea486ca2cf0072dedcd33d18bf82bfb..b4024fbaa0a6f4132cdae883b571746f3835fb59 100644 (file)
@@ -103,8 +103,7 @@ void mlt_transition_set_in_and_out( mlt_transition this, mlt_position in, mlt_po
 
 int mlt_transition_get_a_track( mlt_transition this )
 {
-       mlt_properties properties = mlt_transition_properties( this );
-       return mlt_properties_get_int( properties, "a_track" );
+       return mlt_properties_get_int( mlt_transition_properties( this ), "a_track" );
 }
 
 /** Get the index of the b track.
@@ -112,8 +111,7 @@ int mlt_transition_get_a_track( mlt_transition this )
 
 int mlt_transition_get_b_track( mlt_transition this )
 {
-       mlt_properties properties = mlt_transition_properties( this );
-       return mlt_properties_get_int( properties, "b_track" );
+       return mlt_properties_get_int( mlt_transition_properties( this ), "b_track" );
 }
 
 /** Get the in point.
@@ -121,8 +119,7 @@ int mlt_transition_get_b_track( mlt_transition this )
 
 mlt_position mlt_transition_get_in( mlt_transition this )
 {
-       mlt_properties properties = mlt_transition_properties( this );
-       return mlt_properties_get_position( properties, "in" );
+       return mlt_properties_get_position( mlt_transition_properties( this ), "in" );
 }
 
 /** Get the out point.
@@ -130,32 +127,20 @@ mlt_position mlt_transition_get_in( mlt_transition this )
 
 mlt_position mlt_transition_get_out( mlt_transition this )
 {
-       mlt_properties properties = mlt_transition_properties( this );
-       return mlt_properties_get_position( properties, "out" );
+       return mlt_properties_get_position( mlt_transition_properties( this ), "out" );
 }
 
 /** Process the frame.
+
+       If we have no process method (unlikely), we simply return the a_frame unmolested.
 */
 
 static mlt_frame transition_process( mlt_transition this, mlt_frame a_frame, mlt_frame b_frame )
 {
        if ( this->process == NULL )
-       {
-               if ( !mlt_frame_is_test_card( a_frame ) )
-               {
-                       mlt_frame_close( b_frame );
-                       return a_frame;
-               }
-               else
-               {
-                       mlt_frame_close( a_frame );
-                       return b_frame;
-               }
-       }
+               return a_frame;
        else
-       {
                return this->process( this, a_frame, b_frame );
-       }
 }
 
 /** Get a frame from this filter.
@@ -165,14 +150,12 @@ static mlt_frame transition_process( mlt_transition this, mlt_frame a_frame, mlt
        method for all tracks, we have to take special care that we only obtain the a and
        b frames once - we do this on the first call to get a frame from either a or b.
        
-       After that, we have 3 cases to resolve:
+       After that, we have 2 cases to resolve:
        
        1)      if the track is the a_track and we're in the time zone, then we need to call the
-               process method to do the effect on the frame (we assign NULL to the a_frame and
-               b_frames here) otherwise, we pass on the a_frame unmolested;
-       2)      if the track is the b_track and we're the in the time zone OR the b_frame is NULL,
-               then we generate a test card frame, otherwise we pass on the b frame unmolested;
-       3)      For all other tracks, we get the frames on demand.
+               process method to do the effect on the frame and remember we've passed it on
+               otherwise, we pass on the a_frame unmolested;
+       2)      For all other tracks, we get the frames on demand.
 */
 
 static int transition_get_frame( mlt_service service, mlt_frame_ptr frame, int index )
@@ -187,11 +170,12 @@ static int transition_get_frame( mlt_service service, mlt_frame_ptr frame, int i
        mlt_position out = mlt_properties_get_position( properties, "out" );
 
        // Fetch a and b frames together...
-       if ( ( index == a_track || index == b_track ) &&
-                ( this->a_frame == NULL && this->b_frame == NULL ) )
+       if ( ( index == a_track || index == b_track ) && !( this->a_held || this->b_held ) )
        {
                mlt_service_get_frame( this->producer, &this->a_frame, a_track );
                mlt_service_get_frame( this->producer, &this->b_frame, b_track );
+               this->a_held = 1;
+               this->b_held = 1;
        }
        
        // Special case track processing
@@ -199,45 +183,25 @@ static int transition_get_frame( mlt_service service, mlt_frame_ptr frame, int i
        {
                // Determine if we're in the right time zone
                mlt_position position = mlt_frame_get_position( this->a_frame );
-               if ( position >= in && position < out )
+               if ( position >= in && position <= out )
                {
                        // Process the transition
                        *frame = transition_process( this, this->a_frame, this->b_frame );
-                       
-                       // Important - NULL both frames now so that we know they're done...
-                       this->a_frame = NULL;
-                       this->b_frame = NULL;
+                       this->a_held = 0;
                }
                else
                {
                        // Pass on the 'a frame' and remember that we've done it
                        *frame = this->a_frame;
-                       this->a_frame = NULL;
-               }                       
+                       this->a_held = 0;
+               }
                return 0;
        }
        if ( index == b_track )
        {
-               if ( this->b_frame == NULL )
-               {
-                       // We're *probably* in the zone and the a frame has been requested
-                       *frame = mlt_frame_init( );
-               }
-               else
-               {
-                       mlt_position position = mlt_frame_get_position( this->b_frame );
-                       if ( position >= in && position < out )
-                       {
-                               // We're in the zone, but the 'a frame' has not been requested yet
-                               *frame = mlt_frame_init( );
-                       }
-                       else
-                       {
-                               // We're out of the zone, pass on b and remember that we've done it
-                               *frame = this->b_frame;
-                               this->b_frame = NULL;
-                       }
-               }
+               // Pass on the 'b frame' and remember that we've done it
+               *frame = this->b_frame;
+               this->b_held = 0;
                return 0;
        }
        else
index c297bdbcdbbd1ab7888bda34cdcad860a4030e79..1dad6c19a88d6cc831b86859c4c29bb9ac081260 100644 (file)
@@ -46,6 +46,8 @@ struct mlt_transition_s
        // Private
        mlt_frame a_frame;
        mlt_frame b_frame;
+       int a_held;
+       int b_held;
 };
 
 /** Public final methods
index fa76e647b44998af6a68177e105c41aa836d7485..6a1260550e8d449474863b27eee9b70368201304 100644 (file)
@@ -227,7 +227,6 @@ int main( int argc, char **argv )
 
                        // Transport functionality
                        transport( inigo );
-                       
                }
                else if ( store != NULL )
                {
index c2ba62dd862a08e761f2c8dca7b00622eb219066..ef896a9ff7b5678dd586a487ec1ff9222ceefb2d 100644 (file)
@@ -69,9 +69,6 @@ static int transition_get_image( mlt_frame this, uint8_t **image, mlt_image_form
                *width = mlt_properties_get_int( a_props, "width" );
                *height = mlt_properties_get_int( a_props, "height" );
                *image = mlt_properties_get_data( a_props, "image", NULL );
-
-               // Close the b_frame
-               mlt_frame_close( b_frame );
        }
        else if ( a_props != NULL )
        {
index fc712eaa0c15f22839536cb605b3cd0e0a203dce..5e0dd0fe90217741f961cbf7cd6a4c8f9a50ad22 100644 (file)
@@ -176,9 +176,6 @@ static int transition_get_image( mlt_frame this, uint8_t **image, mlt_image_form
        *height = mlt_properties_get_int( a_props, "height" );
        *image = mlt_properties_get_data( a_props, "image", NULL );
 
-       // Close the b_frame
-       mlt_frame_close( b_frame );
-       
        previous_mix = mix;
 
        return 0;
@@ -342,7 +339,7 @@ static mlt_frame transition_process( mlt_transition transition, mlt_frame a_fram
        mlt_position in = mlt_transition_get_in( transition );
        mlt_position out = mlt_transition_get_out( transition );
        mlt_position time = mlt_frame_get_position( b_frame );
-       double pos = ( (double)time - (double)in ) / ( (double)out - (double)in + 1 );
+       double pos = ( double )( time - in ) / ( double )( out - in + 1 );
        
        // Set the b frame properties
        mlt_properties_set_double( b_props, "mix", pos );
index 62e02b26dd05aeb3f192c655b4510bd8aded516d..5c60e29d8aa9b22b4e889a5f5e8d42f60b3c0f8e 100644 (file)
@@ -44,6 +44,7 @@ static mlt_producer parse_inigo( char *file )
        }
 
        mlt_producer result = producer_inigo_init( args );
+
        if ( result != NULL )
        {
                mlt_properties properties = mlt_producer_properties( result );
@@ -135,11 +136,6 @@ static mlt_transition create_transition( mlt_field field, char *id, int track )
        return transition;
 }
 
-static void set_properties( mlt_properties properties, char *namevalue )
-{
-       mlt_properties_parse( properties, namevalue );
-}
-
 mlt_producer producer_inigo_init( char **argv )
 {
        int i;
@@ -203,7 +199,7 @@ mlt_producer producer_inigo_init( char **argv )
                }
                else if ( strstr( argv[ i ], "=" ) )
                {
-                       set_properties( properties, argv[ i ] );
+                       mlt_properties_parse( properties, argv[ i ] );
                }
                else if ( argv[ i ][ 0 ] != '-' )
                {
@@ -247,6 +243,7 @@ mlt_producer producer_inigo_init( char **argv )
        mlt_properties_set_data( props, "multitrack", multitrack, 0, NULL, NULL );
        mlt_properties_set_data( props, "field", field, 0, NULL, NULL );
        mlt_properties_set_data( props, "group", group, 0, NULL, NULL );
+       mlt_properties_set_position( props, "length", mlt_producer_get_out( mlt_multitrack_producer( multitrack ) ) + 1 );
        mlt_producer_set_in_and_out( prod, 0, mlt_producer_get_out( mlt_multitrack_producer( multitrack ) ) );
        mlt_properties_set_double( props, "fps", mlt_producer_get_fps( mlt_multitrack_producer( multitrack ) ) );
 
index bcd4dae68008873c0658b41483ce6a35d20bf05b..f4086e4c3beab430dae342cf3097c8ed3bc787ba 100644 (file)
@@ -11,7 +11,12 @@ mlt_producer create_producer( char *file )
        mlt_producer result = NULL;
 
        // 1st Line preferences
-       if ( strstr( file, ".mpg" ) )
+       if ( strstr( file, ".inigo" ) )
+       {
+               char *args[ 2 ] = { file, NULL };
+               result = mlt_factory_producer( "inigo", args );
+       }
+       else if ( strstr( file, ".mpg" ) )
                result = mlt_factory_producer( "mcmpeg", file );
        else if ( strstr( file, ".mpeg" ) )
                result = mlt_factory_producer( "mcmpeg", file );
@@ -104,20 +109,6 @@ void track_service( mlt_field field, void *service, mlt_destructor destructor )
        mlt_properties_set_int( properties, "registered", ++ registered );
 }
 
-mlt_filter create_filter( mlt_field field, char *id, int track )
-{
-       char *arg = strchr( id, ':' );
-       if ( arg != NULL )
-               *arg ++ = '\0';
-       mlt_filter filter = mlt_factory_filter( id, arg );
-       if ( filter != NULL )
-       {
-               mlt_field_plant_filter( field, filter, track );
-               track_service( field, filter, ( mlt_destructor )mlt_filter_close );
-       }
-       return filter;
-}
-
 void set_properties( mlt_service service, char *namevalue )
 {
        mlt_properties properties = mlt_service_properties( service );
@@ -143,10 +134,8 @@ int main( int argc, char **argv )
        int i;
        mlt_service  service = NULL;
        mlt_consumer consumer = NULL;
-       mlt_multitrack multitrack = NULL;
        mlt_producer producer = NULL;
        mlt_playlist playlist = NULL;
-       mlt_field field = NULL;
 
        // Construct the factory
        mlt_factory_init( getenv( "MLT_REPOSITORY" ) );
@@ -154,31 +143,15 @@ int main( int argc, char **argv )
        // Set up containers
        playlist = mlt_playlist_init( );
 
-       // Construct the field
-       field = mlt_field_init( );
-
-       // We need to track the number of registered filters
-       mlt_properties properties = mlt_field_properties( field );
-       mlt_properties_set_int( properties, "registered", 0 );
-
-       // Get the multitrack from the field
-       multitrack = mlt_field_multitrack( field );
-
        // Parse the arguments
        for ( i = 1; i < argc; i ++ )
        {
                if ( !strcmp( argv[ i ], "-consumer" ) )
                {
-                       consumer = create_consumer( argv[ ++ i ], mlt_multitrack_producer( multitrack ) );
+                       consumer = create_consumer( argv[ ++ i ], mlt_playlist_producer( playlist ) );
                        if ( consumer != NULL )
                                service = mlt_consumer_service( consumer );
                }
-               else if ( !strcmp( argv[ i ], "-filter" ) )
-               {
-                       mlt_filter filter = create_filter( field, argv[ ++ i ], 0 );
-                       if ( filter != NULL )
-                               service = mlt_filter_service( filter );
-               }
                else if ( !strstr( argv[ i ], "=" ) )
                {
                        if ( producer != NULL )
@@ -195,25 +168,21 @@ int main( int argc, char **argv )
 
        // If we have no consumer, default to sdl
        if ( consumer == NULL )
-               consumer = create_consumer( "sdl", mlt_multitrack_producer( multitrack ) );
+               consumer = create_consumer( "sdl", mlt_playlist_producer( playlist ) );
 
        // Connect producer to playlist
        if ( producer != NULL )
                mlt_playlist_append( playlist, producer );
 
-       // Connect multitrack to producer
-       mlt_multitrack_connect( multitrack, mlt_playlist_producer( playlist ), 0 );
-
-       // Connect consumer to tractor
-       mlt_consumer_connect( consumer, mlt_field_service( field ) );
+       // Connect consumer to playlist
+       mlt_consumer_connect( consumer, mlt_playlist_service( playlist ) );
 
        // Transport functionality
-       transport( mlt_multitrack_producer( multitrack ) );
+       transport( mlt_playlist_producer( playlist ) );
 
        // Close the services
        mlt_consumer_close( consumer );
-       mlt_field_close( field );
-       mlt_producer_close( producer );
+       mlt_playlist_close( playlist );
 
        // Close the factory
        mlt_factory_close( );
index 1c36cf0d66f3df84d3a810e88d6bb54494eff10c..f8f07870035051b0f7a03b056cdfefc0e6d504d6 100644 (file)
@@ -93,8 +93,7 @@ int mlt_frame_is_test_audio( mlt_frame this )
 
 double mlt_frame_get_aspect_ratio( mlt_frame this )
 {
-       mlt_properties properties = mlt_frame_properties( this );
-       return mlt_properties_get_double( properties, "aspect_ratio" );
+       return mlt_properties_get_double( mlt_frame_properties( this ), "aspect_ratio" );
 }
 
 /** Set the aspect ratio of the frame.
@@ -102,8 +101,7 @@ double mlt_frame_get_aspect_ratio( mlt_frame this )
 
 int mlt_frame_set_aspect_ratio( mlt_frame this, double value )
 {
-       mlt_properties properties = mlt_frame_properties( this );
-       return mlt_properties_set_double( properties, "aspect_ratio", value );
+       return mlt_properties_set_double( mlt_frame_properties( this ), "aspect_ratio", value );
 }
 
 /** Get the position of this frame.
@@ -111,8 +109,7 @@ int mlt_frame_set_aspect_ratio( mlt_frame this, double value )
 
 mlt_position mlt_frame_get_position( mlt_frame this )
 {
-       mlt_properties properties = mlt_frame_properties( this );
-       return mlt_properties_get_position( properties, "position" );
+       return mlt_properties_get_position( mlt_frame_properties( this ), "position" );
 }
 
 /** Set the position of this frame.
@@ -120,8 +117,7 @@ mlt_position mlt_frame_get_position( mlt_frame this )
 
 int mlt_frame_set_position( mlt_frame this, mlt_position value )
 {
-       mlt_properties properties = mlt_frame_properties( this );
-       return mlt_properties_set_position( properties, "position", value );
+       return mlt_properties_set_position( mlt_frame_properties( this ), "position", value );
 }
 
 /** Stack a get_image callback.
index 59b2383227cf3fa2061eb3cc8124368c3dd695e2..28d598f5dc9600ffeb3855cad7043294417ff57a 100644 (file)
@@ -61,6 +61,7 @@ mlt_multitrack mlt_multitrack_init( )
                        producer->get_frame = producer_get_frame;
                        mlt_properties_set_data( properties, "multitrack", this, 0, NULL, NULL );
                        mlt_properties_set( properties, "log_id", "multitrack" );
+                       mlt_properties_set( properties, "resource", "<mulitrack>" );
                }
                else
                {
index ff9e27386ba3ec2960a54e715934073b6061d919..8bdbe4bda67a069f0b3e9ed74943cf5d70109b84 100644 (file)
@@ -81,6 +81,7 @@ 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", "<playlist>" );
        }
        
        return this;
@@ -175,6 +176,8 @@ 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_producer_set_speed( producer, 0 );
 
        this->count ++;
index f4e5bd591f86333027db308d0e13f1853cf55938..c8a3e69e2699112f5167797d54d69e0896e5acbd 100644 (file)
@@ -61,7 +61,8 @@ int mlt_producer_init( mlt_producer this, void *child )
                mlt_properties_set_position( properties, "out", 1799999 );
                mlt_properties_set_position( properties, "length", 1800000 );
                mlt_properties_set_double( properties, "aspect_ratio", 4.0 / 3.0 );
-               mlt_properties_set( properties, "log_id", "multitrack" );
+               mlt_properties_set( properties, "eof", "pause" );
+               mlt_properties_set( properties, "resource", "<producer>" );
 
                // Override service get_frame
                parent->get_frame = producer_get_frame;
@@ -91,10 +92,13 @@ mlt_properties mlt_producer_properties( mlt_producer this )
 
 int mlt_producer_seek( mlt_producer this, mlt_position position )
 {
+       // Determine eof handling
+       char *eof = mlt_properties_get( mlt_producer_properties( this ), "eof" );
+
        // Check bounds
        if ( position < 0 )
                position = 0;
-       else if ( position > mlt_producer_get_playtime( this ) )
+       else if ( !strcmp( eof, "pause" ) && position >= mlt_producer_get_playtime( this ) )
                position = mlt_producer_get_playtime( this ) - 1;
 
        // Set the position
@@ -119,7 +123,11 @@ mlt_position mlt_producer_position( mlt_producer this )
 
 mlt_position mlt_producer_frame( mlt_producer this )
 {
-       return mlt_properties_get_double( mlt_producer_properties( this ), "frame" );
+       //char *resource = mlt_properties_get( mlt_producer_properties( this ), "resource" );
+       //mlt_position frame = mlt_properties_get_position( mlt_producer_properties( this ), "frame" );
+       //mlt_position position = mlt_properties_get_position( mlt_producer_properties( this ), "position" );
+       //fprintf( stderr, "%s: %lld %lld\n", resource, frame, position );
+       return mlt_properties_get_position( mlt_producer_properties( this ), "frame" );
 }
 
 /** Set the playing speed.
@@ -214,7 +222,7 @@ mlt_position mlt_producer_get_length( mlt_producer this )
 
 void mlt_producer_prepare_next( mlt_producer this )
 {
-       mlt_producer_seek( this, mlt_producer_frame( this ) + mlt_producer_get_speed( this ) );
+       mlt_producer_seek( this, mlt_producer_position( this ) + mlt_producer_get_speed( this ) );
 }
 
 /** Get a frame.
@@ -225,13 +233,11 @@ static int producer_get_frame( mlt_service service, mlt_frame_ptr frame, int ind
        int result = 1;
        mlt_producer this = service->child;
 
+       // Determine eof handling
+       char *eof = mlt_properties_get( mlt_producer_properties( this ), "eof" );
+
        // A properly instatiated producer will have a get_frame method...
-       if ( this->get_frame != NULL )
-       {
-               // Get the frame from the implementation
-               result = this->get_frame( this, frame, index );
-       }
-       else
+       if ( this->get_frame == NULL || ( !strcmp( eof, "continue" ) && mlt_producer_position( this ) > mlt_producer_get_out( this ) ) )
        {
                // Generate a test frame
                *frame = mlt_frame_init( );
@@ -242,6 +248,11 @@ static int producer_get_frame( mlt_service service, mlt_frame_ptr frame, int ind
                // Calculate the next position
                mlt_producer_prepare_next( this );
        }
+       else
+       {
+               // Get the frame from the implementation
+               result = this->get_frame( this, frame, index );
+       }
 
        // Copy the fps and speed of the producer onto the frame
        mlt_properties properties = mlt_frame_properties( *frame );
index d047da0c2ae503d23fd2c32d64695ca5e3e6717b..a0f39f224ced812e278e6c72cc9cdd5d5abe1d82 100644 (file)
@@ -342,13 +342,9 @@ void mlt_properties_close( mlt_properties this )
        property_list *list = this->private;
        int index = 0;
 
-       int debug = mlt_properties_get_int( this, "debug" );
-
        // Clean up names and values
        for ( index = 0; index < list->count; index ++ )
        {
-               if ( debug )
-                       fprintf( stderr, "closing %s\n", list->name[ index ] );
                free( list->name[ index ] );
                mlt_property_close( list->value[ index ] );
        }
index 8d6247d40d1ca2c76ee1f33586bb0c104d3444a2..72f9e724723b01779e26da30c633eab1d7b96154 100644 (file)
@@ -55,6 +55,7 @@ mlt_tractor mlt_tractor_init( )
                if ( mlt_producer_init( producer, this ) == 0 )
                {
                        producer->get_frame = producer_get_frame;
+                       mlt_properties_set( mlt_producer_properties( producer ), "resource", "<tractor>" );
                }
                else
                {
@@ -119,6 +120,8 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra
                int looking = 1;
                int done = 0;
                mlt_frame temp = NULL;
+               mlt_frame store[ 10 ];
+               int count = 0;
 
                // Get the properties of the parent producer
                mlt_properties properties = mlt_producer_properties( parent );
@@ -154,25 +157,28 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra
                                // Use this as output if we don't have one already
                                *frame = temp;
                        }
-                       else if ( ( !mlt_frame_is_test_card( temp ) || !mlt_frame_is_test_audio( temp ) ) && 
-                                           mlt_producer_frame( parent ) == mlt_properties_get_position( mlt_frame_properties( temp ), "position" ) )
+                       else if ( ( !mlt_frame_is_test_card( temp ) || !mlt_frame_is_test_audio( temp ) ) && looking &&
+                                           mlt_producer_position( parent ) == mlt_properties_get_position( mlt_frame_properties( temp ), "position" ) )
                        {
                                *frame = temp;
                                looking = 0;
                        }
-                       else if ( ( !mlt_frame_is_test_card( temp ) || !mlt_frame_is_test_audio( temp ) ) && looking )
-                       {
-                               // This is the one we want and we can stop looking
-                               *frame = temp;
-                               looking = 0;
-                       }
                        else
                        {
-                               // We discard all other frames
-                               mlt_frame_close( temp );
+                               // We store all other frames for now
+                               store[ count ++ ] = temp;
                        }
                }
 
+               // Now place all the unused frames on to the properties (will be destroyed automatically)
+               while ( count -- )
+               {
+                       mlt_properties frame_properties = mlt_frame_properties( *frame );
+                       char label[ 30 ];
+                       sprintf( label, "tractor_%d", count );
+                       mlt_properties_set_data( frame_properties, label, store[ count ], 0, ( mlt_destructor )mlt_frame_close, NULL );
+               }
+
                // Prepare the next frame
                mlt_producer_prepare_next( parent );
 
index 50715501dea486ca2cf0072dedcd33d18bf82bfb..b4024fbaa0a6f4132cdae883b571746f3835fb59 100644 (file)
@@ -103,8 +103,7 @@ void mlt_transition_set_in_and_out( mlt_transition this, mlt_position in, mlt_po
 
 int mlt_transition_get_a_track( mlt_transition this )
 {
-       mlt_properties properties = mlt_transition_properties( this );
-       return mlt_properties_get_int( properties, "a_track" );
+       return mlt_properties_get_int( mlt_transition_properties( this ), "a_track" );
 }
 
 /** Get the index of the b track.
@@ -112,8 +111,7 @@ int mlt_transition_get_a_track( mlt_transition this )
 
 int mlt_transition_get_b_track( mlt_transition this )
 {
-       mlt_properties properties = mlt_transition_properties( this );
-       return mlt_properties_get_int( properties, "b_track" );
+       return mlt_properties_get_int( mlt_transition_properties( this ), "b_track" );
 }
 
 /** Get the in point.
@@ -121,8 +119,7 @@ int mlt_transition_get_b_track( mlt_transition this )
 
 mlt_position mlt_transition_get_in( mlt_transition this )
 {
-       mlt_properties properties = mlt_transition_properties( this );
-       return mlt_properties_get_position( properties, "in" );
+       return mlt_properties_get_position( mlt_transition_properties( this ), "in" );
 }
 
 /** Get the out point.
@@ -130,32 +127,20 @@ mlt_position mlt_transition_get_in( mlt_transition this )
 
 mlt_position mlt_transition_get_out( mlt_transition this )
 {
-       mlt_properties properties = mlt_transition_properties( this );
-       return mlt_properties_get_position( properties, "out" );
+       return mlt_properties_get_position( mlt_transition_properties( this ), "out" );
 }
 
 /** Process the frame.
+
+       If we have no process method (unlikely), we simply return the a_frame unmolested.
 */
 
 static mlt_frame transition_process( mlt_transition this, mlt_frame a_frame, mlt_frame b_frame )
 {
        if ( this->process == NULL )
-       {
-               if ( !mlt_frame_is_test_card( a_frame ) )
-               {
-                       mlt_frame_close( b_frame );
-                       return a_frame;
-               }
-               else
-               {
-                       mlt_frame_close( a_frame );
-                       return b_frame;
-               }
-       }
+               return a_frame;
        else
-       {
                return this->process( this, a_frame, b_frame );
-       }
 }
 
 /** Get a frame from this filter.
@@ -165,14 +150,12 @@ static mlt_frame transition_process( mlt_transition this, mlt_frame a_frame, mlt
        method for all tracks, we have to take special care that we only obtain the a and
        b frames once - we do this on the first call to get a frame from either a or b.
        
-       After that, we have 3 cases to resolve:
+       After that, we have 2 cases to resolve:
        
        1)      if the track is the a_track and we're in the time zone, then we need to call the
-               process method to do the effect on the frame (we assign NULL to the a_frame and
-               b_frames here) otherwise, we pass on the a_frame unmolested;
-       2)      if the track is the b_track and we're the in the time zone OR the b_frame is NULL,
-               then we generate a test card frame, otherwise we pass on the b frame unmolested;
-       3)      For all other tracks, we get the frames on demand.
+               process method to do the effect on the frame and remember we've passed it on
+               otherwise, we pass on the a_frame unmolested;
+       2)      For all other tracks, we get the frames on demand.
 */
 
 static int transition_get_frame( mlt_service service, mlt_frame_ptr frame, int index )
@@ -187,11 +170,12 @@ static int transition_get_frame( mlt_service service, mlt_frame_ptr frame, int i
        mlt_position out = mlt_properties_get_position( properties, "out" );
 
        // Fetch a and b frames together...
-       if ( ( index == a_track || index == b_track ) &&
-                ( this->a_frame == NULL && this->b_frame == NULL ) )
+       if ( ( index == a_track || index == b_track ) && !( this->a_held || this->b_held ) )
        {
                mlt_service_get_frame( this->producer, &this->a_frame, a_track );
                mlt_service_get_frame( this->producer, &this->b_frame, b_track );
+               this->a_held = 1;
+               this->b_held = 1;
        }
        
        // Special case track processing
@@ -199,45 +183,25 @@ static int transition_get_frame( mlt_service service, mlt_frame_ptr frame, int i
        {
                // Determine if we're in the right time zone
                mlt_position position = mlt_frame_get_position( this->a_frame );
-               if ( position >= in && position < out )
+               if ( position >= in && position <= out )
                {
                        // Process the transition
                        *frame = transition_process( this, this->a_frame, this->b_frame );
-                       
-                       // Important - NULL both frames now so that we know they're done...
-                       this->a_frame = NULL;
-                       this->b_frame = NULL;
+                       this->a_held = 0;
                }
                else
                {
                        // Pass on the 'a frame' and remember that we've done it
                        *frame = this->a_frame;
-                       this->a_frame = NULL;
-               }                       
+                       this->a_held = 0;
+               }
                return 0;
        }
        if ( index == b_track )
        {
-               if ( this->b_frame == NULL )
-               {
-                       // We're *probably* in the zone and the a frame has been requested
-                       *frame = mlt_frame_init( );
-               }
-               else
-               {
-                       mlt_position position = mlt_frame_get_position( this->b_frame );
-                       if ( position >= in && position < out )
-                       {
-                               // We're in the zone, but the 'a frame' has not been requested yet
-                               *frame = mlt_frame_init( );
-                       }
-                       else
-                       {
-                               // We're out of the zone, pass on b and remember that we've done it
-                               *frame = this->b_frame;
-                               this->b_frame = NULL;
-                       }
-               }
+               // Pass on the 'b frame' and remember that we've done it
+               *frame = this->b_frame;
+               this->b_held = 0;
                return 0;
        }
        else
index c297bdbcdbbd1ab7888bda34cdcad860a4030e79..1dad6c19a88d6cc831b86859c4c29bb9ac081260 100644 (file)
@@ -46,6 +46,8 @@ struct mlt_transition_s
        // Private
        mlt_frame a_frame;
        mlt_frame b_frame;
+       int a_held;
+       int b_held;
 };
 
 /** Public final methods
index fa76e647b44998af6a68177e105c41aa836d7485..6a1260550e8d449474863b27eee9b70368201304 100644 (file)
@@ -227,7 +227,6 @@ int main( int argc, char **argv )
 
                        // Transport functionality
                        transport( inigo );
-                       
                }
                else if ( store != NULL )
                {
index c2ba62dd862a08e761f2c8dca7b00622eb219066..ef896a9ff7b5678dd586a487ec1ff9222ceefb2d 100644 (file)
@@ -69,9 +69,6 @@ static int transition_get_image( mlt_frame this, uint8_t **image, mlt_image_form
                *width = mlt_properties_get_int( a_props, "width" );
                *height = mlt_properties_get_int( a_props, "height" );
                *image = mlt_properties_get_data( a_props, "image", NULL );
-
-               // Close the b_frame
-               mlt_frame_close( b_frame );
        }
        else if ( a_props != NULL )
        {
index fc712eaa0c15f22839536cb605b3cd0e0a203dce..5e0dd0fe90217741f961cbf7cd6a4c8f9a50ad22 100644 (file)
@@ -176,9 +176,6 @@ static int transition_get_image( mlt_frame this, uint8_t **image, mlt_image_form
        *height = mlt_properties_get_int( a_props, "height" );
        *image = mlt_properties_get_data( a_props, "image", NULL );
 
-       // Close the b_frame
-       mlt_frame_close( b_frame );
-       
        previous_mix = mix;
 
        return 0;
@@ -342,7 +339,7 @@ static mlt_frame transition_process( mlt_transition transition, mlt_frame a_fram
        mlt_position in = mlt_transition_get_in( transition );
        mlt_position out = mlt_transition_get_out( transition );
        mlt_position time = mlt_frame_get_position( b_frame );
-       double pos = ( (double)time - (double)in ) / ( (double)out - (double)in + 1 );
+       double pos = ( double )( time - in ) / ( double )( out - in + 1 );
        
        // Set the b frame properties
        mlt_properties_set_double( b_props, "mix", pos );
index 62e02b26dd05aeb3f192c655b4510bd8aded516d..5c60e29d8aa9b22b4e889a5f5e8d42f60b3c0f8e 100644 (file)
@@ -44,6 +44,7 @@ static mlt_producer parse_inigo( char *file )
        }
 
        mlt_producer result = producer_inigo_init( args );
+
        if ( result != NULL )
        {
                mlt_properties properties = mlt_producer_properties( result );
@@ -135,11 +136,6 @@ static mlt_transition create_transition( mlt_field field, char *id, int track )
        return transition;
 }
 
-static void set_properties( mlt_properties properties, char *namevalue )
-{
-       mlt_properties_parse( properties, namevalue );
-}
-
 mlt_producer producer_inigo_init( char **argv )
 {
        int i;
@@ -203,7 +199,7 @@ mlt_producer producer_inigo_init( char **argv )
                }
                else if ( strstr( argv[ i ], "=" ) )
                {
-                       set_properties( properties, argv[ i ] );
+                       mlt_properties_parse( properties, argv[ i ] );
                }
                else if ( argv[ i ][ 0 ] != '-' )
                {
@@ -247,6 +243,7 @@ mlt_producer producer_inigo_init( char **argv )
        mlt_properties_set_data( props, "multitrack", multitrack, 0, NULL, NULL );
        mlt_properties_set_data( props, "field", field, 0, NULL, NULL );
        mlt_properties_set_data( props, "group", group, 0, NULL, NULL );
+       mlt_properties_set_position( props, "length", mlt_producer_get_out( mlt_multitrack_producer( multitrack ) ) + 1 );
        mlt_producer_set_in_and_out( prod, 0, mlt_producer_get_out( mlt_multitrack_producer( multitrack ) ) );
        mlt_properties_set_double( props, "fps", mlt_producer_get_fps( mlt_multitrack_producer( multitrack ) ) );
 
index bcd4dae68008873c0658b41483ce6a35d20bf05b..f4086e4c3beab430dae342cf3097c8ed3bc787ba 100644 (file)
@@ -11,7 +11,12 @@ mlt_producer create_producer( char *file )
        mlt_producer result = NULL;
 
        // 1st Line preferences
-       if ( strstr( file, ".mpg" ) )
+       if ( strstr( file, ".inigo" ) )
+       {
+               char *args[ 2 ] = { file, NULL };
+               result = mlt_factory_producer( "inigo", args );
+       }
+       else if ( strstr( file, ".mpg" ) )
                result = mlt_factory_producer( "mcmpeg", file );
        else if ( strstr( file, ".mpeg" ) )
                result = mlt_factory_producer( "mcmpeg", file );
@@ -104,20 +109,6 @@ void track_service( mlt_field field, void *service, mlt_destructor destructor )
        mlt_properties_set_int( properties, "registered", ++ registered );
 }
 
-mlt_filter create_filter( mlt_field field, char *id, int track )
-{
-       char *arg = strchr( id, ':' );
-       if ( arg != NULL )
-               *arg ++ = '\0';
-       mlt_filter filter = mlt_factory_filter( id, arg );
-       if ( filter != NULL )
-       {
-               mlt_field_plant_filter( field, filter, track );
-               track_service( field, filter, ( mlt_destructor )mlt_filter_close );
-       }
-       return filter;
-}
-
 void set_properties( mlt_service service, char *namevalue )
 {
        mlt_properties properties = mlt_service_properties( service );
@@ -143,10 +134,8 @@ int main( int argc, char **argv )
        int i;
        mlt_service  service = NULL;
        mlt_consumer consumer = NULL;
-       mlt_multitrack multitrack = NULL;
        mlt_producer producer = NULL;
        mlt_playlist playlist = NULL;
-       mlt_field field = NULL;
 
        // Construct the factory
        mlt_factory_init( getenv( "MLT_REPOSITORY" ) );
@@ -154,31 +143,15 @@ int main( int argc, char **argv )
        // Set up containers
        playlist = mlt_playlist_init( );
 
-       // Construct the field
-       field = mlt_field_init( );
-
-       // We need to track the number of registered filters
-       mlt_properties properties = mlt_field_properties( field );
-       mlt_properties_set_int( properties, "registered", 0 );
-
-       // Get the multitrack from the field
-       multitrack = mlt_field_multitrack( field );
-
        // Parse the arguments
        for ( i = 1; i < argc; i ++ )
        {
                if ( !strcmp( argv[ i ], "-consumer" ) )
                {
-                       consumer = create_consumer( argv[ ++ i ], mlt_multitrack_producer( multitrack ) );
+                       consumer = create_consumer( argv[ ++ i ], mlt_playlist_producer( playlist ) );
                        if ( consumer != NULL )
                                service = mlt_consumer_service( consumer );
                }
-               else if ( !strcmp( argv[ i ], "-filter" ) )
-               {
-                       mlt_filter filter = create_filter( field, argv[ ++ i ], 0 );
-                       if ( filter != NULL )
-                               service = mlt_filter_service( filter );
-               }
                else if ( !strstr( argv[ i ], "=" ) )
                {
                        if ( producer != NULL )
@@ -195,25 +168,21 @@ int main( int argc, char **argv )
 
        // If we have no consumer, default to sdl
        if ( consumer == NULL )
-               consumer = create_consumer( "sdl", mlt_multitrack_producer( multitrack ) );
+               consumer = create_consumer( "sdl", mlt_playlist_producer( playlist ) );
 
        // Connect producer to playlist
        if ( producer != NULL )
                mlt_playlist_append( playlist, producer );
 
-       // Connect multitrack to producer
-       mlt_multitrack_connect( multitrack, mlt_playlist_producer( playlist ), 0 );
-
-       // Connect consumer to tractor
-       mlt_consumer_connect( consumer, mlt_field_service( field ) );
+       // Connect consumer to playlist
+       mlt_consumer_connect( consumer, mlt_playlist_service( playlist ) );
 
        // Transport functionality
-       transport( mlt_multitrack_producer( multitrack ) );
+       transport( mlt_playlist_producer( playlist ) );
 
        // Close the services
        mlt_consumer_close( consumer );
-       mlt_field_close( field );
-       mlt_producer_close( producer );
+       mlt_playlist_close( playlist );
 
        // Close the factory
        mlt_factory_close( );