]> git.sesse.net Git - mlt/commitdiff
Load frei0r and ladspa plugins relative to exe on win32
authorDan Dennedy <dan@dennedy.org>
Sun, 25 Sep 2011 23:24:29 +0000 (16:24 -0700)
committerDan Dennedy <dan@dennedy.org>
Sun, 25 Sep 2011 23:24:29 +0000 (16:24 -0700)
src/modules/frei0r/factory.c
src/modules/jackrack/plugin_mgr.c

index d7b39e2987ab76fbb8dd49b65576c86119271547..eb64c9ef5a50bfce1898153c19bba7b4e46f5a13 100644 (file)
@@ -34,7 +34,7 @@
 
 #ifdef WIN32
 #define LIBSUF ".dll"
-#define FREI0R_PLUGIN_PATH "lib\\frei0r-1"
+#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"
@@ -50,6 +50,18 @@ extern void producer_close( mlt_producer this );
 extern void transition_close( mlt_transition this );
 extern mlt_frame transition_process( mlt_transition transition, mlt_frame a_frame, mlt_frame b_frame );
 
+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" ) );
+       strcat( dirname, FREI0R_PLUGIN_PATH );
+       return dirname;
+#else
+       return strdup( GET_FREI0R_PATH );
+#endif
+}
+
 static void check_thread_safe( mlt_properties properties, const char *name )
 {
        char dirname[PATH_MAX];
@@ -285,9 +297,10 @@ static void * load_lib( mlt_profile profile, mlt_service_type type , void* handl
 static void * create_frei0r_item ( mlt_profile profile, mlt_service_type type, const char *id, void *arg){
 
        mlt_tokeniser tokeniser = mlt_tokeniser_init ( );
+       char *frei0r_path = get_frei0r_path();
        int dircount=mlt_tokeniser_parse_new (
                tokeniser,
-               GET_FREI0R_PATH,
+               frei0r_path,
                 ":"
        );
        void* ret=NULL;
@@ -326,6 +339,7 @@ static void * create_frei0r_item ( mlt_profile profile, mlt_service_type type, c
                free( myid );
        }
        mlt_tokeniser_close ( tokeniser );
+       free( frei0r_path );
        return ret;
 }
 
@@ -334,9 +348,10 @@ MLT_REPOSITORY
 {
        int i=0;
        mlt_tokeniser tokeniser = mlt_tokeniser_init ( );
+       char *frei0r_path = get_frei0r_path();
        int dircount=mlt_tokeniser_parse_new (
                tokeniser ,
-               GET_FREI0R_PATH,
+               frei0r_path,
                ":"
        );
        char dirname[PATH_MAX];
@@ -411,4 +426,5 @@ MLT_REPOSITORY
        }
        mlt_tokeniser_close ( tokeniser );
        mlt_properties_close( blacklist );
+       free( frei0r_path );
 }
index 6a28a294cd88eb0789e8963f9bc227902a001283..2bc97f94a860ddcea4aada20acd3b535d70bf175 100644 (file)
@@ -214,7 +214,12 @@ plugin_mgr_get_path_plugins (plugin_mgr_t * plugin_mgr)
   ladspa_path = g_strdup (getenv ("LADSPA_PATH"));
   if (!ladspa_path)
 #ifdef WIN32
-    ladspa_path = g_strdup ("lib\\ladspa");
+  {
+    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);
+  }
 #else
     ladspa_path = g_strdup ("lib/ladspa:/usr/local/lib/ladspa:/usr/lib/ladspa:/usr/lib64/ladspa");
 #endif