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
This commit is contained in:
alex 2003-04-21 21:06:08 +00:00
parent 6d21e908a0
commit 597c4bf925
9 changed files with 84 additions and 7 deletions

View File

@ -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" {

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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)

View File

@ -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)

View File

@ -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;

View File

@ -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

View File

@ -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;
}