+ // Load the system locales
+ setlocale( LC_ALL, "" );
+
+ if ( ! global_properties )
+ global_properties = mlt_properties_new( );
+
+ // Allow property refresh on a subsequent initialisation
+ if ( global_properties )
+ {
+ mlt_properties_set_or_default( global_properties, "MLT_NORMALISATION", getenv( "MLT_NORMALISATION" ), "PAL" );
+ mlt_properties_set_or_default( global_properties, "MLT_PRODUCER", getenv( "MLT_PRODUCER" ), "loader" );
+ mlt_properties_set_or_default( global_properties, "MLT_CONSUMER", getenv( "MLT_CONSUMER" ), "sdl" );
+ mlt_properties_set( global_properties, "MLT_TEST_CARD", getenv( "MLT_TEST_CARD" ) );
+ mlt_properties_set_or_default( global_properties, "MLT_PROFILE", getenv( "MLT_PROFILE" ), "dv_pal" );
+ mlt_properties_set_or_default( global_properties, "MLT_DATA", getenv( "MLT_DATA" ), PREFIX_DATA );
+#if defined(WIN32)
+ char path[1024];
+ DWORD size = sizeof( path );
+ GetModuleFileName( NULL, path, size );
+#elif defined(__DARWIN__) && defined(RELOCATABLE)
+ char path[1024];
+ uint32_t size = sizeof( path );
+ _NSGetExecutablePath( path, &size );
+#endif
+#if defined(WIN32) || (defined(__DARWIN__) && defined(RELOCATABLE))
+ char *path2 = strdup( path );
+ char *appdir = dirname( path2 );
+ mlt_properties_set( global_properties, "MLT_APPDIR", appdir );
+ free( path2 );
+#endif
+ }
+