summaryrefslogtreecommitdiffstats
path: root/loader
diff options
context:
space:
mode:
authoralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-04-21 21:06:08 +0000
committeralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-04-21 21:06:08 +0000
commit597c4bf9259a707196273bd6cfe06bb408fb6843 (patch)
treed0c3bc73a8c113bbdc6d14c2d8f71519f4b95739 /loader
parent6d21e908a0cc9fccdcfa0063af05cd1627dcc9bb (diff)
downloadmpv-597c4bf9259a707196273bd6cfe06bb408fb6843.tar.bz2
mpv-597c4bf9259a707196273bd6cfe06bb408fb6843.tar.xz
cygwin support patch by Sascha Sommer and some fixes by me
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9968 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'loader')
-rw-r--r--loader/com.h7
-rw-r--r--loader/dmo/DMO_AudioDecoder.c8
-rw-r--r--loader/dmo/DMO_VideoDecoder.c10
-rw-r--r--loader/dmo/dmo.c5
-rw-r--r--loader/driver.c16
-rw-r--r--loader/dshow/DS_AudioDecoder.c7
-rw-r--r--loader/dshow/DS_Filter.c25
-rw-r--r--loader/dshow/DS_VideoDecoder.c8
-rw-r--r--loader/dshow/allocator.c5
9 files changed, 84 insertions, 7 deletions
diff --git a/loader/com.h b/loader/com.h
index 741b25232b..4f8e180684 100644
--- a/loader/com.h
+++ b/loader/com.h
@@ -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" {
diff --git a/loader/dmo/DMO_AudioDecoder.c b/loader/dmo/DMO_AudioDecoder.c
index 647fd8b912..a1a0b66d22 100644
--- a/loader/dmo/DMO_AudioDecoder.c
+++ b/loader/dmo/DMO_AudioDecoder.c
@@ -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 @@ DMO_AudioDecoder * DMO_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX
int sz;
WAVEFORMATEX* pWF;
+#ifdef WIN32_LOADER
Setup_LDT_Keeper();
Setup_FS_Segment();
+#endif
this = malloc(sizeof(DMO_AudioDecoder));
@@ -118,7 +122,9 @@ int DMO_AudioDecoder_Convert(DMO_AudioDecoder *this, const void* in_data, unsign
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);
diff --git a/loader/dmo/DMO_VideoDecoder.c b/loader/dmo/DMO_VideoDecoder.c
index c0672cbe46..9c3fc474a8 100644
--- a/loader/dmo/DMO_VideoDecoder.c
+++ b/loader/dmo/DMO_VideoDecoder.c
@@ -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 @@ DMO_VideoDecoder * DMO_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHE
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 @@ int DMO_VideoDecoder_DecodeInternal(DMO_VideoDecoder *this, const void* src, int
// 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 @@ int DMO_VideoDecoder_SetDestFmt(DMO_VideoDecoder *this, int bits, unsigned int c
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);
diff --git a/loader/dmo/dmo.c b/loader/dmo/dmo.c
index f328a86969..9539678b72 100644
--- a/loader/dmo/dmo.c
+++ b/loader/dmo/dmo.c
@@ -1,3 +1,4 @@
+#include "config.h"
#include "DMO_Filter.h"
#include "driver.h"
#include "com.h"
@@ -19,7 +20,9 @@ void DMO_Filter_Destroy(DMO_Filter* This)
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 @@ DMO_Filter* DMO_FilterCreate(const char* dllname, const GUID* id,
return NULL;
memset(This, 0, sizeof(DMO_Filter));
+#ifdef WIN32_LOADER
CodecAlloc();
+#endif
//This->Start = DS_Filter_Start;
//This->Stop = DS_Filter_Stop;
diff --git a/loader/driver.c b/loader/driver.c
index 7f41288b2f..4908f72513 100644
--- a/loader/driver.c
+++ b/loader/driver.c
@@ -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 @@ LRESULT WINAPI SendDriverMessage(HDRVR hDriver, UINT message,
__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 @@ void DrvClose(HDRVR hDriver)
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 @@ void DrvClose(HDRVR hDriver)
}
free(d);
}
+#ifdef WIN32_LOADER
CodecRelease();
+#endif
}
//DrvOpen(LPCSTR lpszDriverName, LPCSTR lpszSectionName, LPARAM lParam2)
@@ -133,7 +145,9 @@ HDRVR DrvOpen(LPARAM lParam2)
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 @@ HDRVR DrvOpen(LPARAM lParam2)
return ((HDRVR) 0);
memset((void*)hDriver, 0, sizeof(DRVR));
+#ifdef WIN32_LOADER
CodecAlloc();
Setup_FS_Segment();
+#endif
hDriver->hDriverModule = LoadLibraryA(filename);
if (!hDriver->hDriverModule)
diff --git a/loader/dshow/DS_AudioDecoder.c b/loader/dshow/DS_AudioDecoder.c
index 851854a9df..b3a2021956 100644
--- a/loader/dshow/DS_AudioDecoder.c
+++ b/loader/dshow/DS_AudioDecoder.c
@@ -4,6 +4,7 @@
Copyright 2001 Eugene Kuznetsov (divx@euro.ru)
*********************************************************/
+#include "config.h"
#ifndef NOAVIFILE_HEADERS
#include "audiodecoder.h"
@@ -24,7 +25,9 @@ struct _DS_AudioDecoder
};
#include "DS_AudioDecoder.h"
+#ifdef WIN32_LOADER
#include "../ldt_keeper.h"
+#endif
#include <string.h>
#include <stdio.h>
@@ -41,8 +44,10 @@ DS_AudioDecoder * DS_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX*
int sz;
WAVEFORMATEX* pWF;
+#ifdef WIN32_LOADER
Setup_LDT_Keeper();
Setup_FS_Segment();
+#endif
this = malloc(sizeof(DS_AudioDecoder));
@@ -141,7 +146,9 @@ int DS_AudioDecoder_Convert(DS_AudioDecoder *this, const void* in_data, unsigned
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)
diff --git a/loader/dshow/DS_Filter.c b/loader/dshow/DS_Filter.c
index 8482201317..ccc45bcb89 100644
--- a/loader/dshow/DS_Filter.c
+++ b/loader/dshow/DS_Filter.c
@@ -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 @@ void DS_Filter_Destroy(DS_Filter* This)
free(This);
+#ifdef WIN32_LOADER
CodecRelease();
+#else
+ CoUninitialize();
+#endif
}
DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id,
@@ -92,7 +113,11 @@ DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id,
if (!This)
return NULL;
+#ifdef WIN32_LOADER
CodecAlloc();
+#else
+ CoInitialize(0L);
+#endif
This->m_pFilter = NULL;
This->m_pInputPin = NULL;
diff --git a/loader/dshow/DS_VideoDecoder.c b/loader/dshow/DS_VideoDecoder.c
index 231059109d..cab9291929 100644
--- a/loader/dshow/DS_VideoDecoder.c
+++ b/loader/dshow/DS_VideoDecoder.c
@@ -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 @@ struct _DS_VideoDecoder
#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 @@ DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEAD
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 @@ int DS_VideoDecoder_DecodeInternal(DS_VideoDecoder *this, const void* src, int s
// 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
diff --git a/loader/dshow/allocator.c b/loader/dshow/allocator.c
index 34d453727e..379b859d4c 100644
--- a/loader/dshow/allocator.c
+++ b/loader/dshow/allocator.c
@@ -1,3 +1,4 @@
+#include "config.h"
#include "allocator.h"
#include "com.h"
#include "wine/winerror.h"
@@ -286,8 +287,10 @@ static void MemAllocator_ResetPointer(MemAllocator* This)
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 @@ MemAllocator* MemAllocatorCreate()
This->interfaces[0]=IID_IUnknown;
This->interfaces[1]=IID_IMemAllocator;
+#ifdef WIN32_LOADER
if (AllocatorKeeper++ == 0)
RegisterComClass(&CLSID_MemoryAllocator, MemAllocator_CreateAllocator);
+#endif
return This;
}