ReactOS 0.4.15-dev-8102-g108db8f
dsoundrender.c File Reference
#include "wine/test.h"
#include "dshow.h"
#include "initguid.h"
#include "dsound.h"
#include "amaudio.h"
Include dependency graph for dsoundrender.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 
#define QI_SUCCEED(iface, riid, ppv)
 
#define RELEASE_EXPECT(iface, num)
 

Functions

static BOOL create_dsound_renderer (void)
 
static void release_dsound_renderer (void)
 
static HRESULT WINAPI PB_QueryInterface (IPropertyBag *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI PB_AddRef (IPropertyBag *iface)
 
static ULONG WINAPI PB_Release (IPropertyBag *iface)
 
static HRESULT WINAPI PB_Read (IPropertyBag *iface, LPCOLESTR name, VARIANT *var, IErrorLog *log)
 
static HRESULT WINAPI PB_Write (IPropertyBag *iface, LPCOLESTR name, VARIANT *var)
 
static void test_query_interface (void)
 
static void test_pin (IPin *pin)
 
static void test_basefilter (void)
 
 START_TEST (dsoundrender)
 

Variables

static IUnknownpDSRender = NULL
 
static IPropertyBagVtbl PB_Vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file dsoundrender.c.

◆ QI_SUCCEED

#define QI_SUCCEED (   iface,
  riid,
  ppv 
)
Value:
hr = IUnknown_QueryInterface(iface, &riid, (LPVOID*)&ppv); \
ok(hr == S_OK, "IUnknown_QueryInterface returned %x\n", hr); \
ok(ppv != NULL, "Pointer is NULL\n");
#define NULL
Definition: types.h:112
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
HRESULT hr
Definition: shlfolder.c:183

Definition at line 30 of file dsoundrender.c.

◆ RELEASE_EXPECT

#define RELEASE_EXPECT (   iface,
  num 
)
Value:
if (iface) { \
hr = IUnknown_Release((IUnknown*)iface); \
ok(hr == num, "IUnknown_Release should return %d, got %d\n", num, hr); \
}
GLuint GLuint num
Definition: glext.h:9618

Definition at line 34 of file dsoundrender.c.

Function Documentation

◆ create_dsound_renderer()

static BOOL create_dsound_renderer ( void  )
static

Definition at line 41 of file dsoundrender.c.

