X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fframework%2Fmlt_factory.c;h=0b4df21481c375f3b9a0bc640f339efaf3745362;hb=2af8bb9f6a61f6510aab8f45abf5f26e9e619c78;hp=9223178994163a2542f7d7395862c80fdfd77b55;hpb=7c518e80321a87a22d2e48835442c9f5b70dcd17;p=melted diff --git a/src/framework/mlt_factory.c b/src/framework/mlt_factory.c index 9223178..0b4df21 100644 --- a/src/framework/mlt_factory.c +++ b/src/framework/mlt_factory.c @@ -22,6 +22,7 @@ #include "mlt.h" #include "mlt_repository.h" +#include #include #include @@ -29,11 +30,13 @@ */ static char *mlt_prefix = NULL; +static mlt_properties global_properties = NULL; static mlt_properties object_list = NULL; static mlt_repository producers = NULL; static mlt_repository filters = NULL; static mlt_repository transitions = NULL; static mlt_repository consumers = NULL; +static int unique_id = 0; /** Construct the factories. */ @@ -50,9 +53,15 @@ int mlt_factory_init( char *prefix ) // Store the prefix for later retrieval mlt_prefix = strdup( prefix ); + // Initialise the pool + mlt_pool_init( ); + + // Create the global properties + global_properties = mlt_properties_new( ); + mlt_properties_set( global_properties, "MLT_NORMALISATION", getenv( "MLT_NORMALISATION" ) ); + // Create the object list. - object_list = calloc( sizeof( struct mlt_properties_s ), 1 ); - mlt_properties_init( object_list, NULL ); + object_list = mlt_properties_new( ); // Create a repository for each service type producers = mlt_repository_init( object_list, prefix, "producers.dat", "mlt_create_producer" ); @@ -72,6 +81,14 @@ const char *mlt_factory_prefix( ) return mlt_prefix; } +/** Get a value from the environment. +*/ + +char *mlt_environment( char *name ) +{ + return mlt_properties_get( global_properties, name ); +} + /** Fetch a producer from the repository. */ @@ -81,8 +98,10 @@ mlt_producer mlt_factory_producer( char *service, void *input ) if ( obj != NULL ) { mlt_properties properties = mlt_producer_properties( obj ); + mlt_properties_set_int( properties, "_unique_id", ++ unique_id ); mlt_properties_set( properties, "mlt_type", "producer" ); - mlt_properties_set( properties, "mlt_service", service ); + if ( mlt_properties_get_int( properties, "_mlt_service_hidden" ) == 0 ) + mlt_properties_set( properties, "mlt_service", service ); } return obj; } @@ -96,6 +115,7 @@ mlt_filter mlt_factory_filter( char *service, void *input ) if ( obj != NULL ) { mlt_properties properties = mlt_filter_properties( obj ); + mlt_properties_set_int( properties, "_unique_id", ++ unique_id ); mlt_properties_set( properties, "mlt_type", "filter" ); mlt_properties_set( properties, "mlt_service", service ); } @@ -111,6 +131,7 @@ mlt_transition mlt_factory_transition( char *service, void *input ) if ( obj != NULL ) { mlt_properties properties = mlt_transition_properties( obj ); + mlt_properties_set_int( properties, "_unique_id", ++ unique_id ); mlt_properties_set( properties, "mlt_type", "transition" ); mlt_properties_set( properties, "mlt_service", service ); } @@ -126,6 +147,7 @@ mlt_consumer mlt_factory_consumer( char *service, void *input ) if ( obj != NULL ) { mlt_properties properties = mlt_consumer_properties( obj ); + mlt_properties_set_int( properties, "_unique_id", ++ unique_id ); mlt_properties_set( properties, "mlt_type", "consumer" ); mlt_properties_set( properties, "mlt_service", service ); } @@ -144,9 +166,10 @@ void mlt_factory_close( ) mlt_repository_close( transitions ); mlt_repository_close( consumers ); mlt_properties_close( object_list ); + mlt_properties_close( global_properties ); free( mlt_prefix ); - free( object_list ); mlt_prefix = NULL; + mlt_pool_close( ); } }