X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fwestley%2Fproducer_westley.c;h=265475a064f32b4d8ef671263327f3e8a9d3c23c;hb=42bd0aedb6d3d65bedb98479adcdbaeb326dfee9;hp=8c7d9ca64fc740bc1e2903f3a9ec1ad5a63bfb81;hpb=0bd5d91026b8bd143f957f119d61d5fedd45cf70;p=melted diff --git a/src/modules/westley/producer_westley.c b/src/modules/westley/producer_westley.c index 8c7d9ca..265475a 100644 --- a/src/modules/westley/producer_westley.c +++ b/src/modules/westley/producer_westley.c @@ -75,12 +75,21 @@ static void track_service( mlt_properties properties, void *service, mlt_destruc static void on_start_tractor( deserialise_context context, const xmlChar *name, const xmlChar **atts) { mlt_service service = mlt_tractor_service( mlt_tractor_init() ); + mlt_properties properties = mlt_service_properties( service ); track_service( context->destructors, service, (mlt_destructor) mlt_tractor_close ); + mlt_properties_set_position( properties, "length", 0 ); + for ( ; atts != NULL && *atts != NULL; atts += 2 ) mlt_properties_set( mlt_service_properties( service ), (char*) atts[0], (char*) atts[1] ); + if ( mlt_properties_get_position( properties, "length" ) < mlt_properties_get_position( properties, "out" ) ) + { + mlt_position length = mlt_properties_get_position( properties, "out" ) + 1; + mlt_properties_set_position( properties, "length", length ); + } + context_push_service( context, service ); } @@ -103,12 +112,20 @@ static void on_start_playlist( deserialise_context context, const xmlChar *name, track_service( context->destructors, service, (mlt_destructor) mlt_playlist_close ); + mlt_properties_set_position( properties, "length", 0 ); + for ( ; atts != NULL && *atts != NULL; atts += 2 ) mlt_properties_set( properties, (char*) atts[0], (char*) atts[1] ); if ( mlt_properties_get( properties, "id" ) != NULL ) mlt_properties_set_data( context->producer_map, mlt_properties_get( properties, "id" ), service, 0, NULL, NULL ); + if ( mlt_properties_get_position( properties, "length" ) < mlt_properties_get_position( properties, "out" ) ) + { + mlt_position length = mlt_properties_get_position( properties, "out" ) + 1; + mlt_properties_set_position( properties, "length", length ); + } + context_push_service( context, service ); } @@ -163,7 +180,7 @@ static void on_start_blank( deserialise_context context, const xmlChar *name, co } // Append a blank to the playlist - mlt_playlist_blank( MLT_PLAYLIST( service ), length ); + mlt_playlist_blank( MLT_PLAYLIST( service ), length - 1 ); // Push the playlist back onto the stack context_push_service( context, service ); @@ -419,11 +436,10 @@ mlt_producer producer_westley_init( char *filename ) if ( !init ) { xmlInitParser(); - init = 1; + //init = 1; } xmlSAXUserParseFile( sax, context, filename ); - free( sax ); // Need the complete producer list for various reasons properties = context->destructors; @@ -466,7 +482,11 @@ mlt_producer producer_westley_init( char *filename ) free( context->stack_service ); mlt_properties_close( context->producer_map ); - free( context ); + //free( context ); + free( sax ); + xmlCleanupParser(); + xmlMemoryDump( ); + return MLT_PRODUCER( service ); }