remove config.h
[melted] / src / framework / mlt_factory.c
index cd19b15..d81c0c2 100644 (file)
@@ -18,7 +18,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include "config.h"
 #include "mlt.h"
 #include "mlt_repository.h"
 
@@ -26,6 +25,9 @@
 #include <stdlib.h>
 #include <string.h>
 
+#define PREFIX_LIB LIBDIR "/mlt"
+#define PREFIX_DATA PREFIX "/share/mlt"
+
 /** Singleton repositories
 */
 
@@ -68,7 +70,7 @@ int mlt_factory_init( const char *prefix )
 
                // If no directory is specified, default to install directory
                if ( prefix == NULL )
-                       prefix = PREFIX_DATA;
+                       prefix = PREFIX_LIB;
 
                // Store the prefix for later retrieval
                mlt_prefix = strdup( prefix );
@@ -112,6 +114,7 @@ int mlt_factory_init( const char *prefix )
                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 );
        }
 
 
@@ -139,7 +142,10 @@ const char *mlt_factory_prefix( )
 
 char *mlt_environment( const char *name )
 {
-       return mlt_properties_get( global_properties, name );
+       if ( global_properties )
+               return mlt_properties_get( global_properties, name );
+       else
+               return NULL;
 }
 
 /** Set a value in the environment.
@@ -147,7 +153,10 @@ char *mlt_environment( const char *name )
 
 int mlt_environment_set( const char *name, const char *value )
 {
-       return mlt_properties_set( global_properties, name, value );
+       if ( global_properties )
+               return mlt_properties_set( global_properties, name, value );
+       else
+               return -1;
 }
 
 static void set_common_properties( mlt_properties properties, mlt_profile profile, const char *type, const char *service )