From a743c0a73824f1f3bce5b59ef6d57e871d3f5022 Mon Sep 17 00:00:00 2001 From: reimar Date: Thu, 18 Mar 2010 20:44:01 +0000 Subject: Split codec path related code into a separate file to fix Windows build. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30930 b3059339-0415-0410-9bf9-f77b7e298cf2 --- loader/codecpath.c | 26 ++++++++++++++++++++++++++ loader/codecpath.h | 12 ++++++++++++ loader/drv.c | 22 +--------------------- loader/drv.h | 1 - loader/elfdll.c | 2 +- loader/module.c | 2 +- loader/win32.c | 3 +-- 7 files changed, 42 insertions(+), 26 deletions(-) create mode 100644 loader/codecpath.c create mode 100644 loader/codecpath.h (limited to 'loader') 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 -- cgit v1.2.3