]> git.sesse.net Git - mlt/commitdiff
fix frei0r and ladspa loading for relocatable builds
authorDan Dennedy <dan@dennedy.org>
Sat, 5 Nov 2011 05:27:38 +0000 (22:27 -0700)
committerDan Dennedy <dan@dennedy.org>
Thu, 24 Nov 2011 04:26:16 +0000 (20:26 -0800)
src/framework/mlt_factory.c
src/modules/frei0r/factory.c
src/modules/jackrack/plugin_mgr.c

index cd298bc7fbce26dca31e6a3378ea231bcf01fb96..cf1261822b7bb855dce20a1665e70ca3145c647c 100644 (file)
@@ -124,8 +124,22 @@ mlt_repository mlt_factory_init( const char *directory )
                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
        }
 
        // Only initialise once
@@ -140,20 +154,9 @@ mlt_repository mlt_factory_init( const char *directory )
                        directory = PREFIX_LIB;
 
                // Store the prefix for later retrieval
-#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 );
-#else
-               mlt_directory = strdup( directory );
-#endif
 #if defined(WIN32) || (defined(__DARWIN__) && defined(RELOCATABLE))
-               char *path2 = strdup( path );
-               char *exedir = dirname( path2 );
+               char *exedir = mlt_environment( "MLT_APPDIR" );
+               size_t size = strlen( exedir );
                if ( global_properties && !getenv( "MLT_DATA" ) )
                {
                        mlt_directory = calloc( 1, size + strlen( PREFIX_DATA ) + 1 );
@@ -165,7 +168,8 @@ mlt_repository mlt_factory_init( const char *directory )
                mlt_directory = calloc( 1, size + strlen( directory ) + 1 );
                strcpy( mlt_directory, exedir );
                strcat( mlt_directory, directory );
-               free( path2 );
+#else
+               mlt_directory = strdup( directory );
 #endif
                
                // Initialise the pool
index eb64c9ef5a50bfce1898153c19bba7b4e46f5a13..dc5424a8067dafc637d41b46519e15c4c9b8a6ab 100644 (file)
 #include <math.h>
 
 
-#ifdef WIN32
+#if defined(WIN32)
 #define LIBSUF ".dll"
-#define FREI0R_PLUGIN_PATH "\\..\\..\\lib\\frei0r-1"
+#define FREI0R_PLUGIN_PATH "\\lib\\frei0r-1"
+#elif defined(__DARWIN__) && defined(RELOCATABLE)
+#define LIBSUF ".so"
+#define FREI0R_PLUGIN_PATH "/lib/frei0r-1"
 #else
 #define LIBSUF ".so"
-#define FREI0R_PLUGIN_PATH "lib/frei0r-1:/usr/lib/frei0r-1:/usr/lib64/frei0r-1:/opt/local/lib/frei0r-1:/usr/local/lib/frei0r-1:$HOME/.frei0r-1/lib"
+#define FREI0R_PLUGIN_PATH "/usr/lib/frei0r-1:/usr/lib64/frei0r-1:/opt/local/lib/frei0r-1:/usr/local/lib/frei0r-1:$HOME/.frei0r-1/lib"
 #endif
 
 #define GET_FREI0R_PATH (getenv("FREI0R_PATH") ? getenv("FREI0R_PATH") : getenv("MLT_FREI0R_PLUGIN_PATH") ? getenv("MLT_FREI0R_PLUGIN_PATH") : FREI0R_PLUGIN_PATH)
@@ -53,8 +56,13 @@ extern mlt_frame transition_process( mlt_transition transition, mlt_frame a_fram
 static char* get_frei0r_path()
 {
 #ifdef WIN32
-       char *dirname = malloc( strlen( mlt_environment( "MLT_DATA" ) ) + strlen( FREI0R_PLUGIN_PATH ) + 1 );
-       strcpy( dirname, mlt_environment( "MLT_DATA" ) );
+       char *dirname = malloc( strlen( mlt_environment( "MLT_APPDIR" ) ) + strlen( FREI0R_PLUGIN_PATH ) + 1 );
+       strcpy( dirname, mlt_environment( "MLT_APPDIR" ) );
+       strcat( dirname, FREI0R_PLUGIN_PATH );
+       return dirname;
+#elif defined(__DARWIN__) && defined(RELOCATABLE)
+       char *dirname = malloc( strlen( mlt_environment( "MLT_APPDIR" ) ) + strlen( FREI0R_PLUGIN_PATH ) + 1 );
+       strcpy( dirname, mlt_environment( "MLT_APPDIR" ) );
        strcat( dirname, FREI0R_PLUGIN_PATH );
        return dirname;
 #else
index 224fe3ebd409ca6733bc8e022a33a8092f3de5c6..fd8d5d6228c3b8ffbbabad0ee820b5c4913c3b9b 100644 (file)
@@ -212,16 +212,22 @@ plugin_mgr_get_path_plugins (plugin_mgr_t * plugin_mgr)
   char * ladspa_path, * dir;
   
   ladspa_path = g_strdup (getenv ("LADSPA_PATH"));
-  if (!ladspa_path)
 #ifdef WIN32
+  if (!ladspa_path)
   {
-    ladspa_path = malloc (strlen (mlt_environment("MLT_DATA")) + strlen ("\\..\\..\\lib\\ladspa") + 1);
-    strcpy (ladspa_path, mlt_environment("MLT_DATA"));
-    strcat (ladspa_path, "\\..\\..\\lib\\ladspa");
-    printf("LADSPA_PATH=%s\n", ladspa_path);
+    ladspa_path = malloc (strlen (mlt_environment("MLT_APPDIR")) + strlen ("\\lib\\ladspa") + 1);
+    strcpy (ladspa_path, mlt_environment("MLT_APPDIR"));
+    strcat (ladspa_path, "\\lib\\ladspa");
+  }
+#elif defined(__DARWIN__) && defined(RELOCATABLE)
+  {
+    ladspa_path = malloc( strlen (mlt_environment ("MLT_APPDIR")) + strlen ("/lib/ladspa") + 1 );
+    strcpy (ladspa_path,  mlt_environment ("MLT_APPDIR"));
+    strcat (ladspa_path, "/lib/ladspa" );
   }
 #else
-    ladspa_path = g_strdup ("lib/ladspa:/usr/local/lib/ladspa:/usr/lib/ladspa:/usr/lib64/ladspa");
+  if (!ladspa_path)
+    ladspa_path = g_strdup ("/usr/local/lib/ladspa:/usr/lib/ladspa:/usr/lib64/ladspa");
 #endif
   
   dir = strtok (ladspa_path, ":");