changeset 9967:b0d1b415320c

cygwin support patch by Sascha Sommer and some fixes by me
author alex
date Mon, 21 Apr 2003 21:06:08 +0000
parents 9aeb20839969
children c372140a1012
files loader/com.h loader/dmo/DMO_AudioDecoder.c loader/dmo/DMO_VideoDecoder.c loader/dmo/dmo.c loader/driver.c loader/dshow/DS_AudioDecoder.c loader/dshow/DS_Filter.c loader/dshow/DS_VideoDecoder.c loader/dshow/allocator.c
diffstat 9 files changed, 84 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/loader/com.h	Mon Apr 21 21:04:59 2003 +0000
+++ b/loader/com.h	Mon Apr 21 21:06:08 2003 +0000
@@ -1,9 +1,8 @@
 #ifndef AVIFILE_COM_H
 #define AVIFILE_COM_H
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "config.h"
+
 #ifdef HAVE_STDINT_H
 #include <stdint.h>
 #else
@@ -14,7 +13,7 @@
  * Internal functions and structures for COM emulation code.
  */
 
-#ifndef WIN32
+#if !defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32)
 
 #ifdef __cplusplus
 extern "C" {
--- a/loader/dmo/DMO_AudioDecoder.c	Mon Apr 21 21:04:59 2003 +0000
+++ b/loader/dmo/DMO_AudioDecoder.c	Mon Apr 21 21:06:08 2003 +0000
@@ -4,14 +4,16 @@
 	 Copyright 2001 Eugene Kuznetsov  (divx@euro.ru)
 
 *********************************************************/
-
+#include "config.h"
 #ifndef NOAVIFILE_HEADERS
 #include "audiodecoder.h"
 #include "except.h"
 #else
 #include "libwin32.h"
+#ifdef WIN32_LOADER
 #include "ldt_keeper.h"
 #endif
+#endif
 
 #include "DMO_Filter.h"
 #include "DMO_AudioDecoder.h"
@@ -43,8 +45,10 @@
     int sz;
     WAVEFORMATEX* pWF;
 
+#ifdef WIN32_LOADER
     Setup_LDT_Keeper();
     Setup_FS_Segment();
+#endif
         
     this = malloc(sizeof(DMO_AudioDecoder));
     
@@ -118,7 +122,9 @@
     if (!in_data || !out_data)
 	return -1;
 
+#ifdef WIN32_LOADER
     Setup_FS_Segment();
+#endif
     
     //m_pDMO_Filter->m_pMedia->vt->Lock(m_pDMO_Filter->m_pMedia, 1);
     bufferin = CMediaBufferCreate(in_size, (void*)in_data, in_size, 1);
--- a/loader/dmo/DMO_VideoDecoder.c	Mon Apr 21 21:04:59 2003 +0000
+++ b/loader/dmo/DMO_VideoDecoder.c	Mon Apr 21 21:06:08 2003 +0000
@@ -4,11 +4,13 @@
 	Copyright 2000 Eugene Kuznetsov  (divx@euro.ru)
 
 *********************************************************/
-
+#include "config.h"
 #include "guids.h"
 #include "interfaces.h"
 #include "registry.h"
+#ifdef WIN32_LOADER
 #include "../ldt_keeper.h"
+#endif
 
 #ifndef NOAVIFILE_HEADERS
 #include "videodecoder.h"
@@ -101,7 +103,9 @@
     this->m_iLastQuality = -1;
     this->m_iMaxAuto = maxauto;
 
+#ifdef WIN32_LOADER
     Setup_LDT_Keeper();
+#endif
 
     //memset(&m_obh, 0, sizeof(m_obh));
     //m_obh.biSize = sizeof(m_obh);
@@ -313,7 +317,9 @@
 //	return -1;
 //    }
 
+#ifdef WIN32_LOADER
     Setup_FS_Segment();
+#endif
 
     bufferin = CMediaBufferCreate(size, (void*)src, size, 0);
     result = this->m_pDMO_Filter->m_pMedia->vt->ProcessInput(this->m_pDMO_Filter->m_pMedia, 0,
@@ -500,7 +506,9 @@
 	break;
     }
 
+#ifdef WIN32_LOADER
     Setup_FS_Segment();
+#endif
 
 //    if(should_test)
 //	result = this->m_pDMO_Filter->m_pOutputPin->vt->QueryAccept(this->m_pDMO_Filter->m_pOutputPin, &this->m_sDestType);
--- a/loader/dmo/dmo.c	Mon Apr 21 21:04:59 2003 +0000
+++ b/loader/dmo/dmo.c	Mon Apr 21 21:06:08 2003 +0000
@@ -1,3 +1,4 @@
+#include "config.h"
 #include "DMO_Filter.h"
 #include "driver.h"
 #include "com.h"
@@ -19,7 +20,9 @@
 	This->m_pMedia->vt->Release((IUnknown*)This->m_pMedia);
 
     free(This);
+#ifdef WIN32_LOADER
     CodecRelease();
+#endif
 }
 
 DMO_Filter* DMO_FilterCreate(const char* dllname, const GUID* id,
@@ -33,7 +36,9 @@
 	return NULL;
 
     memset(This, 0, sizeof(DMO_Filter));
+#ifdef WIN32_LOADER
     CodecAlloc();
+#endif
 
     //This->Start = DS_Filter_Start;
     //This->Stop = DS_Filter_Stop;
--- a/loader/driver.c	Mon Apr 21 21:04:59 2003 +0000
+++ b/loader/driver.c	Mon Apr 21 21:06:08 2003 +0000
@@ -15,11 +15,17 @@
 #include "wine/winreg.h"
 #include "wine/vfw.h"
 #include "registry.h"
+#ifdef WIN32_LOADER
 #include "ldt_keeper.h"
+#endif
 #include "driver.h"
 #include "ext.h"
 
+#ifndef WIN32_LOADER
+char* def_path=WIN32_PATH;
+#else
 extern char* def_path;
+#endif
 
 #if 1
 
@@ -87,7 +93,9 @@
     __asm__ __volatile__ ("fsave (%0)\n\t": :"r"(&qw));
 #endif
 
+#ifdef WIN32_LOADER
     Setup_FS_Segment();
+#endif
 
     STORE_ALL;
     result=module->DriverProc(module->dwDriverID, hDriver, message, lParam1, lParam2);
@@ -110,7 +118,9 @@
 	DRVR* d = (DRVR*)hDriver;
 	if (d->hDriverModule)
 	{
+#ifdef WIN32_LOADER
 	    Setup_FS_Segment();
+#endif
 	    if (d->DriverProc)
 	    {
 		SendDriverMessage(hDriver, DRV_CLOSE, 0, 0);
@@ -121,7 +131,9 @@
 	}
 	free(d);
     }
+#ifdef WIN32_LOADER
     CodecRelease();
+#endif
 }
 
 //DrvOpen(LPCSTR lpszDriverName, LPCSTR lpszSectionName, LPARAM lParam2)
