[MPlayer-dev-eng] [PATCH] Support CineForm DirectShow codec

Steinar H. Gunderson sgunderson at bigfoot.com
Sun Jan 10 17:09:17 CET 2010


On Sun, Jan 10, 2010 at 04:39:27PM +0100, Reimar Döffinger wrote:
> Applied.

OK, here's the next patch; new stub functions only.

/* Steinar */

diff -Nur orig/mplayer-export-2010-01-02/loader/win32.c mplayer-export-2010-01-02/loader/win32.c
--- orig/mplayer-export-2010-01-02/loader/win32.c	2010-01-10 17:07:07.000000000 +0100
+++ mplayer-export-2010-01-02/loader/win32.c	2010-01-10 17:05:37.000000000 +0100
@@ -559,6 +559,7 @@
 #define	MODULE_HANDLE_msvcrt	((HMODULE)0x126)
 #define	MODULE_HANDLE_ole32	((HMODULE)0x127)
 #define	MODULE_HANDLE_winmm	((HMODULE)0x128)
+#define	MODULE_HANDLE_psapi	((HMODULE)0x129)
 
 static HMODULE WINAPI expGetModuleHandleA(const char* name)
 {
@@ -1141,6 +1142,10 @@
     return result;
 }
 
+static WIN_BOOL WINAPI expIsDebuggerPresent(void)
+{
+    return 0;
+}
 
 static long WINAPI expGetVersion(void)
 {
@@ -2270,6 +2275,21 @@
     return result;
 }
 
+static int WINAPI expGetModuleBaseNameA(int process, int module, char* s, int len)
+{
+    int result = 0;
+   
+    if (len >= 12) {
+	strcpy(s, "aviplay.dll");
+	result = 11;
+    }
+
+    dbgprintf("GetModuleBaseNameA(0x%x, 0x%x, 0x%x, %d) => %d\n",
+        process, module, s, len, result);
+
+    return result;
+}
+
 static int WINAPI expSetUnhandledExceptionFilter(void* filter)
 {
     dbgprintf("SetUnhandledExceptionFilter(0x%x) => 1\n", filter);
@@ -2330,6 +2350,8 @@
 	return MODULE_HANDLE_ole32;
     if (strcasecmp(name, "winmm.dll") == 0 || strcasecmp(name, "winmm") == 0)
 	return MODULE_HANDLE_winmm;
+    if (strcasecmp(name, "psapi.dll") == 0 || strcasecmp(name, "psapi") == 0)
+	return MODULE_HANDLE_psapi;
 
     result=LoadLibraryA(name);
     dbgprintf("Returned LoadLibraryA(0x%x='%s'), def_path=%s => 0x%x\n", name, name, def_path, result);
@@ -2372,6 +2394,8 @@
 	result=LookupExternalByName("ole32.dll", name); break;
     case MODULE_HANDLE_winmm:
 	result=LookupExternalByName("winmm.dll", name); break;
+    case MODULE_HANDLE_psapi:
+	result=LookupExternalByName("psapi.dll", name); break;
     default:
 	result=GetProcAddress(mod, name);
     }
@@ -3519,7 +3543,7 @@
 	free(tmp);
 	return result;
     }
-    if (strstr(cs1, "vp3") || strstr(cs1, ".fpf"))
+    if (strstr(cs1, "vp3") || strstr(cs1, ".fpf") || strstr(cs1, ".col"))
     {
 	int r;
 	int flg = 0;
@@ -4544,6 +4568,12 @@
     return TRUE;
 }
 
+static void WINAPI expTerminateProcess( DWORD process, DWORD status )
+{
+    printf("EXIT - process %ld code %ld\n", process, status);
+    exit(status);
+}
+
 static void WINAPI expExitProcess( DWORD status )
 {
     printf("EXIT - code %ld\n",status);
@@ -4593,6 +4623,28 @@
 //    dbgprintf("ntohl(%x) => %x\n", netlong, ntohl(netlong));
     return ntohl(netlong);
 }
+
+static char* WINAPI expSysAllocStringLen(char *pch, unsigned cch)
+{
+    char *str;
+    dbgprintf("SysAllocStringLen('%s', %d)\n", pch, cch);
+    str = (char *)malloc(cch * 2 + sizeof(unsigned) + 2);
+    if (pch != NULL) {
+        memcpy(str + sizeof(unsigned), pch, cch * 2);
+    }
+    *(str + sizeof(unsigned) + cch * 2) = 0;
+    *(str + sizeof(unsigned) + cch * 2 + 1) = 0;
+    memcpy(str, &cch, sizeof(cch));
+    return str + sizeof(unsigned);
+}
+
+static void WINAPI expSysFreeString(char *str)
+{
+    if (str) {
+        free(str - sizeof(unsigned));
+    }
+}
+
 static void WINAPI expVariantInit(void* p)
 {
     printf("InitCommonControls called!\n");
@@ -4847,6 +4899,20 @@
     return p;
 }
 
+static DWORD WINAPI expGetThreadLocale(void)
+{
+    return 0;
+}
+
+static DWORD WINAPI expGetLocaleInfoA(DWORD locale, DWORD lctype, char* lpLCData, int cchData)
+{
+    if (lctype == 0x1004) {  // LOCALE_IDEFAULTANSICODEPAGE
+       strcpy(lpLCData, "437");
+       return 0;
+    }
+    return 1;
+}
+
 struct exports
 {
     char name[64];
@@ -4998,6 +5064,7 @@
     FF(GetFullPathNameA,-1)
     FF(SetErrorMode, -1)
     FF(IsProcessorFeaturePresent, -1)
+    FF(IsDebuggerPresent, -1)
     FF(GetProcessAffinityMask, -1)
     FF(InterlockedExchange, -1)
     FF(InterlockedCompareExchange, -1)
@@ -5018,12 +5085,15 @@
     FF(GlobalMemoryStatus,-1)
     FF(GetThreadPriority,-1)
     FF(SetThreadPriority,-1)
+    FF(TerminateProcess,-1)
     FF(ExitProcess,-1)
     {"LoadLibraryExA", -1, (void*)&LoadLibraryExA},
     FF(SetThreadIdealProcessor,-1)
     FF(SetProcessAffinityMask, -1)
     FF(EncodePointer, -1)
     FF(DecodePointer, -1)
+    FF(GetThreadLocale, -1)
+    FF(GetLocaleInfoA, -1)
     UNDEFF(FlsAlloc, -1)
     UNDEFF(FlsGetValue, -1)
     UNDEFF(FlsSetValue, -1)
@@ -5107,6 +5177,9 @@
     FF(waveOutGetNumDevs, -1)
 #endif
 };
+struct exports exp_psapi[]={
+    FF(GetModuleBaseNameA, -1)
+};
 struct exports exp_user32[]={
     FF(LoadIconA,-1)
     FF(LoadStringA, -1)
@@ -5221,6 +5294,8 @@
     FF(MoInitMediaType, -1)
 };
 struct exports exp_oleaut32[]={
+    FF(SysAllocStringLen, 4)
+    FF(SysFreeString, 6)
     FF(VariantInit, 8)
 #ifdef QTX
     FF(SysStringByteLen, 149)
@@ -5303,6 +5378,7 @@
     LL(kernel32)
     LL(msvcrt)
     LL(winmm)
+    LL(psapi)
     LL(user32)
     LL(advapi32)
     LL(gdi32)

-- 
Homepage: http://www.sesse.net/



More information about the MPlayer-dev-eng mailing list