Improved push capabilities
[melted] / src / modules / westley / producer_westley.c
index fa40406..1d42754 100644 (file)
@@ -54,7 +54,7 @@ enum service_type
        mlt_transition_type,
        mlt_consumer_type,
        mlt_field_type,
-       mlt_service_type,
+       mlt_services_type,
        mlt_dummy_filter_type,
        mlt_dummy_transition_type,
        mlt_dummy_producer_type,
@@ -726,12 +726,12 @@ static void on_end_track( deserialise_context context, const xmlChar *name )
 
                if ( multitrack != NULL )
                {
-                       // Set the track on the multitrack
-
                        // Set producer i/o if specified
-                       if ( mlt_properties_get( track_props, "in" ) != NULL &&
+                       if ( mlt_properties_get( track_props, "in" ) != NULL ||
                                 mlt_properties_get( track_props, "out" ) != NULL )
                        {
+                               if ( mlt_properties_get( track_props, "out" ) == NULL )
+                                       mlt_properties_set_position( track_props, "out", mlt_properties_get_position( track_props, "length" ) - 1 );
                                mlt_producer cut = mlt_producer_cut( MLT_PRODUCER( producer ),
                                        mlt_properties_get_position( track_props, "in" ),
                                        mlt_properties_get_position( track_props, "out" ) );
@@ -891,6 +891,8 @@ static void on_end_transition( deserialise_context context, const xmlChar *name
                        if ( parent_type == mlt_tractor_type )
                        {
                                mlt_field field = mlt_tractor_field( MLT_TRACTOR( parent ) );
+                               if ( mlt_properties_get_int( properties, "a_track" ) == mlt_properties_get_int( properties, "b_track" ) )
+                                       mlt_properties_set_int( properties, "b_track", mlt_properties_get_int( properties, "a_track" ) + 1 );
                                mlt_field_plant_transition( field, MLT_TRANSITION( effect ), 
                                                                                        mlt_properties_get_int( properties, "a_track" ),
                                                                                        mlt_properties_get_int( properties, "b_track" ) );
@@ -1384,6 +1386,9 @@ mlt_producer producer_westley_init( int info, char *data )
                // Assign the title
                mlt_properties_set( properties, "title", title );
 
+               // Optimise for overlapping producers
+               mlt_producer_optimise( MLT_PRODUCER( service ) );
+
                // Handle deep copies
                if ( getenv( "MLT_WESTLEY_DEEP" ) == NULL )
                {
@@ -1397,6 +1402,7 @@ mlt_producer producer_westley_init( int info, char *data )
                else
                {
                        // Allow the project to be edited
+                       mlt_properties_set( properties, "_westley", "was here" );
                        mlt_properties_set_int( properties, "_mlt_service_hidden", 1 );
                }
        }