@@ -133,7 +145,9 @@
     const char* filename = (const char*) ((ICOPEN*) lParam2)->pV1Reserved;
 
 #ifdef MPLAYER
+#ifdef WIN32_LOADER
     Setup_LDT_Keeper();
+#endif
     printf("Loading codec DLL: '%s'\n",filename);
 #endif
 
@@ -142,8 +156,10 @@
 	return ((HDRVR) 0);
     memset((void*)hDriver, 0, sizeof(DRVR));
 
+#ifdef WIN32_LOADER
     CodecAlloc();
     Setup_FS_Segment();
+#endif
 
     hDriver->hDriverModule = LoadLibraryA(filename);
     if (!hDriver->hDriverModule)
--- a/loader/dshow/DS_AudioDecoder.c	Mon Apr 21 21:04:59 2003 +0000
+++ b/loader/dshow/DS_AudioDecoder.c	Mon Apr 21 21:06:08 2003 +0000
@@ -4,6 +4,7 @@
 	 Copyright 2001 Eugene Kuznetsov  (divx@euro.ru)
 
 *********************************************************/
+#include "config.h"
 
 #ifndef NOAVIFILE_HEADERS
 #include "audiodecoder.h"
@@ -24,7 +25,9 @@
 };
 
 #include "DS_AudioDecoder.h"
+#ifdef WIN32_LOADER
 #include "../ldt_keeper.h"
+#endif
 
 #include <string.h>
 #include <stdio.h>
@@ -41,8 +44,10 @@
     int sz;
     WAVEFORMATEX* pWF;
 
+#ifdef WIN32_LOADER
     Setup_LDT_Keeper();
     Setup_FS_Segment();
+#endif
         
     this = malloc(sizeof(DS_AudioDecoder));
     
@@ -141,7 +146,9 @@
     if (!in_data || !out_data)
 	return -1;
 
+#ifdef WIN32_LOADER
     Setup_FS_Segment();
