changeset 8292:9533c26c0806

avifile sync (mostly cosmetics)
author arpi
date Tue, 26 Nov 2002 21:00:20 +0000
parents abe95dde3223
children f436f419e5ab
files loader/dshow/DS_AudioDecoder.c loader/dshow/DS_Filter.c loader/dshow/allocator.c loader/dshow/allocator.h loader/dshow/cmediasample.c loader/dshow/guids.c loader/dshow/guids.h loader/dshow/inputpin.h loader/dshow/iunk.h loader/dshow/outputpin.c
diffstat 10 files changed, 49 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/loader/dshow/DS_AudioDecoder.c	Tue Nov 26 18:54:23 2002 +0000
+++ b/loader/dshow/DS_AudioDecoder.c	Tue Nov 26 21:00:20 2002 +0000
@@ -30,18 +30,6 @@
 #include <stdlib.h>
 
 #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**);
 
--- a/loader/dshow/DS_Filter.c	Tue Nov 26 18:54:23 2002 +0000
+++ b/loader/dshow/DS_Filter.c	Tue Nov 26 21:00:20 2002 +0000
@@ -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 @@
 	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 @@
 
     // 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 @@
     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 @@
 
     for (;;)
     {
-	HRESULT result;
 	GETCLASS func;
 	struct IClassFactory* factory = NULL;
 	struct IUnknown* object = NULL;
@@ -123,7 +123,7 @@
 	    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 @@
 
 	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 @@
     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;
--- a/loader/dshow/allocator.c	Tue Nov 26 18:54:23 2002 +0000
+++ b/loader/dshow/allocator.c	Tue Nov 26 21:00:20 2002 +0000
@@ -283,7 +283,7 @@
     }
 }
 
-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)
--- a/loader/dshow/allocator.h	Tue Nov 26 18:54:23 2002 +0000
+++ b/loader/dshow/allocator.h	Tue Nov 26 21:00:20 2002 +0000
@@ -22,6 +22,6 @@
     void ( *ResetPointer )(MemAllocator* This);
 };
 
-MemAllocator* MemAllocatorCreate();
+MemAllocator* MemAllocatorCreate(void);
 
 #endif /* DS_ALLOCATOR_H */
--- a/loader/dshow/cmediasample.c	Tue Nov 26 18:54:23 2002 +0000
+++ b/loader/dshow/cmediasample.c	Tue Nov 26 21:00:20 2002 +0000
@@ -4,6 +4,13 @@
 #include <string.h>
 #include <stdlib.h>
 
+/*
+ * 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 @@
 					    /* [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 @@
 					    /* [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 @@
 {
     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 @@
     //    _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)
--- a/loader/dshow/guids.c	Tue Nov 26 18:54:23 2002 +0000
+++ b/loader/dshow/guids.c	Tue Nov 26 21:00:20 2002 +0000
@@ -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 @@
     {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 @@
     {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}};
--- a/loader/dshow/guids.h	Tue Nov 26 18:54:23 2002 +0000
+++ b/loader/dshow/guids.h	Tue Nov 26 21:00:20 2002 +0000
@@ -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 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_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 */
--- a/loader/dshow/inputpin.h	Tue Nov 26 18:54:23 2002 +0000
+++ b/loader/dshow/inputpin.h	Tue Nov 26 21:00:20 2002 +0000
@@ -14,7 +14,7 @@
     IPin* ( *GetPin )(CBaseFilter2* This);
 };
 
-CBaseFilter2* CBaseFilter2Create();
+CBaseFilter2* CBaseFilter2Create(void);
 
 
 typedef struct _CBaseFilter CBaseFilter;
--- a/loader/dshow/iunk.h	Tue Nov 26 18:54:23 2002 +0000
+++ b/loader/dshow/iunk.h	Tue Nov 26 21:00:20 2002 +0000
@@ -18,7 +18,7 @@
     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; i<sizeof(me->interfaces)/sizeof(me->interfaces[0]); r++, i++) \
 	if(!memcmp(r, riid, sizeof(*r)))	\
 	{ 					\
@@ -26,7 +26,7 @@
 	    *ppvObject=This; 			\
 	    return 0; 				\
 	} 					\
-    Debug printf("Query failed!\n");		\
+    Debug printf("Query failed! (GUID: 0x%x)\n", *(unsigned int*)riid); \
     return E_NOINTERFACE;			\
 } 						\
 						\
--- a/loader/dshow/outputpin.c	Tue Nov 26 18:54:23 2002 +0000
+++ b/loader/dshow/outputpin.c	Tue Nov 26 21:00:20 2002 +0000
@@ -84,7 +84,7 @@
     return E_NOTIMPL;
 }
 
-void CEnumMediaTypes_Destroy(CEnumMediaTypes* This)
+static void CEnumMediaTypes_Destroy(CEnumMediaTypes* This)
 {
     free(This->vt);
     free(This);
@@ -93,7 +93,7 @@
 // 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)) ;