diff --git a/Makefile b/Makefile index b698bf6289..72f8dcd524 100644 --- a/Makefile +++ b/Makefile @@ -315,6 +315,7 @@ SRCS_COMMON-$(WIN32DLL) += libmpcodecs/ad_acm.c \ libmpcodecs/vd_vfwex.c \ libmpdemux/demux_avs.c \ loader/afl.c \ + loader/codecpath.c \ loader/drv.c \ loader/vfl.c \ loader/dshow/DS_AudioDecoder.c \ diff --git a/loader/codecpath.c b/loader/codecpath.c new file mode 100644 index 0000000000..0996f592f1 --- /dev/null +++ b/loader/codecpath.c @@ -0,0 +1,26 @@ +/* + * Modified for use with MPlayer, detailed changelog at + * http://svn.mplayerhq.hu/mplayer/trunk/ + */ + +#include +#include +#include "config.h" +#include "codecpath.h" + +char* def_path = BINARY_CODECS_PATH; + +static int needs_free=0; +void SetCodecPath(const char* path) +{ + if(needs_free)free(def_path); + if(path==0) + { + def_path = BINARY_CODECS_PATH; + needs_free=0; + return; + } + def_path = malloc(strlen(path)+1); + strcpy(def_path, path); + needs_free=1; +} diff --git a/loader/codecpath.h b/loader/codecpath.h new file mode 100644 index 0000000000..0532e9a3a1 --- /dev/null +++ b/loader/codecpath.h @@ -0,0 +1,12 @@ +/* + * Modified for use with MPlayer, detailed changelog at + * http://svn.mplayerhq.hu/mplayer/trunk/ + */ + +#ifndef MPLAYER_CODECPATH_H +#define MPLAYER_CODECPATH_H + +extern char *def_path; +void SetCodecPath(const char* path); + +#endif /* MPLAYER_CODECPATH_H */ diff --git a/loader/drv.c b/loader/drv.c index 13945538d2..bfc57a4d1c 100644 --- a/loader/drv.c +++ b/loader/drv.c @@ -25,12 +25,7 @@ #ifndef __MINGW32__ #include "ext.h" #endif - -#ifndef WIN32_LOADER -char* def_path = BINARY_CODECS_PATH; -#else -extern char* def_path; -#endif +#include "codecpath.h" #if 1 @@ -65,21 +60,6 @@ extern char* def_path; "pop %%ebx\n\t"::) #endif -static int needs_free=0; -void SetCodecPath(const char* path) -{ - if(needs_free)free(def_path); - if(path==0) - { - def_path = BINARY_CODECS_PATH; - needs_free=0; - return; - } - def_path = malloc(strlen(path)+1); - strcpy(def_path, path); - needs_free=1; -} - static DWORD dwDrvID = 0; LRESULT WINAPI SendDriverMessage(HDRVR hDriver, UINT message, diff --git a/loader/drv.h b/loader/drv.h index 9ae1f8fbec..6f20b8ce54 100644 --- a/loader/drv.h +++ b/loader/drv.h @@ -9,7 +9,6 @@ #include "wine/windef.h" #include "wine/driver.h" -void SetCodecPath(const char* path); void CodecAlloc(void); void CodecRelease(void); diff --git a/loader/elfdll.c b/loader/elfdll.c index e4a0190f89..fe88227240 100644 --- a/loader/elfdll.c +++ b/loader/elfdll.c @@ -18,6 +18,7 @@ #include "wine/debugtools.h" #include "wine/winerror.h" #include "debug.h" +#include "codecpath.h" //DEFAULT_DEBUG_CHANNEL(elfdll) @@ -38,7 +39,6 @@ void dump_exports(HMODULE hModule); /*---------------- END HACKS ---------------*/ //char *extra_ld_library_path = "/usr/lib/win32"; -extern char* def_path; struct elfdll_image { diff --git a/loader/module.c b/loader/module.c index 79c01270d3..98b31125af 100644 --- a/loader/module.c +++ b/loader/module.c @@ -46,6 +46,7 @@ #endif #include "win32.h" #include "drv.h" +#include "codecpath.h" #ifdef EMU_QTX_API #include "wrapper.h" @@ -366,7 +367,6 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags) { WINE_MODREF *wm = 0; char* listpath[] = { "", "", "/usr/lib/win32", "/usr/local/lib/win32", 0 }; - extern char* def_path; char path[512]; char checked[2000]; int i = -1; diff --git a/loader/win32.c b/loader/win32.c index b687135049..9ca0a4a3ab 100644 --- a/loader/win32.c +++ b/loader/win32.c @@ -49,6 +49,7 @@ for DLL to know too much about its environment. #include "loader.h" #include "com.h" #include "ext.h" +#include "codecpath.h" #include #include @@ -77,8 +78,6 @@ for DLL to know too much about its environment. #include "osdep/mmap_anon.h" #include "libavutil/avstring.h" -char* def_path = BINARY_CODECS_PATH; - static void do_cpuid(unsigned int ax, unsigned int *regs) { __asm__ volatile diff --git a/mencoder.c b/mencoder.c index 9d4450f9ba..b8a759180f 100644 --- a/mencoder.c +++ b/mencoder.c @@ -66,7 +66,7 @@ #include "get_path.h" #ifdef CONFIG_WIN32DLL -#include "loader/drv.h" // for SetCodecPath() +#include "loader/codecpath.h" // for SetCodecPath() #endif #include "stream/stream.h" diff --git a/mplayer.c b/mplayer.c index cb9d276c3a..ac59e57795 100644 --- a/mplayer.c +++ b/mplayer.c @@ -96,7 +96,7 @@ #include "input/input.h" #ifdef CONFIG_WIN32DLL -#include "loader/drv.h" // for SetCodecPath() +#include "loader/codecpath.h" // for SetCodecPath() #endif int slave_mode=0;