+#endif
 
     in_size -= in_size%this->in_fmt.nBlockAlign;
     while (in_size>0)
--- a/loader/dshow/DS_Filter.c	Mon Apr 21 21:04:59 2003 +0000
+++ b/loader/dshow/DS_Filter.c	Mon Apr 21 21:06:08 2003 +0000
@@ -1,3 +1,4 @@
+#include "config.h"
 #include "DS_Filter.h"
 #include "driver.h"
 #include "com.h"
@@ -8,6 +9,22 @@
 
 typedef long STDCALL (*GETCLASS) (const GUID*, const GUID*, void**);
 
+#ifndef WIN32_LOADER
+const GUID IID_IUnknown =
+{
+    0x00000000, 0x0000, 0x0000,
+    {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}
+};
+const GUID IID_IClassFactory =
+{
+    0x00000001, 0x0000, 0x0000,
+    {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}
+};
+
+HRESULT STDCALL CoInitialize(LPVOID pvReserved); 
+void STDCALL CoUninitialize(void); 
+#endif
+
 //void trapbug();
 
 static void DS_Filter_Start(DS_Filter* This)
@@ -77,7 +94,11 @@
 
     free(This);
 
+#ifdef WIN32_LOADER
     CodecRelease();
+#else
+    CoUninitialize();
+#endif
 }
 
 DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id,
@@ -92,7 +113,11 @@
     if (!This)
 	return NULL;
 
+#ifdef WIN32_LOADER
     CodecAlloc();
+#else
+    CoInitialize(0L);
+#endif
 
     This->m_pFilter = NULL;
     This->m_pInputPin = NULL;
--- a/loader/dshow/DS_VideoDecoder.c	Mon Apr 21 21:04:59 2003 +0000
+++ b/loader/dshow/DS_VideoDecoder.c	Mon Apr 21 21:06:08 2003 +0000
@@ -4,7 +4,7 @@
 	Copyright 2000 Eugene Kuznetsov  (divx@euro.ru)
 
 *********************************************************/
-
+#include "config.h"
 #include "guids.h"
 #include "interfaces.h"
 #include "registry.h"
@@ -35,7 +35,9 @@
 #include "DS_VideoDecoder.h"
 
 #include "../wine/winerror.h"
+#ifdef WIN32_LOADER
 #include "../ldt_keeper.h"
+#endif
 
 #ifndef NOAVIFILE_HEADERS
 #define VFW_E_NOT_RUNNING               0x80040226
@@ -97,7 +99,9 @@
     this->m_iLastQuality = -1;
     this->m_iMaxAuto = maxauto;
 
+#ifdef WIN32_LOADER
     Setup_LDT_Keeper();
+#endif
 
     //memset(&m_obh, 0, sizeof(m_obh));
     //m_obh.biSize = sizeof(m_obh);
@@ -327,7 +331,9 @@
     // crashes inside ...->Receive() fixed now?
     //
     // nope - but this is surely helpfull - I'll try some more experiments
+#ifdef WIN32_LOADER
     Setup_FS_Segment();
+#endif
 #if 0
     if (!this->m_pDS_Filter || !this->m_pDS_Filter->m_pImp
 	|| !this->m_pDS_Filter->m_pImp->vt
--- a/loader/dshow/allocator.c	Mon Apr 21 21:04:59 2003 +0000
+++ b/loader/dshow/allocator.c	Mon Apr 21 21:06:08 2003 +0000
@@ -1,3 +1,4 @@
+#include "config.h"
 #include "allocator.h"
 #include "com.h"
 #include "wine/winerror.h"
@@ -286,8 +287,10 @@
 static void MemAllocator_Destroy(MemAllocator* This)
 {
     Debug printf("MemAllocator_Destroy(%p) called  (%d, %d)\n", This, This->refcount, AllocatorKeeper);
+#ifdef WIN32_LOADER
     if (--AllocatorKeeper == 0)
 	UnregisterComClass(&CLSID_MemoryAllocator, MemAllocator_CreateAllocator);
+#endif
     free(This->vt);
     free(This);
 }
@@ -338,8 +341,10 @@
     This->interfaces[0]=IID_IUnknown;
     This->interfaces[1]=IID_IMemAllocator;
 
+#ifdef WIN32_LOADER
     if (AllocatorKeeper++ == 0)
 	RegisterComClass(&CLSID_MemoryAllocator, MemAllocator_CreateAllocator);
+#endif
 
     return This;
 }