42{
43 HRESULT hr;
44
45 hr = CoCreateInstance(&CLSID_DSoundRender, NULL, CLSCTX_INPROC_SERVER,
47 return (hr == S_OK && pDSRender != NULL);
48}
const GUID IID_IUnknown
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
static IUnknown * pDSRender
Definition: dsoundrender.c:39

Referenced by START_TEST().

◆ PB_AddRef()

static ULONG WINAPI PB_AddRef ( IPropertyBag iface)
static

Definition at line 65 of file dsoundrender.c.

66{
67 ok(0, "Should not be called\n");
68 return 2;
69}
#define ok(value,...)
Definition: atltest.h:57

◆ PB_QueryInterface()

static HRESULT WINAPI PB_QueryInterface ( IPropertyBag iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 58 of file dsoundrender.c.

59{
60 ok(0, "Should not be called\n");
61 *ppv = NULL;
62 return E_NOINTERFACE;
63}
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ PB_Read()

static HRESULT WINAPI PB_Read ( IPropertyBag iface,
LPCOLESTR  name,
VARIANT var,
IErrorLog log 
)
static

Definition at line 77 of file dsoundrender.c.

78{
79 static const WCHAR dsguid[] = { 'D','S','G','u','i','d', 0 };
80 char temp[50];
81 WideCharToMultiByte(CP_ACP, 0, name, -1, temp, sizeof(temp)-1, NULL, NULL);
82 temp[sizeof(temp)-1] = 0;
83 trace("Trying to read %s, type %u\n", temp, var->n1.n2.vt);
84 if (!lstrcmpW(name, dsguid))
85 {
86 static const WCHAR defaultplayback[] =
87 {
88 '{','D','E','F','0','0','0','0','0','-',
89 '9','C','6','D','-','4','7','E','D','-',
90 'A','A','F','1','-','4','D','D','A','8',
91 'F','2','B','5','C','0','3','}',0
92 };
93 ok(var->n1.n2.vt == VT_BSTR, "Wrong type asked: %u\n", var->n1.n2.vt);
94 var->n1.n2.n3.bstrVal = SysAllocString(defaultplayback);
95 return S_OK;
96 }
97 ok(0, "Unknown property '%s' queried\n", temp);
98 return E_FAIL;
99}
#define trace
Definition: atltest.h:70
#define E_FAIL
Definition: ddrawi.h:102
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
@ VT_BSTR
Definition: compat.h:2303
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4242
const char * var
Definition: shader.c:5666
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
static calc_node_t temp
Definition: rpn_ieee.c:38
Definition: name.c:39
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ PB_Release()

static ULONG WINAPI PB_Release ( IPropertyBag iface)
static

Definition at line 71 of file dsoundrender.c.

72{
73 ok(0, "Should not be called\n");
74 return 1;
75}

◆ PB_Write()

static HRESULT WINAPI PB_Write ( IPropertyBag iface,
LPCOLESTR  name,
VARIANT var 
)
static

Definition at line 101 of file dsoundrender.c.

102{
103 ok(0, "Should not be called\n");
104 return E_FAIL;
105}

◆ release_dsound_renderer()

static void release_dsound_renderer ( void  )
static

Definition at line 50 of file dsoundrender.c.

51{
52 HRESULT hr;
53
54 hr = IUnknown_Release(pDSRender);
55 ok(hr == 0, "IUnknown_Release failed with %x\n", hr);
56}

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( dsoundrender  )

Definition at line 221 of file dsoundrender.c.

222{
225 return;
226
229
231
233}
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
static BOOL create_dsound_renderer(void)
Definition: dsoundrender.c:41
static void release_dsound_renderer(void)
Definition: dsoundrender.c:50
static void test_query_interface(void)
Definition: dsoundrender.c:116
static void test_basefilter(void)
Definition: dsoundrender.c:173

◆ test_basefilter()

static void test_basefilter ( void  )
static

Definition at line 173 of file dsoundrender.c.

174{
175 IEnumPins *pin_enum = NULL;
177 IPin *pins[2];
178 ULONG ref;
179 HRESULT hr;
180
181 IUnknown_QueryInterface(pDSRender, &IID_IBaseFilter, (void **)&base);
182 if (base == NULL)
183 {
184 /* test_query_interface handles this case */
185 skip("No IBaseFilter\n");
186 return;
187 }
188
189 hr = IBaseFilter_EnumPins(base, NULL);
190 ok(hr == E_POINTER, "hr = %08x and not E_POINTER\n", hr);
191
192 hr= IBaseFilter_EnumPins(base, &pin_enum);
193 ok(hr == S_OK, "hr = %08x and not S_OK\n", hr);
194
195 hr = IEnumPins_Next(pin_enum, 1, NULL, NULL);
196 ok(hr == E_POINTER, "hr = %08x and not E_POINTER\n", hr);
197
198 hr = IEnumPins_Next(pin_enum, 2, pins, NULL);
199 ok(hr == E_INVALIDARG, "hr = %08x and not E_INVALIDARG\n", hr);
200
201 pins[0] = (void *)0xdead;
202 pins[1] = (void *)0xdeed;
203
204 hr = IEnumPins_Next(pin_enum, 2, pins, &ref);
205 ok(hr == S_FALSE, "hr = %08x instead of S_FALSE\n", hr);
206 ok(pins[0] != (void *)0xdead && pins[0] != NULL, "pins[0] = %p\n", pins[0]);
207 if (pins[0] != (void *)0xdead && pins[0] != NULL)
208 {
209 test_pin(pins[0]);
210 IPin_Release(pins[0]);
211 }
212
213 ok(pins[1] == (void *)0xdeed, "pins[1] = %p\n", pins[1]);
214
215 ref = IEnumPins_Release(pin_enum);
216 ok(ref == 0, "ref is %u and not 0!\n", ref);
217
218 IBaseFilter_Release(base);
219}
#define skip(...)
Definition: atltest.h:64
#define E_INVALIDARG
Definition: ddrawi.h:101
const GUID IID_IBaseFilter
Definition: axcore.idl:92
static void test_pin(IPin *pin)
Definition: dsoundrender.c:157
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59
#define S_FALSE
Definition: winerror.h:2357
#define E_POINTER
Definition: winerror.h:2365

Referenced by START_TEST().

◆ test_pin()

static void test_pin ( IPin pin)
static

Definition at line 157 of file dsoundrender.c.

158{
159 IMemInputPin *mpin = NULL;
160
161 IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&mpin);
162
163 ok(mpin != NULL, "No IMemInputPin found!\n");
164 if (mpin)
165 {
166 ok(IMemInputPin_ReceiveCanBlock(mpin) == S_OK, "Receive can't block for pin!\n");
167 ok(IMemInputPin_NotifyAllocator(mpin, NULL, 0) == E_POINTER, "NotifyAllocator likes a NULL pointer argument\n");
168 IMemInputPin_Release(mpin);
169 }
170 /* TODO */
171}
Definition: regsvr.c:104

Referenced by test_basefilter().

◆ test_query_interface()

static void test_query_interface ( void  )
static

Definition at line 116 of file dsoundrender.c.

117{
118 HRESULT hr;
119 IBaseFilter *pBaseFilter = NULL;
120 IBasicAudio *pBasicAudio = NULL;
121 IMediaPosition *pMediaPosition = NULL;
122 IMediaSeeking *pMediaSeeking = NULL;
123 IQualityControl *pQualityControl = NULL;
125 IDirectSound3DBuffer *ds3dbuf = NULL;
127 IAMDirectSound *pAMDirectSound = NULL;
128
129 QI_SUCCEED(pDSRender, IID_IBaseFilter, pBaseFilter);
130 RELEASE_EXPECT(pBaseFilter, 1);
131 QI_SUCCEED(pDSRender, IID_IBasicAudio, pBasicAudio);
132 RELEASE_EXPECT(pBasicAudio, 1);
133 QI_SUCCEED(pDSRender, IID_IMediaSeeking, pMediaSeeking);
134 RELEASE_EXPECT(pMediaSeeking, 1);
135 QI_SUCCEED(pDSRender, IID_IReferenceClock, clock);
137 QI_SUCCEED(pDSRender, IID_IAMDirectSound, pAMDirectSound);
138 RELEASE_EXPECT( pAMDirectSound, 1);
139 todo_wine {
140 QI_SUCCEED(pDSRender, IID_IDirectSound3DBuffer, ds3dbuf);
141 RELEASE_EXPECT(ds3dbuf, 1);
143 if (ppb)
144 {
145 IPropertyBag bag = { &PB_Vtbl };
146 hr = IPersistPropertyBag_Load(ppb, &bag, NULL);
147 ok(hr == S_OK, "Couldn't load default device: %08x\n", hr);
148 }
149 RELEASE_EXPECT(ppb, 1);
150 }
151 QI_SUCCEED(pDSRender, IID_IMediaPosition, pMediaPosition);
152 RELEASE_EXPECT(pMediaPosition, 1);
153 QI_SUCCEED(pDSRender, IID_IQualityControl, pQualityControl);
154 RELEASE_EXPECT(pQualityControl, 1);
155}
#define todo_wine
Definition: custom.c:79
#define RELEASE_EXPECT(iface, num)
Definition: dsoundrender.c:34
static IPropertyBagVtbl PB_Vtbl
Definition: dsoundrender.c:107
#define QI_SUCCEED(iface, riid, ppv)
Definition: dsoundrender.c:30
const GUID IID_IPersistPropertyBag
Definition: proxy.cpp:11
_Check_return_ _CRTIMP clock_t __cdecl clock(void)
Definition: clock.c:23

Referenced by START_TEST().

Variable Documentation

◆ PB_Vtbl

IPropertyBagVtbl PB_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI PB_Write(IPropertyBag *iface, LPCOLESTR name, VARIANT *var)
Definition: dsoundrender.c:101
static ULONG WINAPI PB_AddRef(IPropertyBag *iface)
Definition: dsoundrender.c:65
static HRESULT WINAPI PB_Read(IPropertyBag *iface, LPCOLESTR name, VARIANT *var, IErrorLog *log)
Definition: dsoundrender.c:77
static HRESULT WINAPI PB_QueryInterface(IPropertyBag *iface, REFIID riid, void **ppv)
Definition: dsoundrender.c:58
static ULONG WINAPI PB_Release(IPropertyBag *iface)
Definition: dsoundrender.c:71

Definition at line 107 of file dsoundrender.c.

Referenced by test_query_interface().

◆ pDSRender

IUnknown* pDSRender = NULL
static