summaryrefslogtreecommitdiff
path: root/src/libw32dll/DirectShow
diff options
context:
space:
mode:
Diffstat (limited to 'src/libw32dll/DirectShow')
-rw-r--r--src/libw32dll/DirectShow/DS_AudioDecoder.c12
-rw-r--r--src/libw32dll/DirectShow/DS_Filter.c17
-rw-r--r--src/libw32dll/DirectShow/allocator.c12
-rw-r--r--src/libw32dll/DirectShow/allocator.h11
-rw-r--r--src/libw32dll/DirectShow/cmediasample.c21
-rw-r--r--src/libw32dll/DirectShow/guids.c75
-rw-r--r--src/libw32dll/DirectShow/guids.h104
-rw-r--r--src/libw32dll/DirectShow/inputpin.h11
-rw-r--r--src/libw32dll/DirectShow/interfaces.h37
-rw-r--r--src/libw32dll/DirectShow/iunk.h11
-rw-r--r--src/libw32dll/DirectShow/outputpin.c18
-rw-r--r--src/libw32dll/DirectShow/outputpin.h12
12 files changed, 177 insertions, 164 deletions
diff --git a/src/libw32dll/DirectShow/DS_AudioDecoder.c b/src/libw32dll/DirectShow/DS_AudioDecoder.c
index 6f2cedbf3..79118efb9 100644
--- a/src/libw32dll/DirectShow/DS_AudioDecoder.c
+++ b/src/libw32dll/DirectShow/DS_AudioDecoder.c
@@ -30,18 +30,6 @@ struct _DS_AudioDecoder
#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**);
diff --git a/src/libw32dll/DirectShow/DS_Filter.c b/src/libw32dll/DirectShow/DS_Filter.c
index 09b49532b..cfa583535 100644
--- a/src/libw32dll/DirectShow/DS_Filter.c
+++ b/src/libw32dll/DirectShow/DS_Filter.c
@@ -3,10 +3,12 @@
#include "com.h"
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
+#include "win32.h" // printf macro
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)
{
@@ -16,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);
@@ -71,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);
@@ -82,6 +84,7 @@ DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id,
AM_MEDIA_TYPE* in_fmt,
AM_MEDIA_TYPE* out_fmt)
{
+ HRESULT result = 0;
int init = 0;
/* char eb[250]; -- unused */
const char* em = NULL;
@@ -106,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;
@@ -121,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";
@@ -144,7 +146,7 @@ DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id,
object->vt->Release((IUnknown*)object);
if (result || !This->m_pFilter)
{
- em = "object does not have IBaseFilter interface";
+ em = "object does not provide IBaseFilter interface";
break;
}
// enumerate pins
@@ -217,7 +219,6 @@ DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id,
}
This->m_pOurOutput = COutputPinCreate(This->m_pDestType);
-
result = This->m_pOutputPin->vt->ReceiveConnection(This->m_pOutputPin,
(IPin*) This->m_pOurOutput,
This->m_pDestType);
@@ -235,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/src/libw32dll/DirectShow/allocator.c b/src/libw32dll/DirectShow/allocator.c
index 0f7bf6838..cf4848da5 100644
--- a/src/libw32dll/DirectShow/allocator.c
+++ b/src/libw32dll/DirectShow/allocator.c
@@ -2,9 +2,17 @@
#include "com.h"
#include "../wine/winerror.h"
#include <stdio.h>
+#include <stdlib.h>
static int AllocatorKeeper = 0;
+struct _avm_list_t
+{
+ struct _avm_list_t* next;
+ struct _avm_list_t* prev;
+ void* member;
+};
+
static inline int avm_list_size(avm_list_t* head)
{
avm_list_t* it = head;
@@ -100,7 +108,7 @@ static inline avm_list_t* avm_list_find(avm_list_t* head, void* member)
return NULL;
}
-static long MemAllocator_CreateAllocator(GUID* clsid, GUID* iid, void** ppv)
+static long MemAllocator_CreateAllocator(GUID* clsid, const GUID* iid, void** ppv)
{
IMemAllocator* p;
int result;
@@ -275,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/src/libw32dll/DirectShow/allocator.h b/src/libw32dll/DirectShow/allocator.h
index 855637063..ef1efd737 100644
--- a/src/libw32dll/DirectShow/allocator.h
+++ b/src/libw32dll/DirectShow/allocator.h
@@ -4,14 +4,9 @@
#include "interfaces.h"
#include "cmediasample.h"
-typedef struct avm_list_t
-{
- struct avm_list_t* next;
- struct avm_list_t* prev;
- void* member;
-} avm_list_t;
-
+typedef struct _avm_list_t avm_list_t;
typedef struct _MemAllocator MemAllocator;
+
struct _MemAllocator
{
IMemAllocator_vt* vt;
@@ -27,6 +22,6 @@ struct _MemAllocator
void ( *ResetPointer )(MemAllocator* This);
};
-MemAllocator* MemAllocatorCreate();
+MemAllocator* MemAllocatorCreate(void);
#endif /* DS_ALLOCATOR_H */
diff --git a/src/libw32dll/DirectShow/cmediasample.c b/src/libw32dll/DirectShow/cmediasample.c
index 56a10c09a..0d997d103 100644
--- a/src/libw32dll/DirectShow/cmediasample.c
+++ b/src/libw32dll/DirectShow/cmediasample.c
@@ -2,9 +2,17 @@
#include "../wine/winerror.h"
#include <stdio.h>
#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] */ IID* iid,
+ /* [in] */ const GUID* iid,
/* [iid_is][out] */ void **ppv)
{
Debug printf("CMediaSample_QueryInterface(%p) called\n", This);
@@ -77,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;
}
@@ -85,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;
}
@@ -134,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;
@@ -265,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/src/libw32dll/DirectShow/guids.c b/src/libw32dll/DirectShow/guids.c
index f1ee0aaa3..73cf7f545 100644
--- a/src/libw32dll/DirectShow/guids.c
+++ b/src/libw32dll/DirectShow/guids.c
@@ -1,68 +1,79 @@
#include "guids.h"
-int DSHOW_DEBUG = 0;
-GUID CLSID_DivxDecompressorCF={0x82CCd3E0, 0xF71A, 0x11D0,
+const GUID CLSID_DivxDecompressorCF={0x82CCd3E0, 0xF71A, 0x11D0,
{ 0x9f, 0xe5, 0x00, 0x60, 0x97, 0x78, 0xaa, 0xaa}};
-GUID IID_IDivxFilterInterface={0xd132ee97, 0x3e38, 0x4030,
+const GUID IID_IDivxFilterInterface={0xd132ee97, 0x3e38, 0x4030,
{0x8b, 0x17, 0x59, 0x16, 0x3b, 0x30, 0xa1, 0xf5}};
-GUID CLSID_IV50_Decoder={0x30355649, 0x0000, 0x0010,
+const GUID CLSID_IV50_Decoder={0x30355649, 0x0000, 0x0010,
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
-GUID IID_IBaseFilter={0x56a86895, 0x0ad4, 0x11ce,
+const GUID IID_IBaseFilter={0x56a86895, 0x0ad4, 0x11ce,
{0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
-GUID IID_IEnumPins={0x56a86892, 0x0ad4, 0x11ce,
+const GUID IID_IEnumPins={0x56a86892, 0x0ad4, 0x11ce,
{0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
-GUID IID_IEnumMediaTypes={0x89c31040, 0x846b, 0x11ce,
+const GUID IID_IEnumMediaTypes={0x89c31040, 0x846b, 0x11ce,
{0x97, 0xd3, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}};
-GUID IID_IMemInputPin={0x56a8689d, 0x0ad4, 0x11ce,
+const GUID IID_IMemInputPin={0x56a8689d, 0x0ad4, 0x11ce,
{0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
-GUID IID_IMemAllocator={0x56a8689c, 0x0ad4, 0x11ce,
+const GUID IID_IMemAllocator={0x56a8689c, 0x0ad4, 0x11ce,
{0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
-GUID IID_IMediaSample={0x56a8689a, 0x0ad4, 0x11ce,
+const GUID IID_IMediaSample={0x56a8689a, 0x0ad4, 0x11ce,
{0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
-GUID MEDIATYPE_Video={0x73646976, 0x0000, 0x0010,
+const GUID MEDIATYPE_Video={0x73646976, 0x0000, 0x0010,
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
-GUID GUID_NULL={0x0, 0x0, 0x0,
+const GUID GUID_NULL={0x0, 0x0, 0x0,
{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}};
-GUID FORMAT_VideoInfo={0x05589f80, 0xc356, 0x11ce,
+const GUID FORMAT_VideoInfo={0x05589f80, 0xc356, 0x11ce,
{0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}};
-GUID MEDIASUBTYPE_RGB565={0xe436eb7b, 0x524f, 0x11ce,
+const GUID MEDIASUBTYPE_RGB1={0xe436eb78, 0x524f, 0x11ce,
{0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
-GUID MEDIASUBTYPE_RGB555={0xe436eb7c, 0x524f, 0x11ce,
+const GUID MEDIASUBTYPE_RGB4={0xe436eb79, 0x524f, 0x11ce,
{0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
-GUID MEDIASUBTYPE_RGB24={0xe436eb7d, 0x524f, 0x11ce,
+const GUID MEDIASUBTYPE_RGB8={0xe436eb7a, 0x524f, 0x11ce,
{0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
-GUID MEDIASUBTYPE_RGB32={0xe436eb7e, 0x524f, 0x11ce,
+const GUID MEDIASUBTYPE_RGB565={0xe436eb7b, 0x524f, 0x11ce,
{0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
-GUID MEDIASUBTYPE_YUYV={0x56595559, 0x0000, 0x0010,
+const GUID MEDIASUBTYPE_RGB555={0xe436eb7c, 0x524f, 0x11ce,
+ {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
+const GUID MEDIASUBTYPE_RGB24={0xe436eb7d, 0x524f, 0x11ce,
+ {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
+const GUID MEDIASUBTYPE_RGB32={0xe436eb7e, 0x524f, 0x11ce,
+ {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
+const GUID MEDIASUBTYPE_YUYV={0x56595559, 0x0000, 0x0010,
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
-GUID MEDIASUBTYPE_IYUV={0x56555949, 0x0000, 0x0010,
+const GUID MEDIASUBTYPE_IYUV={0x56555949, 0x0000, 0x0010,
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
-GUID MEDIASUBTYPE_YVU9={0x39555659, 0x0000, 0x0010,
+const GUID MEDIASUBTYPE_YVU9={0x39555659, 0x0000, 0x0010,
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
-GUID MEDIASUBTYPE_Y411={0x31313459, 0x0000, 0x0010,
+const GUID MEDIASUBTYPE_Y411={0x31313459, 0x0000, 0x0010,
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
-GUID MEDIASUBTYPE_Y41P={0x50313459, 0x0000, 0x0010,
+const GUID MEDIASUBTYPE_Y41P={0x50313459, 0x0000, 0x0010,
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
-GUID MEDIASUBTYPE_YUY2={0x32595559, 0x0000, 0x0010,
+const GUID MEDIASUBTYPE_YUY2={0x32595559, 0x0000, 0x0010,
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
-GUID MEDIASUBTYPE_YVYU={0x55595659, 0x0000, 0x0010,
+const GUID MEDIASUBTYPE_YVYU={0x55595659, 0x0000, 0x0010,
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
-GUID MEDIASUBTYPE_UYVY={0x59565955, 0x0000, 0x0010,
+const GUID MEDIASUBTYPE_UYVY={0x59565955, 0x0000, 0x0010,
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
-GUID MEDIASUBTYPE_Y211={0x31313259, 0x0000, 0x0010,
+const GUID MEDIASUBTYPE_Y211={0x31313259, 0x0000, 0x0010,
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
-GUID MEDIASUBTYPE_YV12={0x32315659, 0x0000, 0x0010,
+const GUID MEDIASUBTYPE_YV12={0x32315659, 0x0000, 0x0010,
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
-GUID MEDIASUBTYPE_I420={0x30323449, 0x0000, 0x0010,
+const GUID MEDIASUBTYPE_I420={0x30323449, 0x0000, 0x0010,
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
-GUID MEDIASUBTYPE_IF09={0x39304649, 0x0000, 0x0010,
+const GUID MEDIASUBTYPE_IF09={0x39304649, 0x0000, 0x0010,
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
-GUID CLSID_MemoryAllocator={0x1e651cc0, 0xb199, 0x11d0,
+const GUID CLSID_MemoryAllocator={0x1e651cc0, 0xb199, 0x11d0,
{0x82, 0x12, 0x00, 0xc0, 0x4f, 0xc3, 0x2c, 0x45}};
-GUID IID_DivxHidden={0x598eba01, 0xb49a, 0x11d2,
+const GUID IID_DivxHidden={0x598eba01, 0xb49a, 0x11d2,
{0xa1, 0xc1, 0x00, 0x60, 0x97, 0x78, 0xaa, 0xaa}};
-GUID IID_Iv50Hidden={0x665a4442, 0xd905, 0x11d0,
+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/src/libw32dll/DirectShow/guids.h b/src/libw32dll/DirectShow/guids.h
index b17c80662..aea96801c 100644
--- a/src/libw32dll/DirectShow/guids.h
+++ b/src/libw32dll/DirectShow/guids.h
@@ -1,13 +1,13 @@
-#ifndef GUIDS_H
-#define GUIDS_H
+#ifndef DS_GUIDS_H
+#define DS_GUIDS_H
#include "com.h"
#include "../wine/module.h"
#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
{
@@ -22,12 +22,6 @@ typedef struct __attribute__((__packed__)) _MediaType
char* pbFormat; //0x44
} AM_MEDIA_TYPE;
-typedef enum
-{
- PINDIR_INPUT = 0,
- PINDIR_OUTPUT
-} PIN_DIRECTION;
-
typedef long long REFERENCE_TIME;
typedef struct __attribute__((__packed__)) RECT32
@@ -35,8 +29,8 @@ typedef struct __attribute__((__packed__)) RECT32
int left, top, right, bottom;
} RECT32;
-typedef struct __attribute__((__packed__)) tagVIDEOINFOHEADER {
-
+typedef struct __attribute__((__packed__)) tagVIDEOINFOHEADER
+{
RECT32 rcSource; // The bit we really want to use
RECT32 rcTarget; // Where the video should go
unsigned long dwBitRate; // Approximate bit data rate
@@ -46,52 +40,46 @@ typedef struct __attribute__((__packed__)) tagVIDEOINFOHEADER {
//int reserved[3];
} VIDEOINFOHEADER;
-typedef struct _AllocatorProperties
-{
- long cBuffers;
- long cbBuffer;
- long cbAlign;
- long cbPrefix;
-} ALLOCATOR_PROPERTIES;
-
-typedef struct _IBaseFilter IBaseFilter;
-typedef struct _PinInfo
-{
- IBaseFilter* pFilter;
- PIN_DIRECTION dir;
- unsigned short achName[128];
-} PIN_INFO;
+typedef GUID CLSID;
+typedef GUID IID;
+extern const GUID IID_IBaseFilter;
+extern const GUID IID_IEnumPins;
+extern const GUID IID_IEnumMediaTypes;
+extern const GUID IID_IMemInputPin;
+extern const GUID IID_IMemAllocator;
+extern const GUID IID_IMediaSample;
+extern const GUID IID_DivxHidden;
+extern const GUID IID_Iv50Hidden;
+extern const GUID CLSID_DivxDecompressorCF;
+extern const GUID IID_IDivxFilterInterface;
+extern const GUID CLSID_IV50_Decoder;
+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;
+extern const GUID MEDIASUBTYPE_RGB32;
+extern const GUID MEDIASUBTYPE_YUYV;
+extern const GUID MEDIASUBTYPE_IYUV;
+extern const GUID MEDIASUBTYPE_YVU9;
+extern const GUID MEDIASUBTYPE_Y411;
+extern const GUID MEDIASUBTYPE_Y41P;
+extern const GUID MEDIASUBTYPE_YUY2;
+extern const GUID MEDIASUBTYPE_YVYU;
+extern const GUID MEDIASUBTYPE_UYVY;
+extern const GUID MEDIASUBTYPE_Y211;
+extern const GUID MEDIASUBTYPE_YV12;
+extern const GUID MEDIASUBTYPE_I420;
+extern const GUID MEDIASUBTYPE_IF09;
-extern GUID IID_IBaseFilter;
-extern GUID IID_IEnumPins;
-extern GUID IID_IEnumMediaTypes;
-extern GUID IID_IMemInputPin;
-extern GUID IID_IMemAllocator;
-extern GUID IID_IMediaSample;
-extern GUID IID_DivxHidden;
-extern GUID IID_Iv50Hidden;
-extern GUID CLSID_DivxDecompressorCF;
-extern GUID IID_IDivxFilterInterface;
-extern GUID CLSID_IV50_Decoder;
-extern GUID CLSID_MemoryAllocator;
-extern GUID MEDIATYPE_Video;
-extern GUID GUID_NULL;
-extern GUID FORMAT_VideoInfo;
-extern GUID MEDIASUBTYPE_RGB565;
-extern GUID MEDIASUBTYPE_RGB555;
-extern GUID MEDIASUBTYPE_RGB24;
-extern GUID MEDIASUBTYPE_RGB32;
-extern GUID MEDIASUBTYPE_YUYV;
-extern GUID MEDIASUBTYPE_IYUV;
-extern GUID MEDIASUBTYPE_YVU9;
-extern GUID MEDIASUBTYPE_Y411;
-extern GUID MEDIASUBTYPE_Y41P;
-extern GUID MEDIASUBTYPE_YUY2;
-extern GUID MEDIASUBTYPE_YVYU;
-extern GUID MEDIASUBTYPE_UYVY;
-extern GUID MEDIASUBTYPE_Y211;
-extern GUID MEDIASUBTYPE_YV12;
-extern GUID MEDIASUBTYPE_I420;
+extern const GUID FORMAT_WaveFormatEx;
+extern const GUID MEDIATYPE_Audio;
+extern const GUID MEDIASUBTYPE_PCM;
-#endif
+#endif /* DS_GUIDS_H */
diff --git a/src/libw32dll/DirectShow/inputpin.h b/src/libw32dll/DirectShow/inputpin.h
index 1ad9a2d60..a8ccdcccf 100644
--- a/src/libw32dll/DirectShow/inputpin.h
+++ b/src/libw32dll/DirectShow/inputpin.h
@@ -14,7 +14,7 @@ struct _CBaseFilter2
IPin* ( *GetPin )(CBaseFilter2* This);
};
-CBaseFilter2* CBaseFilter2Create();
+CBaseFilter2* CBaseFilter2Create(void);
typedef struct _CBaseFilter CBaseFilter;
@@ -33,20 +33,19 @@ struct _CBaseFilter
CBaseFilter* CBaseFilterCreate(const AM_MEDIA_TYPE* vhdr, CBaseFilter2* parent);
-typedef struct _CInputPin CInputPin;
-struct _CInputPin
+typedef struct
{
IPin_vt* vt;
DECLARE_IUNKNOWN();
CBaseFilter* parent;
AM_MEDIA_TYPE type;
GUID interfaces[1];
-};
+} CInputPin;
CInputPin* CInputPinCreate(CBaseFilter* parent, const AM_MEDIA_TYPE* vhdr);
-typedef struct CRemotePin
+typedef struct
{
IPin_vt* vt;
DECLARE_IUNKNOWN();
@@ -58,7 +57,7 @@ typedef struct CRemotePin
CRemotePin* CRemotePinCreate(CBaseFilter* pt, IPin* rpin);
-typedef struct CRemotePin2
+typedef struct
{
IPin_vt* vt;
DECLARE_IUNKNOWN();
diff --git a/src/libw32dll/DirectShow/interfaces.h b/src/libw32dll/DirectShow/interfaces.h
index 23b02a509..92a7718cd 100644
--- a/src/libw32dll/DirectShow/interfaces.h
+++ b/src/libw32dll/DirectShow/interfaces.h
@@ -2,26 +2,41 @@
#define DS_INTERFACES_H
/*
-
-Definition of important DirectShow interfaces.
-Created using freely-available DirectX 8.0 SDK
-( http://msdn.microsoft.com )
-
-*/
+ * Definition of important DirectShow interfaces.
+ * Created using freely-available DirectX 8.0 SDK
+ * ( http://msdn.microsoft.com )
+ */
#include "iunk.h"
#include "com.h"
-//typedef GUID& REFIID;
-typedef GUID CLSID;
-typedef GUID IID;
-
/* Sh*t. MSVC++ and g++ use different methods of storing vtables. */
typedef struct _IReferenceClock IReferenceClock;
typedef struct _IFilterGraph IFilterGraph;
-enum PIN_DIRECTION;
+typedef struct _IBaseFilter IBaseFilter;
+
+typedef enum
+{
+ PINDIR_INPUT = 0,
+ PINDIR_OUTPUT
+} PIN_DIRECTION;
+
+typedef struct _PinInfo
+{
+ IBaseFilter* pFilter;
+ PIN_DIRECTION dir;
+ unsigned short achName[128];
+} PIN_INFO;
+
+typedef struct _AllocatorProperties
+{
+ long cBuffers;
+ long cbBuffer;
+ long cbAlign;
+ long cbPrefix;
+} ALLOCATOR_PROPERTIES;
typedef struct _IEnumMediaTypes IEnumMediaTypes;
typedef struct IEnumMediaTypes_vt
diff --git a/src/libw32dll/DirectShow/iunk.h b/src/libw32dll/DirectShow/iunk.h
index 6dbf00ffa..7998011cd 100644
--- a/src/libw32dll/DirectShow/iunk.h
+++ b/src/libw32dll/DirectShow/iunk.h
@@ -2,10 +2,9 @@
#define DS_IUNK_H
#include "guids.h"
-#include <stdlib.h>
#define INHERIT_IUNKNOWN() \
- long STDCALL ( *QueryInterface )(IUnknown * This, GUID* riid, void **ppvObject); \
+ long STDCALL ( *QueryInterface )(IUnknown * This, const GUID* riid, void **ppvObject); \
long STDCALL ( *AddRef )(IUnknown * This); \
long STDCALL ( *Release )(IUnknown * This);
@@ -14,12 +13,12 @@
#define IMPLEMENT_IUNKNOWN(CLASSNAME) \
static long STDCALL CLASSNAME ## _QueryInterface(IUnknown * This, \
- GUID* riid, void **ppvObject) \
+ const GUID* riid, void **ppvObject) \
{ \
CLASSNAME * me = (CLASSNAME *)This; \
- GUID* r; unsigned int i = 0; \
+ const 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))) \
{ \
@@ -27,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", *(const unsigned int*)riid); \
return E_NOINTERFACE; \
} \
\
diff --git a/src/libw32dll/DirectShow/outputpin.c b/src/libw32dll/DirectShow/outputpin.c
index 8ca12d792..e6317a985 100644
--- a/src/libw32dll/DirectShow/outputpin.c
+++ b/src/libw32dll/DirectShow/outputpin.c
@@ -4,6 +4,7 @@
#include "outputpin.h"
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
/*
An object beyond interface IEnumMediaTypes.
@@ -24,6 +25,15 @@ typedef struct CEnumMediaTypes
GUID interfaces[2];
} CEnumMediaTypes;
+struct _COutputMemPin
+{
+ IMemInputPin_vt* vt;
+ DECLARE_IUNKNOWN();
+ char** frame_pointer;
+ long* frame_size_pointer;
+ MemAllocator* pAllocator;
+ COutputPin* parent;
+};
static HRESULT STDCALL CEnumMediaTypes_Next(IEnumMediaTypes * This,
/* [in] */ ULONG cMediaTypes,
@@ -74,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);
@@ -83,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)) ;
@@ -120,7 +130,7 @@ CEnumMediaTypes* CEnumMediaTypesCreate(const AM_MEDIA_TYPE* amt)
*************/
-static HRESULT STDCALL COutputPin_QueryInterface(IUnknown* This, GUID* iid, void** ppv)
+static HRESULT STDCALL COutputPin_QueryInterface(IUnknown* This, const GUID* iid, void** ppv)
{
COutputPin* p = (COutputPin*) This;
@@ -284,7 +294,7 @@ static HRESULT STDCALL COutputPin_NewSegment(IPin * This,
// IMemInputPin->IUnknown methods
-static HRESULT STDCALL COutputPin_M_QueryInterface(IUnknown* This, GUID* iid, void** ppv)
+static HRESULT STDCALL COutputPin_M_QueryInterface(IUnknown* This, const GUID* iid, void** ppv)
{
COutputPin* p = (COutputPin*)This;
diff --git a/src/libw32dll/DirectShow/outputpin.h b/src/libw32dll/DirectShow/outputpin.h
index 016b36787..1e802f6e0 100644
--- a/src/libw32dll/DirectShow/outputpin.h
+++ b/src/libw32dll/DirectShow/outputpin.h
@@ -5,18 +5,8 @@
#include "allocator.h"
-typedef struct _COutputPin COutputPin;
-
typedef struct _COutputMemPin COutputMemPin;
-struct _COutputMemPin
-{
- IMemInputPin_vt* vt;
- DECLARE_IUNKNOWN();
- char** frame_pointer;
- long* frame_size_pointer;
- MemAllocator* pAllocator;
- COutputPin* parent;
-};
+typedef struct _COutputPin COutputPin;
struct _COutputPin
{