From b1ece35467d954528c43956109706ba1943a10fb Mon Sep 17 00:00:00 2001 From: Dan Dennedy Date: Mon, 17 Jan 2011 00:37:59 -0800 Subject: [PATCH] On Windows locate plugins and data by directory relative to current directory. lib\mlt lib\frei0r-1 lib\ladspa share\mlt share\ffmpeg --- src/framework/mlt_factory.c | 13 +++++++++++-- src/modules/avformat/configure | 9 ++++++++- src/modules/frei0r/factory.c | 6 ++++-- src/modules/jackrack/plugin_mgr.c | 4 ++++ 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/framework/mlt_factory.c b/src/framework/mlt_factory.c index 5fe820ab..ebfc1076 100644 --- a/src/framework/mlt_factory.c +++ b/src/framework/mlt_factory.c @@ -27,11 +27,18 @@ #include #include +#ifdef WIN32 +#include +/** the default subdirectory of the libdir for holding modules (plugins) */ +#define PREFIX_LIB "lib\\mlt" +/** the default subdirectory of the install prefix for holding module (plugin) data */ +#define PREFIX_DATA "share\\mlt" +#else /** the default subdirectory of the libdir for holding modules (plugins) */ #define PREFIX_LIB LIBDIR "/mlt" /** the default subdirectory of the install prefix for holding module (plugin) data */ #define PREFIX_DATA PREFIX "/share/mlt" - +#endif /** holds the full path to the modules directory - initialized and retained for the entire session */ static char *mlt_directory = NULL; @@ -106,6 +113,7 @@ 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 ); } @@ -364,7 +372,8 @@ void mlt_factory_close( ) { mlt_properties_close( event_object ); mlt_properties_close( global_properties ); - mlt_repository_close( repository ); + if ( repository ) + mlt_repository_close( repository ); free( mlt_directory ); mlt_directory = NULL; mlt_pool_close( ); diff --git a/src/modules/avformat/configure b/src/modules/avformat/configure index 29e13ad6..d6c217ac 100755 --- a/src/modules/avformat/configure +++ b/src/modules/avformat/configure @@ -169,7 +169,14 @@ else elif [ "$shared_ffmpeg" != "" ] then echo "PREFIX=$shared_ffmpeg" >> config.mak - echo "CFLAGS+=-DAVDATADIR=\\\"${shared_ffmpeg}/share/ffmpeg/\\\"" >> config.mak + case $targetos in + MINGW32_NT-*) + echo "CFLAGS+=-DAVDATADIR=\\\"share/ffmpeg/\\\"" >> config.mak + ;; + *) + echo "CFLAGS+=-DAVDATADIR=\\\"${shared_ffmpeg}/share/ffmpeg/\\\"" >> config.mak + ;; + esac echo "CFLAGS+=$(pkg-config --cflags libavformat)" >> config.mak echo "LDFLAGS+=$(pkg-config --libs-only-L libavformat)" >> config.mak if [ "$devices" = "true" ] diff --git a/src/modules/frei0r/factory.c b/src/modules/frei0r/factory.c index c713b2e4..6cedb18f 100644 --- a/src/modules/frei0r/factory.c +++ b/src/modules/frei0r/factory.c @@ -30,15 +30,17 @@ #include #include -#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" -#define GET_FREI0R_PATH (getenv("FREI0R_PATH") ? getenv("FREI0R_PATH") : getenv("MLT_FREI0R_PLUGIN_PATH") ? getenv("MLT_FREI0R_PLUGIN_PATH") : FREI0R_PLUGIN_PATH) #ifdef WIN32 #define LIBSUF ".dll" +#define FREI0R_PLUGIN_PATH "lib\\frei0r-1" #else #define LIBSUF ".so" +#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) + extern mlt_filter filter_frei0r_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ); extern mlt_frame filter_process( mlt_filter this, mlt_frame frame ); extern void filter_close( mlt_filter this ); diff --git a/src/modules/jackrack/plugin_mgr.c b/src/modules/jackrack/plugin_mgr.c index ca806092..4b4bccf7 100644 --- a/src/modules/jackrack/plugin_mgr.c +++ b/src/modules/jackrack/plugin_mgr.c @@ -211,7 +211,11 @@ 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"); +#else ladspa_path = g_strdup ("/usr/local/lib/ladspa:/usr/lib/ladspa:/usr/lib64/ladspa"); +#endif dir = strtok (ladspa_path, ":"); do -- 2.39.2