[MPlayer-dev-eng] [PATCH] win32 codec path

Joey Parrish joey at nicewarrior.org
Wed Aug 6 17:54:18 CEST 2003


Hello,

Here is a quick patch that attempts to set the PATH environment variable
before loading codecs in native win32.  This is untested at the moment.
But via ssh I can see that it compiles, and from MSDN I can see that it
is logically sound.  So I expect it to work.  Please test and report
your results.  If this works, then IMHO it is fairly clean and should be
applied to main.

I apologize for sending untested code, but I don't have enough free time
right now to install/test binary codecs while I'm away from my computer.

Thanks,
--Joey
-------------- next part --------------
Sets the dll search path before loading a library

diff -Nur main.sofar/libmpcodecs/ad_qtaudio.c main.dev/libmpcodecs/ad_qtaudio.c
--- main.sofar/libmpcodecs/ad_qtaudio.c	2003-03-26 10:48:17.000000000 -0600
+++ main.dev/libmpcodecs/ad_qtaudio.c	2003-08-06 10:29:47.000000000 -0500
@@ -82,12 +82,15 @@
 HMODULE   WINAPI LoadLibraryA(LPCSTR);
 FARPROC   WINAPI GetProcAddress(HMODULE,LPCSTR);
 int       WINAPI FreeLibrary(HMODULE);
