From f468246cdff9fe045b40b9eb1bc2041b0ab1d436 Mon Sep 17 00:00:00 2001 From: arpi Date: Tue, 26 Nov 2002 21:00:20 +0000 Subject: avifile sync (mostly cosmetics) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8293 b3059339-0415-0410-9bf9-f77b7e298cf2 --- loader/dshow/DS_AudioDecoder.c | 12 ------------ loader/dshow/DS_Filter.c | 14 +++++++------- loader/dshow/allocator.c | 2 +- loader/dshow/allocator.h | 2 +- loader/dshow/cmediasample.c | 18 +++++++++++++----- loader/dshow/guids.c | 14 +++++++++++++- loader/dshow/guids.h | 11 +++++++++-- loader/dshow/inputpin.h | 2 +- loader/dshow/iunk.h | 4 ++-- loader/dshow/outputpin.c | 4 ++-- 10 files changed, 49 insertions(+), 34 deletions(-) diff --git a/loader/dshow/DS_AudioDecoder.c b/loader/dshow/DS_AudioDecoder.c index 3e97822988..01a95e8fa4 100644 --- a/loader/dshow/DS_AudioDecoder.c +++ b/loader/dshow/DS_AudioDecoder.c @@ -30,18 +30,6 @@ struct _DS_AudioDecoder #include #define __MODULE__ "DirectShow audio decoder" -const GUID FORMAT_WaveFormatEx = { - 0x05589f81, 0xc356, 0x11CE, - { 0xBF, 0x01, 0x00, 0xAA, 0x00, 0x55, 0x59, 0x5A } -}; -const GUID MEDIATYPE_Audio = { - 0x73647561, 0x0000, 0x0010, - { 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 } -}; -const GUID MEDIASUBTYPE_PCM = { - 0x00000001, 0x0000, 0x0010, - { 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 } -}; typedef long STDCALL (*GETCLASS) (GUID*, GUID*, void**); diff --git a/loader/dshow/DS_Filter.c b/loader/dshow/DS_Filter.c index 50f0cec843..8482201317 100644 --- a/loader/dshow/DS_Filter.c +++ b/loader/dshow/DS_Filter.c @@ -8,7 +8,7 @@ typedef long STDCALL (*GETCLASS) (const GUID*, const GUID*, void**); -//extern "C" STDCALL void* GetProcAddress(int, const char*); // STDCALL has to be first NetBSD +//void trapbug(); static void DS_Filter_Start(DS_Filter* This) { @@ -18,7 +18,7 @@ static void DS_Filter_Start(DS_Filter* This) return; //Debug printf("DS_Filter_Start(%p)\n", This); - hr = This->m_pFilter->vt->Run(This->m_pFilter, 0); + hr = This->m_pFilter->vt->Run(This->m_pFilter, (REFERENCE_TIME)0); if (hr != 0) { Debug printf("WARNING: m_Filter->Run() failed, error code %x\n", (int)hr); @@ -73,7 +73,7 @@ void DS_Filter_Destroy(DS_Filter* This) // FIXME - we are still leaving few things allocated! if (This->m_iHandle) - FreeLibrary(This->m_iHandle); + FreeLibrary((unsigned)This->m_iHandle); free(This); @@ -87,6 +87,7 @@ DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id, int init = 0; // char eb[250]; const char* em = NULL; + HRESULT result; DS_Filter* This = (DS_Filter*) malloc(sizeof(DS_Filter)); if (!This) return NULL; @@ -108,7 +109,6 @@ DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id, for (;;) { - HRESULT result; GETCLASS func; struct IClassFactory* factory = NULL; struct IUnknown* object = NULL; @@ -123,7 +123,7 @@ DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id, em = "could not open DirectShow DLL"; break; } - func = (GETCLASS)GetProcAddress(This->m_iHandle, "DllGetClassObject"); + func = (GETCLASS)GetProcAddress((unsigned)This->m_iHandle, "DllGetClassObject"); if (!func) { em = "illegal or corrupt DirectShow DLL"; @@ -159,7 +159,7 @@ DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id, enum_pins->vt->Reset(enum_pins); result = enum_pins->vt->Next(enum_pins, (ULONG)256, (IPin**)array, &fetched); - Debug printf("Pins enumeration returned %d pins, error is %x\n", (int)fetched, (int)result); + Debug printf("Pins enumeration returned %ld pins, error is %x\n", fetched, (int)result); for (i = 0; i < fetched; i++) { @@ -236,7 +236,7 @@ DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id, if (!init) { DS_Filter_Destroy(This); - printf("Warning: DS_Filter() %s. (DLL=%.200s)\n", em, dllname); + printf("Warning: DS_Filter() %s. (DLL=%.200s, r=0x%x)\n", em, dllname, result); This = 0; } return This; diff --git a/loader/dshow/allocator.c b/loader/dshow/allocator.c index c5600f40d9..7f39c66a2e 100644 --- a/loader/dshow/allocator.c +++ b/loader/dshow/allocator.c @@ -283,7 +283,7 @@ static void MemAllocator_ResetPointer(MemAllocator* This) } } -void MemAllocator_Destroy(MemAllocator* This) +static void MemAllocator_Destroy(MemAllocator* This) { Debug printf("MemAllocator_Destroy(%p) called (%d, %d)\n", This, This->refcount, AllocatorKeeper); if (--AllocatorKeeper == 0) diff --git a/loader/dshow/allocator.h b/loader/dshow/allocator.h index b4f6aaf703..ef1efd7370 100644 --- a/loader/dshow/allocator.h +++ b/loader/dshow/allocator.h @@ -22,6 +22,6 @@ struct _MemAllocator void ( *ResetPointer )(MemAllocator* This); }; -MemAllocator* MemAllocatorCreate(); +MemAllocator* MemAllocatorCreate(void); #endif /* DS_ALLOCATOR_H */ diff --git a/loader/dshow/cmediasample.c b/loader/dshow/cmediasample.c index e618f68674..e0519129eb 100644 --- a/loader/dshow/cmediasample.c +++ b/loader/dshow/cmediasample.c @@ -4,6 +4,13 @@ #include #include +/* + * currently hack to make some extra room for DS Acel codec which + * seems to overwrite allocated memory - FIXME better later + * check the buffer allocation + */ +static const int SAFETY_ACEL = 1024; + static long STDCALL CMediaSample_QueryInterface(IUnknown* This, /* [in] */ const GUID* iid, /* [iid_is][out] */ void **ppv) @@ -78,7 +85,7 @@ static HRESULT STDCALL CMediaSample_GetTime(IMediaSample * This, /* [out] */ REFERENCE_TIME *pTimeStart, /* [out] */ REFERENCE_TIME *pTimeEnd) { - Debug printf("CMediaSample_GetTime(%p) called (UNIMPLIMENTED)\n", This); + Debug printf("CMediaSample_GetTime(%p) called (UNIMPLEMENTED)\n", This); return E_NOTIMPL; } @@ -86,7 +93,7 @@ static HRESULT STDCALL CMediaSample_SetTime(IMediaSample * This, /* [in] */ REFERENCE_TIME *pTimeStart, /* [in] */ REFERENCE_TIME *pTimeEnd) { - Debug printf("CMediaSample_SetTime(%p) called (UNIMPLIMENTED)\n", This); + Debug printf("CMediaSample_SetTime(%p) called (UNIMPLEMENTED)\n", This); return E_NOTIMPL; } @@ -135,12 +142,13 @@ static HRESULT STDCALL CMediaSample_SetActualDataLength(IMediaSample* This, { CMediaSample* cms = (CMediaSample*)This; Debug printf("CMediaSample_SetActualDataLength(%p, %ld) called\n", This, __MIDL_0010); + if (__MIDL_0010 > cms->size) { char* c = cms->own_block; - Debug printf(" CMediaSample - buffer overflow %ld %d %p %p\n", + Debug printf("CMediaSample - buffer overflow %ld %d %p %p\n", __MIDL_0010, ((CMediaSample*)This)->size, cms->own_block, cms->block); - cms->own_block = realloc(cms->own_block, __MIDL_0010); + cms->own_block = (char*) realloc(cms->own_block, (size_t) __MIDL_0010 + SAFETY_ACEL); if (c == cms->block) cms->block = cms->own_block; cms->size = __MIDL_0010; @@ -266,7 +274,7 @@ CMediaSample* CMediaSampleCreate(IMemAllocator* allocator, int _size) // _size = (_size + 0xfff) & ~0xfff; This->vt = (IMediaSample_vt*) malloc(sizeof(IMediaSample_vt)); - This->own_block = (char*) malloc(_size); + This->own_block = (char*) malloc((size_t)_size + SAFETY_ACEL); This->media_type.pbFormat = 0; if (!This->vt || !This->own_block) diff --git a/loader/dshow/guids.c b/loader/dshow/guids.c index 9dae571fad..73cf7f5456 100644 --- a/loader/dshow/guids.c +++ b/loader/dshow/guids.c @@ -1,5 +1,4 @@ #include "guids.h" -int DSHOW_DEBUG = 0; const GUID CLSID_DivxDecompressorCF={0x82CCd3E0, 0xF71A, 0x11D0, { 0x9f, 0xe5, 0x00, 0x60, 0x97, 0x78, 0xaa, 0xaa}}; @@ -27,6 +26,12 @@ const GUID GUID_NULL={0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}; const GUID FORMAT_VideoInfo={0x05589f80, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}}; +const GUID MEDIASUBTYPE_RGB1={0xe436eb78, 0x524f, 0x11ce, + {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; +const GUID MEDIASUBTYPE_RGB4={0xe436eb79, 0x524f, 0x11ce, + {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; +const GUID MEDIASUBTYPE_RGB8={0xe436eb7a, 0x524f, 0x11ce, + {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; const GUID MEDIASUBTYPE_RGB565={0xe436eb7b, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; const GUID MEDIASUBTYPE_RGB555={0xe436eb7c, 0x524f, 0x11ce, @@ -65,3 +70,10 @@ const GUID IID_DivxHidden={0x598eba01, 0xb49a, 0x11d2, {0xa1, 0xc1, 0x00, 0x60, 0x97, 0x78, 0xaa, 0xaa}}; const GUID IID_Iv50Hidden={0x665a4442, 0xd905, 0x11d0, {0xa3, 0x0e, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}; + +const GUID FORMAT_WaveFormatEx = {0x05589f81, 0xc356, 0x11CE, + {0xBF, 0x01, 0x00, 0xAA, 0x00, 0x55, 0x59, 0x5A}}; +const GUID MEDIATYPE_Audio = {0x73647561, 0x0000, 0x0010, + {0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71}}; +const GUID MEDIASUBTYPE_PCM = {0x00000001, 0x0000, 0x0010, + {0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71}}; diff --git a/loader/dshow/guids.h b/loader/dshow/guids.h index 6198f06632..99a101a4db 100644 --- a/loader/dshow/guids.h +++ b/loader/dshow/guids.h @@ -6,8 +6,8 @@ #include "wine/windef.h" #include "wine/vfw.h" -extern int DSHOW_DEBUG; -#define Debug if(DSHOW_DEBUG) +//#define Debug if(1) +#define Debug if(0) typedef struct __attribute__((__packed__)) _MediaType { @@ -58,6 +58,9 @@ extern const GUID CLSID_MemoryAllocator; extern const GUID MEDIATYPE_Video; extern const GUID GUID_NULL; extern const GUID FORMAT_VideoInfo; +extern const GUID MEDIASUBTYPE_RGB1; +extern const GUID MEDIASUBTYPE_RGB4; +extern const GUID MEDIASUBTYPE_RGB8; extern const GUID MEDIASUBTYPE_RGB565; extern const GUID MEDIASUBTYPE_RGB555; extern const GUID MEDIASUBTYPE_RGB24; @@ -75,4 +78,8 @@ extern const GUID MEDIASUBTYPE_YV12; extern const GUID MEDIASUBTYPE_I420; extern const GUID MEDIASUBTYPE_IF09; +extern const GUID FORMAT_WaveFormatEx; +extern const GUID MEDIATYPE_Audio; +extern const GUID MEDIASUBTYPE_PCM; + #endif /* DS_GUIDS_H */ diff --git a/loader/dshow/inputpin.h b/loader/dshow/inputpin.h index 04f27a6171..a8ccdcccf9 100644 --- a/loader/dshow/inputpin.h +++ b/loader/dshow/inputpin.h @@ -14,7 +14,7 @@ struct _CBaseFilter2 IPin* ( *GetPin )(CBaseFilter2* This); }; -CBaseFilter2* CBaseFilter2Create(); +CBaseFilter2* CBaseFilter2Create(void); typedef struct _CBaseFilter CBaseFilter; diff --git a/loader/dshow/iunk.h b/loader/dshow/iunk.h index 3c66b154c7..83ccac5cb3 100644 --- a/loader/dshow/iunk.h +++ b/loader/dshow/iunk.h @@ -18,7 +18,7 @@ static long STDCALL CLASSNAME ## _QueryInterface(IUnknown * This, \ CLASSNAME * me = (CLASSNAME *)This; \ GUID* r; unsigned int i = 0; \ Debug printf(#CLASSNAME "_QueryInterface(%p) called\n", This);\ - if (!ppvObject) return 0x80004003; \ + if (!ppvObject) return E_POINTER; \ for(r=me->interfaces; iinterfaces)/sizeof(me->interfaces[0]); r++, i++) \ if(!memcmp(r, riid, sizeof(*r))) \ { \ @@ -26,7 +26,7 @@ static long STDCALL CLASSNAME ## _QueryInterface(IUnknown * This, \ *ppvObject=This; \ return 0; \ } \ - Debug printf("Query failed!\n"); \ + Debug printf("Query failed! (GUID: 0x%x)\n", *(unsigned int*)riid); \ return E_NOINTERFACE; \ } \ \ diff --git a/loader/dshow/outputpin.c b/loader/dshow/outputpin.c index 5e9a76b9ef..14e8af756a 100644 --- a/loader/dshow/outputpin.c +++ b/loader/dshow/outputpin.c @@ -84,7 +84,7 @@ static HRESULT STDCALL CEnumMediaTypes_Clone(IEnumMediaTypes * This, return E_NOTIMPL; } -void CEnumMediaTypes_Destroy(CEnumMediaTypes* This) +static void CEnumMediaTypes_Destroy(CEnumMediaTypes* This) { free(This->vt); free(This); @@ -93,7 +93,7 @@ void CEnumMediaTypes_Destroy(CEnumMediaTypes* This) // IPin->IUnknown methods IMPLEMENT_IUNKNOWN(CEnumMediaTypes) -CEnumMediaTypes* CEnumMediaTypesCreate(const AM_MEDIA_TYPE* amt) +static CEnumMediaTypes* CEnumMediaTypesCreate(const AM_MEDIA_TYPE* amt) { CEnumMediaTypes *This = (CEnumMediaTypes*) malloc(sizeof(CEnumMediaTypes)) ; -- cgit v1.2.3