+int       WINAPI SetEnvironmentVariableA(LPCSTR,LPCSTR);
 
 static int loader_init()
 {
 
 #ifdef WIN32_LOADER
     Setup_LDT_Keeper();
+#else // native windows loader, supply the dll path
+    SetEnvironmentVariableA("PATH", WIN32_PATH);
 #endif
     qtml_dll = LoadLibraryA("qtmlClient.dll");
     if( qtml_dll == NULL )
diff -Nur main.sofar/libmpcodecs/ad_realaud.c main.dev/libmpcodecs/ad_realaud.c
--- main.sofar/libmpcodecs/ad_realaud.c	2003-07-28 17:35:57.000000000 -0500
+++ main.dev/libmpcodecs/ad_realaud.c	2003-08-06 10:30:08.000000000 -0500
@@ -161,6 +161,7 @@
 void* WINAPI LoadLibraryA(char* name);
 void* WINAPI GetProcAddress(void* handle,char *func);
 int WINAPI FreeLibrary(void *handle);
+int WINAPI SetEnvironmentVariableA(LPCSTR,LPCSTR);
 
 static int load_sysm_windows(char *path)
 {
@@ -169,6 +170,8 @@
     mp_msg(MSGT_DECVIDEO, MSGL_INFO, "opening win32 dll '%s'\n", path);
 #ifdef WIN32_LOADER
     Setup_LDT_Keeper();
+#else // native windows loader, supply the dll path
+    SetEnvironmentVariableA("PATH", REALCODEC_PATH);
 #endif
     handle = LoadLibraryA(path);
     if (!handle)
diff -Nur main.sofar/libmpcodecs/vd_qtvideo.c main.dev/libmpcodecs/vd_qtvideo.c
--- main.sofar/libmpcodecs/vd_qtvideo.c	2003-02-25 09:36:30.000000000 -0600
+++ main.dev/libmpcodecs/vd_qtvideo.c	2003-08-06 10:30:36.000000000 -0500
@@ -37,6 +37,7 @@
 HMODULE   WINAPI LoadLibraryA(LPCSTR);
 FARPROC   WINAPI GetProcAddress(HMODULE,LPCSTR);
 int       WINAPI FreeLibrary(HMODULE);
+int       WINAPI SetEnvironmentVariableA(LPCSTR,LPCSTR);
 #endif
 
 //static ComponentDescription desc; // for FindNextComponent()
@@ -113,6 +114,8 @@
 
 #ifdef WIN32_LOADER
     Setup_LDT_Keeper();
+#else // native windows loader, supply the dll path
+    SetEnvironmentVariableA("PATH", WIN32_PATH);
 #endif
 
     handler = LoadLibraryA("qtmlClient.dll");
diff -Nur main.sofar/libmpcodecs/vd_realvid.c main.dev/libmpcodecs/vd_realvid.c
--- main.sofar/libmpcodecs/vd_realvid.c	2003-07-28 17:35:57.000000000 -0500
+++ main.dev/libmpcodecs/vd_realvid.c	2003-08-06 10:31:07.000000000 -0500
@@ -139,6 +139,7 @@
 void* WINAPI LoadLibraryA(char* name);
 void* WINAPI GetProcAddress(void* handle,char* func);
 int WINAPI FreeLibrary(void *handle);
+int WINAPI SetEnvironmentVariableA(LPCSTR,LPCSTR);
 
 static int load_syms_windows(char *path) {
     void *handle;
@@ -146,6 +147,8 @@
     mp_msg(MSGT_DECVIDEO,MSGL_INFO, "opening win32 dll '%s'\n", path);
 #ifdef WIN32_LOADER
     Setup_LDT_Keeper();
+#else // native windows loader, supply the dll path
+    SetEnvironmentVariableA("PATH", REALCODEC_PATH);
 #endif
     handle = LoadLibraryA(path);
     mp_msg(MSGT_DECVIDEO,MSGL_V,"win32 real codec handle=%p  \n",handle);
diff -Nur main.sofar/libmpcodecs/ve_qtvideo.c main.dev/libmpcodecs/ve_qtvideo.c
--- main.sofar/libmpcodecs/ve_qtvideo.c	2003-02-15 11:45:10.000000000 -0600
+++ main.dev/libmpcodecs/ve_qtvideo.c	2003-08-06 10:31:27.000000000 -0500
@@ -34,6 +34,7 @@
 HMODULE   WINAPI LoadLibraryA(LPCSTR);
 FARPROC   WINAPI GetProcAddress(HMODULE,LPCSTR);
 int       WINAPI FreeLibrary(HMODULE);
+int       WINAPI SetEnvironmentVariableA(LPCSTR,LPCSTR);
 static HMODULE handler;
 
 static OSErr        (*FindCodec)(CodecType              cType,
@@ -294,6 +295,8 @@
 
 #ifdef WIN32_LOADER
     Setup_LDT_Keeper();
+#else // native windows loader, supply the dll path
+    SetEnvironmentVariableA("PATH", WIN32_PATH);
 #endif
     handler = LoadLibraryA("qtmlClient.dll");
     InitializeQTML = (OSErr (*)(long))GetProcAddress(handler, "InitializeQTML");
diff -Nur main.sofar/loader/dmo/dmo.c main.dev/loader/dmo/dmo.c
--- main.sofar/loader/dmo/dmo.c	2003-04-21 16:06:07.000000000 -0500
+++ main.dev/loader/dmo/dmo.c	2003-08-06 10:31:51.000000000 -0500
@@ -38,6 +38,8 @@
     memset(This, 0, sizeof(DMO_Filter));
 #ifdef WIN32_LOADER
     CodecAlloc();
+#else // native windows loader, supply the dll path
+    SetEnvironmentVariableA("PATH", WIN32_PATH);
 #endif
 
     //This->Start = DS_Filter_Start;
diff -Nur main.sofar/loader/driver.c main.dev/loader/driver.c
--- main.sofar/loader/driver.c	2003-04-24 13:48:18.000000000 -0500
+++ main.dev/loader/driver.c	2003-08-06 10:31:59.000000000 -0500
@@ -161,6 +161,8 @@
 #ifdef WIN32_LOADER
     CodecAlloc();
     Setup_FS_Segment();
+#else // native windows loader, supply the dll path
+    SetEnvironmentVariableA("PATH", WIN32_PATH);
 #endif
 
     hDriver->hDriverModule = LoadLibraryA(filename);
diff -Nur main.sofar/loader/dshow/DS_Filter.c main.dev/loader/dshow/DS_Filter.c
--- main.sofar/loader/dshow/DS_Filter.c	2003-04-21 16:06:08.000000000 -0500
+++ main.dev/loader/dshow/DS_Filter.c	2003-08-06 10:32:10.000000000 -0500
@@ -117,6 +117,8 @@
     CodecAlloc();
 #else
     CoInitialize(0L);
+    // native windows loader, supply the dll path
+    SetEnvironmentVariableA("PATH", WIN32_PATH);
 #endif
 
     This->m_pFilter = NULL;


More information about the MPlayer-dev-eng mailing list