ReactOS 0.4.17-dev-966-gf06eace
waveparser.c File Reference
#include "dshow.h"
#include "mmreg.h"
#include "wine/test.h"
Include dependency graph for waveparser.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 
#define check_interface(a, b, c)   check_interface_(__LINE__, a, b, c)
 

Functions

static IBaseFilter * create_wave_parser (void)
 
static WCHAR * load_resource (const WCHAR *name)
 
static ULONG get_refcount (void *iface)
 
static IFilterGraph2 * connect_input (IBaseFilter *splitter, const WCHAR *filename)
 
static void check_interface_ (unsigned int line, void *iface_ptr, REFIID iid, BOOL supported)
 
static void test_interfaces (void)
 
static HRESULT WINAPI outer_QueryInterface (IUnknown *iface, REFIID iid, void **out)
 
static ULONG WINAPI outer_AddRef (IUnknown *iface)
 
static ULONG WINAPI outer_Release (IUnknown *iface)
 
static void test_aggregation (void)
 
static void test_enum_pins (void)
 
static void test_find_pin (void)
 
static void test_pin_info (void)
 
static void test_media_types (void)
 
static void test_enum_media_types (void)
 
static void test_unconnected_filter_state (void)
 
static void test_seeking (void)
 
 START_TEST (waveparser)
 

Variables

static const GUID testguid = {0xfacade}
 
static const GUID test_iid = {0x33333333}
 
static LONG outer_ref = 1
 
static const IUnknownVtbl outer_vtbl
 
static IUnknown test_outer = {&outer_vtbl}
 

Macro Definition Documentation

◆ check_interface

#define check_interface (   a,
  b,
  c 
)    check_interface_(__LINE__, a, b, c)

Definition at line 100 of file waveparser.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file waveparser.c.

Function Documentation

◆ check_interface_()

static void check_interface_ ( unsigned int  line,
void *  iface_ptr,
REFIID  iid,
BOOL  supported 
)
static

Definition at line 101 of file waveparser.c.

102{
103 IUnknown *iface = iface_ptr;
105 IUnknown *unk;
106
107 expected_hr = supported ? S_OK : E_NOINTERFACE;
108
109 hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
110 ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
111 if (SUCCEEDED(hr))
112 IUnknown_Release(unk);
113}
#define ok_(x1, x2)
Definition: atltest.h:61
HRESULT expected_hr
HRESULT hr
Definition: delayimp.cpp:582
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
Definition: parser.c:49
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ connect_input()

static IFilterGraph2 * connect_input ( IBaseFilter *  splitter,
const WCHAR *  filename 
)
static

Definition at line 69 of file waveparser.c.

70{
71 IFileSourceFilter *filesource;
74 IPin *source, *sink;
75 HRESULT hr;
76
77 CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER,
78 &IID_IBaseFilter, (void **)&reader);
79 IBaseFilter_QueryInterface(reader, &IID_IFileSourceFilter, (void **)&filesource);
80 IFileSourceFilter_Load(filesource, filename, NULL);
81
82 CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
83 &IID_IFilterGraph2, (void **)&graph);
84 IFilterGraph2_AddFilter(graph, reader, NULL);
85 IFilterGraph2_AddFilter(graph, splitter, NULL);
86
87 IBaseFilter_FindPin(splitter, L"input pin", &sink);
88 IBaseFilter_FindPin(reader, L"Output", &source);
89
90 hr = IFilterGraph2_ConnectDirect(graph, source, sink, NULL);
91 ok(hr == S_OK, "Got hr %#lx.\n", hr);
92
93 IPin_Release(source);
94 IPin_Release(sink);
95 IBaseFilter_Release(reader);
96 IFileSourceFilter_Release(filesource);
97 return graph;
98}
#define ok(value,...)
Definition: atltest.h:57
const GUID IID_IBaseFilter
#define NULL
Definition: types.h:112
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
#define L(x)
Definition: resources.c:13
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
Definition: axcore.idl:92
const char * filename
Definition: ioapi.h:137
Definition: graph.c:32
Definition: reader.h:84

Referenced by test_enum_media_types(), test_enum_pins(), test_find_pin(), test_interfaces(), test_media_types(), test_pin_info(), and test_seeking().

◆ create_wave_parser()

static IBaseFilter * create_wave_parser ( void  )
static

Definition at line 28 of file waveparser.c.

29{
31 HRESULT hr = CoCreateInstance(&CLSID_WAVEParser, NULL, CLSCTX_INPROC_SERVER,
32 &IID_IBaseFilter, (void **)&filter);
33 ok(hr == S_OK, "Got hr %#lx.\n", hr);
34 return filter;
35}
Definition: filter.c:165

Referenced by test_enum_media_types(), test_enum_pins(), test_find_pin(), test_interfaces(), test_media_types(), test_pin_info(), test_seeking(), and test_unconnected_filter_state().

◆ get_refcount()

static ULONG get_refcount ( void *  iface)
static

Definition at line 62 of file waveparser.c.

63{
64 IUnknown *unknown = iface;
65 IUnknown_AddRef(unknown);
66 return IUnknown_Release(unknown);
67}
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1674

Referenced by test_aggregation(), test_enum_pins(), and test_pin_info().

◆ load_resource()

static WCHAR * load_resource ( const WCHAR *  name)
static

Definition at line 37 of file waveparser.c.

38{
39 static WCHAR pathW[MAX_PATH];
40 DWORD written;
42 HRSRC res;
43 void *ptr;
44
47
49 ok(file != INVALID_HANDLE_VALUE, "Failed to create file %s, error %lu.\n",
51
53 ok(!!res, "Failed to load resource, error %lu.\n", GetLastError());
56 ok(written == SizeofResource(GetModuleHandleA(NULL), res), "Failed to write resource.\n");
58
59 return pathW;
60}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
BOOL WINAPI WriteFile(_In_ HANDLE hFile, _In_reads_bytes_opt_(nNumberOfBytesToWrite) LPCVOID lpBuffer, _In_ DWORD nNumberOfBytesToWrite, _Out_opt_ LPDWORD lpNumberOfBytesWritten, _Inout_opt_ LPOVERLAPPED lpOverlapped)
Definition: rw.c:25
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2098
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint res
Definition: glext.h:9613
#define wine_dbgstr_w
Definition: kernel32.h:34
#define CREATE_ALWAYS
Definition: disk.h:72
static PVOID ptr
Definition: dispmode.c:27
static const WCHAR pathW[]
Definition: path.c:2368
#define GENERIC_WRITE
Definition: nt_native.h:90
short WCHAR
Definition: pedump.c:58
#define RT_RCDATA
Definition: pedump.c:372
wcscat
Definition: fci.c:123
Definition: name.c:39
const uint16_t * LPCWSTR
Definition: typedefs.h:57
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

◆ outer_AddRef()

static ULONG WINAPI outer_AddRef ( IUnknown *  iface)
static

Definition at line 186 of file waveparser.c.

187{
189}
#define InterlockedIncrement
Definition: armddk.h:53
static LONG outer_ref
Definition: waveparser.c:171

◆ outer_QueryInterface()

static HRESULT WINAPI outer_QueryInterface ( IUnknown *  iface,
REFIID  iid,
void **  out 
)
static

Definition at line 173 of file waveparser.c.

174{
175 if (IsEqualGUID(iid, &IID_IUnknown)
177 || IsEqualGUID(iid, &test_iid))
178 {
179 *out = (IUnknown *)0xdeadbeef;
180 return S_OK;
181 }
182 ok(0, "unexpected call %s\n", wine_dbgstr_guid(iid));
183 return E_NOINTERFACE;
184}
const GUID IID_IUnknown
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:181
static const GUID test_iid
Definition: waveparser.c:170
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383

◆ outer_Release()

static ULONG WINAPI outer_Release ( IUnknown *  iface)
static

Definition at line 191 of file waveparser.c.

192{
194}
#define InterlockedDecrement
Definition: armddk.h:52

◆ START_TEST()

START_TEST ( waveparser  )

Definition at line 1037 of file waveparser.c.

1038{
1040
1042
1043 if (FAILED(CoCreateInstance(&CLSID_WAVEParser, NULL, CLSCTX_INPROC_SERVER,
1044 &IID_IBaseFilter, (void **)&filter)))
1045 {
1046 skip("Failed to create WAVE parser.\n");
1047 return;
1048 }
1049 IBaseFilter_Release(filter);
1050
1054 test_find_pin();
1055 test_pin_info();
1059 test_seeking();
1060
1062}
#define skip(...)
Definition: atltest.h:64
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:531
#define FAILED(hr)
Definition: intsafe.h:51
static void test_aggregation(void)
Definition: waveparser.c:205
static void test_pin_info(void)
Definition: waveparser.c:447
static void test_find_pin(void)
Definition: waveparser.c:398
static void test_enum_media_types(void)
Definition: waveparser.c:655
static void test_interfaces(void)
Definition: waveparser.c:115
static void test_media_types(void)
Definition: waveparser.c:521
static void test_enum_pins(void)
Definition: waveparser.c:264
static void test_seeking(void)
Definition: waveparser.c:830
static void test_unconnected_filter_state(void)
Definition: waveparser.c:773

◆ test_aggregation()

static void test_aggregation ( void  )
static

Definition at line 205 of file waveparser.c.

206{
207 IBaseFilter *filter, *filter2;
208 IUnknown *unk, *unk2;
209 HRESULT hr;
210 ULONG ref;
211
212 filter = (IBaseFilter *)0xdeadbeef;
213 hr = CoCreateInstance(&CLSID_WAVEParser, &test_outer, CLSCTX_INPROC_SERVER,
214 &IID_IBaseFilter, (void **)&filter);
215 ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
216 ok(!filter, "Got interface %p.\n", filter);
217
218 hr = CoCreateInstance(&CLSID_WAVEParser, &test_outer, CLSCTX_INPROC_SERVER,
219 &IID_IUnknown, (void **)&unk);
220 ok(hr == S_OK, "Got hr %#lx.\n", hr);
221 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
222 ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
223 ref = get_refcount(unk);
224 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
225
226 ref = IUnknown_AddRef(unk);
227 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
228 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
229
230 ref = IUnknown_Release(unk);
231 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
232 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
233
234 hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2);
235 ok(hr == S_OK, "Got hr %#lx.\n", hr);
236 ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2);
237 IUnknown_Release(unk2);
238
239 hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void **)&filter);
240 ok(hr == S_OK, "Got hr %#lx.\n", hr);
241
242 hr = IBaseFilter_QueryInterface(filter, &IID_IUnknown, (void **)&unk2);
243 ok(hr == S_OK, "Got hr %#lx.\n", hr);
244 ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
245
246 hr = IBaseFilter_QueryInterface(filter, &IID_IBaseFilter, (void **)&filter2);
247 ok(hr == S_OK, "Got hr %#lx.\n", hr);
248 ok(filter2 == (IBaseFilter *)0xdeadbeef, "Got unexpected IBaseFilter %p.\n", filter2);
249
250 hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2);
251 ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
252 ok(!unk2, "Got unexpected IUnknown %p.\n", unk2);
253
254 hr = IBaseFilter_QueryInterface(filter, &test_iid, (void **)&unk2);
255 ok(hr == S_OK, "Got hr %#lx.\n", hr);
256 ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
257
258 IBaseFilter_Release(filter);
259 ref = IUnknown_Release(unk);
260 ok(!ref, "Got unexpected refcount %ld.\n", ref);
261 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
262}
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59
static ULONG get_refcount(void *iface)
Definition: waveparser.c:62
static IUnknown test_outer
Definition: waveparser.c:203

Referenced by START_TEST().

◆ test_enum_media_types()

static void test_enum_media_types ( void  )
static

Definition at line 655 of file waveparser.c.

656{
657 const WCHAR *filename = load_resource(L"test.wav");
660 IEnumMediaTypes *enum1, *enum2;
661 AM_MEDIA_TYPE *mts[2];
662 ULONG ref, count;
663 HRESULT hr;
664 IPin *pin;
665 BOOL ret;
666
667 IBaseFilter_FindPin(filter, L"input pin", &pin);
668
669 hr = IPin_EnumMediaTypes(pin, &enum1);
670 ok(hr == S_OK, "Got hr %#lx.\n", hr);
671
672 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
673 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
674
675 hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
676 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
677 ok(!count, "Got count %lu.\n", count);
678
679 hr = IEnumMediaTypes_Reset(enum1);
680 ok(hr == S_OK, "Got hr %#lx.\n", hr);
681
682 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
683 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
684
685 hr = IEnumMediaTypes_Clone(enum1, &enum2);
686 ok(hr == S_OK, "Got hr %#lx.\n", hr);
687
688 hr = IEnumMediaTypes_Skip(enum1, 1);
689 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
690
691 hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
692 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
693
694 IEnumMediaTypes_Release(enum1);
695 IEnumMediaTypes_Release(enum2);
696 IPin_Release(pin);
697
698 IBaseFilter_FindPin(filter, L"output", &pin);
699
700 hr = IPin_EnumMediaTypes(pin, &enum1);
701 ok(hr == S_OK, "Got hr %#lx.\n", hr);
702
703 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
704 ok(hr == S_OK, "Got hr %#lx.\n", hr);
705 CoTaskMemFree(mts[0]->pbFormat);
706 CoTaskMemFree(mts[0]);
707
708 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
709 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
710
711 hr = IEnumMediaTypes_Reset(enum1);
712 ok(hr == S_OK, "Got hr %#lx.\n", hr);
713
714 hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
715 ok(hr == S_OK, "Got hr %#lx.\n", hr);
716 ok(count == 1, "Got count %lu.\n", count);
717 CoTaskMemFree(mts[0]->pbFormat);
718 CoTaskMemFree(mts[0]);
719
720 hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
721 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
722 ok(!count, "Got count %lu.\n", count);
723
724 hr = IEnumMediaTypes_Reset(enum1);
725 ok(hr == S_OK, "Got hr %#lx.\n", hr);
726
727 hr = IEnumMediaTypes_Next(enum1, 2, mts, &count);
728 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
729 ok(count == 1, "Got count %lu.\n", count);
730 CoTaskMemFree(mts[0]->pbFormat);
731 CoTaskMemFree(mts[0]);
732
733 hr = IEnumMediaTypes_Reset(enum1);
734 ok(hr == S_OK, "Got hr %#lx.\n", hr);
735
736 hr = IEnumMediaTypes_Clone(enum1, &enum2);
737 ok(hr == S_OK, "Got hr %#lx.\n", hr);
738
739 hr = IEnumMediaTypes_Skip(enum1, 2);
740 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
741
742 hr = IEnumMediaTypes_Skip(enum1, 1);
743 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
744
745 hr = IEnumMediaTypes_Reset(enum1);
746 ok(hr == S_OK, "Got hr %#lx.\n", hr);
747
748 hr = IEnumMediaTypes_Skip(enum1, 1);
749 ok(hr == S_OK, "Got hr %#lx.\n", hr);
750
751 hr = IEnumMediaTypes_Skip(enum1, 1);
752 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
753
754 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
755 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
756
757 hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
758 ok(hr == S_OK, "Got hr %#lx.\n", hr);
759 CoTaskMemFree(mts[0]->pbFormat);
760 CoTaskMemFree(mts[0]);
761
762 IEnumMediaTypes_Release(enum1);
763 IEnumMediaTypes_Release(enum2);
764 IPin_Release(pin);
765
766 IFilterGraph2_Release(graph);
767 ref = IBaseFilter_Release(filter);
768 ok(!ref, "Got outstanding refcount %ld.\n", ref);
770 ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
771}
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
return ret
Definition: mutex.c:147
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define load_resource(a, b, c)
Definition: font.c:46
static IFilterGraph2 * connect_input(IBaseFilter *splitter, const WCHAR *filename)
Definition: waveparser.c:69
static IBaseFilter * create_wave_parser(void)
Definition: waveparser.c:28
#define S_FALSE
Definition: winerror.h:3451

Referenced by START_TEST().

◆ test_enum_pins()

static void test_enum_pins ( void  )
static

Definition at line 264 of file waveparser.c.

265{
266 const WCHAR *filename = load_resource(L"test.wav");
268 IEnumPins *enum1, *enum2;
270 ULONG count, ref;
271 IPin *pins[3];
272 HRESULT hr;
273 BOOL ret;
274
276 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
277
278 hr = IBaseFilter_EnumPins(filter, NULL);
279 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
280
281 hr = IBaseFilter_EnumPins(filter, &enum1);
282 ok(hr == S_OK, "Got hr %#lx.\n", hr);
284 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
285 ref = get_refcount(enum1);
286 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
287
288 hr = IEnumPins_Next(enum1, 1, NULL, NULL);
289 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
290
291 hr = IEnumPins_Next(enum1, 1, pins, NULL);
292 ok(hr == S_OK, "Got hr %#lx.\n", hr);
294 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
295 ref = get_refcount(pins[0]);
296 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
297 ref = get_refcount(enum1);
298 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
299 IPin_Release(pins[0]);
301 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
302
303 hr = IEnumPins_Next(enum1, 1, pins, NULL);
304 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
305
306 hr = IEnumPins_Reset(enum1);
307 ok(hr == S_OK, "Got hr %#lx.\n", hr);
308
309 hr = IEnumPins_Next(enum1, 1, pins, &count);
310 ok(hr == S_OK, "Got hr %#lx.\n", hr);
311 ok(count == 1, "Got count %lu.\n", count);
312 IPin_Release(pins[0]);
313
314 hr = IEnumPins_Next(enum1, 1, pins, &count);
315 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
316 ok(!count, "Got count %lu.\n", count);
317
318 hr = IEnumPins_Reset(enum1);
319 ok(hr == S_OK, "Got hr %#lx.\n", hr);
320
321 hr = IEnumPins_Next(enum1, 2, pins, NULL);
322 ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
323
324 hr = IEnumPins_Next(enum1, 2, pins, &count);
325 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
326 ok(count == 1, "Got count %lu.\n", count);
327 IPin_Release(pins[0]);
328
329 hr = IEnumPins_Reset(enum1);
330 ok(hr == S_OK, "Got hr %#lx.\n", hr);
331
332 hr = IEnumPins_Clone(enum1, &enum2);
333 ok(hr == S_OK, "Got hr %#lx.\n", hr);
334
335 hr = IEnumPins_Skip(enum1, 2);
336 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
337
338 hr = IEnumPins_Skip(enum1, 1);
339 ok(hr == S_OK, "Got hr %#lx.\n", hr);
340
341 hr = IEnumPins_Skip(enum1, 1);
342 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
343
344 hr = IEnumPins_Next(enum1, 1, pins, NULL);
345 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
346
347 hr = IEnumPins_Next(enum2, 1, pins, NULL);
348 ok(hr == S_OK, "Got hr %#lx.\n", hr);
349 IPin_Release(pins[0]);
350
351 IEnumPins_Release(enum2);
352
354
355 hr = IEnumPins_Next(enum1, 1, pins, NULL);
356 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
357
358 hr = IEnumPins_Reset(enum1);
359 ok(hr == S_OK, "Got hr %#lx.\n", hr);
360
361 hr = IEnumPins_Next(enum1, 1, pins, NULL);
362 ok(hr == S_OK, "Got hr %#lx.\n", hr);
363 IPin_Release(pins[0]);
364
365 hr = IEnumPins_Next(enum1, 1, pins, NULL);
366 ok(hr == S_OK, "Got hr %#lx.\n", hr);
367 IPin_Release(pins[0]);
368
369 hr = IEnumPins_Next(enum1, 1, pins, NULL);
370 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
371
372 hr = IEnumPins_Reset(enum1);
373 ok(hr == S_OK, "Got hr %#lx.\n", hr);
374
375 hr = IEnumPins_Next(enum1, 2, pins, &count);
376 ok(hr == S_OK, "Got hr %#lx.\n", hr);
377 ok(count == 2, "Got count %lu.\n", count);
378 IPin_Release(pins[0]);
379 IPin_Release(pins[1]);
380
381 hr = IEnumPins_Reset(enum1);
382 ok(hr == S_OK, "Got hr %#lx.\n", hr);
383
384 hr = IEnumPins_Next(enum1, 3, pins, &count);
385 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
386 ok(count == 2, "Got count %lu.\n", count);
387 IPin_Release(pins[0]);
388 IPin_Release(pins[1]);
389
390 IEnumPins_Release(enum1);
391 IFilterGraph2_Release(graph);
392 ref = IBaseFilter_Release(filter);
393 ok(!ref, "Got outstanding refcount %ld.\n", ref);
395 ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
396}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_POINTER
Definition: winerror.h:3480

Referenced by START_TEST().

◆ test_find_pin()

static void test_find_pin ( void  )
static

Definition at line 398 of file waveparser.c.

399{
400 const WCHAR *filename = load_resource(L"test.wav");
404 IPin *pin, *pin2;
405 HRESULT hr;
406 ULONG ref;
407 BOOL ret;
408
409 hr = IBaseFilter_FindPin(filter, L"input pin", &pin);
410 ok(hr == S_OK, "Got hr %#lx.\n", hr);
411 IPin_Release(pin);
412
413 hr = IBaseFilter_FindPin(filter, L"output", &pin);
414 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
415
417
418 hr = IBaseFilter_EnumPins(filter, &enum_pins);
419 ok(hr == S_OK, "Got hr %#lx.\n", hr);
420
421 hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
422 ok(hr == S_OK, "Got hr %#lx.\n", hr);
423
424 hr = IBaseFilter_FindPin(filter, L"output", &pin);
425 ok(hr == S_OK, "Got hr %#lx.\n", hr);
426 ok(pin == pin2, "Expected pin %p, got %p.\n", pin2, pin);
427 IPin_Release(pin);
428 IPin_Release(pin2);
429
430 hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
431 ok(hr == S_OK, "Got hr %#lx.\n", hr);
432
433 hr = IBaseFilter_FindPin(filter, L"input pin", &pin);
434 ok(hr == S_OK, "Got hr %#lx.\n", hr);
435 ok(pin == pin2, "Expected pin %p, got %p.\n", pin2, pin);
436 IPin_Release(pin);
437 IPin_Release(pin2);
438
439 IEnumPins_Release(enum_pins);
440 IFilterGraph2_Release(graph);
441 ref = IBaseFilter_Release(filter);
442 ok(!ref, "Got outstanding refcount %ld.\n", ref);
444 ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
445}
#define VFW_E_NOT_FOUND
Definition: vfwmsgs.h:61

Referenced by START_TEST().

◆ test_interfaces()

static void test_interfaces ( void  )
static

Definition at line 115 of file waveparser.c.

116{
117 const WCHAR *filename = load_resource(L"test.wav");
120 IPin *pin;
121
123 check_interface(filter, &IID_IMediaFilter, TRUE);
126
127 check_interface(filter, &IID_IAMFilterMiscFlags, FALSE);
128 check_interface(filter, &IID_IBasicAudio, FALSE);
129 check_interface(filter, &IID_IBasicVideo, FALSE);
131 check_interface(filter, &IID_IMediaPosition, FALSE);
132 check_interface(filter, &IID_IMediaSeeking, FALSE);
135 check_interface(filter, &IID_IQualityControl, FALSE);
136 check_interface(filter, &IID_IQualProp, FALSE);
137 check_interface(filter, &IID_IReferenceClock, FALSE);
138 check_interface(filter, &IID_IVideoWindow, FALSE);
139
140 IBaseFilter_FindPin(filter, L"input pin", &pin);
141
144
146 check_interface(pin, &IID_IMemInputPin, FALSE);
147 check_interface(pin, &IID_IMediaPosition, FALSE);
148 check_interface(pin, &IID_IMediaSeeking, FALSE);
149
150 IPin_Release(pin);
151
152 IBaseFilter_FindPin(filter, L"output", &pin);
153
154 todo_wine check_interface(pin, &IID_IMediaPosition, TRUE);
155 check_interface(pin, &IID_IMediaSeeking, TRUE);
157 check_interface(pin, &IID_IQualityControl, TRUE);
159
162
163 IPin_Release(pin);
164
165 IBaseFilter_Release(filter);
166 IFilterGraph2_Release(graph);
168}
const GUID IID_IKsPropertySet
Definition: controlnode.cpp:13
const GUID IID_IAsyncReader
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define todo_wine
Definition: minitest.h:80
const GUID IID_IPin
Definition: pincontrol.cpp:15
const GUID IID_IPersist
Definition: proxy.cpp:14
const GUID IID_IPersistPropertyBag
Definition: proxy.cpp:11
#define check_interface(a, b, c)
Definition: waveparser.c:100

Referenced by START_TEST().

◆ test_media_types()

static void test_media_types ( void  )
static

Definition at line 521 of file waveparser.c.

522{
523 static const WAVEFORMATEX expect_wfx = {WAVE_FORMAT_PCM, 1, 44100, 44100, 1, 8, 0};
524
525 const WCHAR *filename = load_resource(L"test.wav");
527 AM_MEDIA_TYPE mt = {{0}}, *pmt;
528 IEnumMediaTypes *enummt;
530 WAVEFORMATEX *wfx;
531 HRESULT hr;
532 ULONG ref;
533 IPin *pin;
534 BOOL ret;
535
536 IBaseFilter_FindPin(filter, L"input pin", &pin);
537
538 hr = IPin_EnumMediaTypes(pin, &enummt);
539 ok(hr == S_OK, "Got hr %#lx.\n", hr);
540
541 hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
542 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
543
544 IEnumMediaTypes_Release(enummt);
545
546 mt.majortype = MEDIATYPE_Stream;
547 mt.subtype = MEDIASUBTYPE_WAVE;
548 hr = IPin_QueryAccept(pin, &mt);
549 ok(hr == S_OK, "Got hr %#lx.\n", hr);
550
551 mt.bFixedSizeSamples = TRUE;
552 mt.bTemporalCompression = TRUE;
553 mt.lSampleSize = 123;
554 mt.formattype = FORMAT_VideoInfo;
555 hr = IPin_QueryAccept(pin, &mt);
556 ok(hr == S_OK, "Got hr %#lx.\n", hr);
557
558 mt.majortype = GUID_NULL;
559 hr = IPin_QueryAccept(pin, &mt);
560 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
561 mt.majortype = MEDIATYPE_Stream;
562
563 mt.subtype = GUID_NULL;
564 hr = IPin_QueryAccept(pin, &mt);
565 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
566 mt.subtype = MEDIASUBTYPE_WAVE;
567
569
570 hr = IPin_EnumMediaTypes(pin, &enummt);
571 ok(hr == S_OK, "Got hr %#lx.\n", hr);
572
573 hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
574 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
575
576 IEnumMediaTypes_Release(enummt);
577 IPin_Release(pin);
578
579 IBaseFilter_FindPin(filter, L"output", &pin);
580
581 hr = IPin_EnumMediaTypes(pin, &enummt);
582 ok(hr == S_OK, "Got hr %#lx.\n", hr);
583
584 hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
585 ok(hr == S_OK, "Got hr %#lx.\n", hr);
586 ok(IsEqualGUID(&pmt->majortype, &MEDIATYPE_Audio), "Got major type %s.\n",
587 wine_dbgstr_guid(&pmt->majortype));
588 ok(IsEqualGUID(&pmt->subtype, &MEDIASUBTYPE_PCM), "Got subtype %s\n",
589 wine_dbgstr_guid(&pmt->subtype));
590 ok(pmt->bFixedSizeSamples == TRUE, "Got fixed size %d.\n", pmt->bFixedSizeSamples);
591 ok(!pmt->bTemporalCompression, "Got temporal compression %d.\n", pmt->bTemporalCompression);
592 ok(pmt->lSampleSize == 1, "Got sample size %lu.\n", pmt->lSampleSize);
593 ok(IsEqualGUID(&pmt->formattype, &FORMAT_WaveFormatEx), "Got format type %s.\n",
594 wine_dbgstr_guid(&pmt->formattype));
595 ok(!pmt->pUnk, "Got pUnk %p.\n", pmt->pUnk);
596 ok(pmt->cbFormat == sizeof(WAVEFORMATEX), "Got format size %lu.\n", pmt->cbFormat);
597 ok(!memcmp(pmt->pbFormat, &expect_wfx, sizeof(WAVEFORMATEX)), "Format blocks didn't match.\n");
598
599 hr = IPin_QueryAccept(pin, pmt);
600 ok(hr == S_OK, "Got hr %#lx.\n", hr);
601
602 pmt->bFixedSizeSamples = FALSE;
603 pmt->bTemporalCompression = TRUE;
604 pmt->lSampleSize = 123;
605 hr = IPin_QueryAccept(pin, pmt);
606 ok(hr == S_OK, "Got hr %#lx.\n", hr);
607
608 pmt->majortype = GUID_NULL;
609 hr = IPin_QueryAccept(pin, pmt);
610 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
611 pmt->majortype = MEDIATYPE_Audio;
612
613 pmt->subtype = GUID_NULL;
614 hr = IPin_QueryAccept(pin, pmt);
615 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
616 pmt->subtype = MEDIASUBTYPE_WAVE;
617
618 pmt->formattype = GUID_NULL;
619 hr = IPin_QueryAccept(pin, pmt);
620 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
621 pmt->formattype = FORMAT_None;
622 hr = IPin_QueryAccept(pin, pmt);
623 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
624
625 wfx = (WAVEFORMATEX *)pmt->pbFormat;
626
627 wfx->nChannels = wfx->nBlockAlign = 2;
628 wfx->nAvgBytesPerSec = 44100 * 2;
629 wfx->nBlockAlign = 2;
630 hr = IPin_QueryAccept(pin, pmt);
631 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
632 *wfx = expect_wfx;
633
635 hr = IPin_QueryAccept(pin, pmt);
636 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
637 *wfx = expect_wfx;
638
639 CoTaskMemFree(pmt->pbFormat);
640 CoTaskMemFree(pmt);
641
642 hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
643 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
644
645 IEnumMediaTypes_Release(enummt);
646 IPin_Release(pin);
647
648 IFilterGraph2_Release(graph);
649 ref = IBaseFilter_Release(filter);
650 ok(!ref, "Got outstanding refcount %ld.\n", ref);
652 ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
653}
#define WAVE_FORMAT_PCM
Definition: constants.h:425
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
#define GUID_NULL
Definition: ks.h:106
#define WAVE_FORMAT_IMA_ADPCM
Definition: mmreg.h:103
DWORD nAvgBytesPerSec
Definition: audioclient.idl:43

Referenced by START_TEST().

◆ test_pin_info()

static void test_pin_info ( void  )
static

Definition at line 447 of file waveparser.c.

448{
449 const WCHAR *filename = load_resource(L"test.wav");
455 HRESULT hr;
456 WCHAR *id;
457 IPin *pin;
458 BOOL ret;
459
461
462 hr = IBaseFilter_FindPin(filter, L"input pin", &pin);
463 ok(hr == S_OK, "Got hr %#lx.\n", hr);
465 ref = get_refcount(pin);
466 ok(ref == expect_ref, "Got unexpected refcount %ld.\n", ref);
467
468 hr = IPin_QueryPinInfo(pin, &info);
469 ok(hr == S_OK, "Got hr %#lx.\n", hr);
470 ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
471 ok(info.dir == PINDIR_INPUT, "Got direction %d.\n", info.dir);
472 ok(!wcscmp(info.achName, L"input pin"), "Got name %s.\n", wine_dbgstr_w(info.achName));
474 ok(ref == expect_ref + 1, "Got unexpected refcount %ld.\n", ref);
475 ref = get_refcount(pin);
476 ok(ref == expect_ref + 1, "Got unexpected refcount %ld.\n", ref);
477 IBaseFilter_Release(info.pFilter);
478
479 hr = IPin_QueryDirection(pin, &dir);
480 ok(hr == S_OK, "Got hr %#lx.\n", hr);
481 ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir);
482
483 hr = IPin_QueryId(pin, &id);
484 ok(hr == S_OK, "Got hr %#lx.\n", hr);
485 ok(!wcscmp(id, L"input pin"), "Got id %s.\n", wine_dbgstr_w(id));
486 CoTaskMemFree(id);
487
488 IPin_Release(pin);
489
490 hr = IBaseFilter_FindPin(filter, L"output", &pin);
491 ok(hr == S_OK, "Got hr %#lx.\n", hr);
492
494 check_interface(pin, &IID_IMediaSeeking, TRUE);
495
496 hr = IPin_QueryPinInfo(pin, &info);
497 ok(hr == S_OK, "Got hr %#lx.\n", hr);
498 ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
499 ok(info.dir == PINDIR_OUTPUT, "Got direction %d.\n", info.dir);
500 ok(!wcscmp(info.achName, L"output"), "Got name %s.\n", wine_dbgstr_w(info.achName));
501 IBaseFilter_Release(info.pFilter);
502
503 hr = IPin_QueryDirection(pin, &dir);
504 ok(hr == S_OK, "Got hr %#lx.\n", hr);
505 ok(dir == PINDIR_OUTPUT, "Got direction %d.\n", dir);
506
507 hr = IPin_QueryId(pin, &id);
508 ok(hr == S_OK, "Got hr %#lx.\n", hr);
509 ok(!wcscmp(id, L"output"), "Got id %s.\n", wine_dbgstr_w(id));
510 CoTaskMemFree(id);
511
512 IPin_Release(pin);
513
514 IFilterGraph2_Release(graph);
515 ref = IBaseFilter_Release(filter);
516 ok(!ref, "Got outstanding refcount %ld.\n", ref);
518 ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
519}
unsigned int dir
Definition: maze.c:112
enum _PinDirection PIN_DIRECTION
@ PINDIR_OUTPUT
Definition: axcore.idl:42
@ PINDIR_INPUT
Definition: axcore.idl:41
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1977
GLuint id
Definition: glext.h:5910
#define expect_ref(obj, ref)
Definition: metadata.c:40

Referenced by START_TEST().

◆ test_seeking()

static void test_seeking ( void  )
static

Definition at line 830 of file waveparser.c.

831{
832 LONGLONG time, current, stop, earliest, latest, duration;
833 const WCHAR *filename = load_resource(L"test.wav");
836 IMediaSeeking *seeking;
837 unsigned int i;
838 double rate;
839 GUID format;
840 HRESULT hr;
841 DWORD caps;
842 ULONG ref;
843 IPin *pin;
844 BOOL ret;
845
846 static const struct
847 {
848 const GUID *guid;
849 HRESULT hr;
850 }
851 format_tests[] =
852 {
853 {&TIME_FORMAT_MEDIA_TIME, S_OK},
854 {&TIME_FORMAT_SAMPLE, S_OK},
855
856 {&TIME_FORMAT_BYTE, S_FALSE},
857 {&TIME_FORMAT_NONE, S_FALSE},
858 {&TIME_FORMAT_FRAME, S_FALSE},
859 {&TIME_FORMAT_FIELD, S_FALSE},
860 {&testguid, S_FALSE},
861 };
862
863 IBaseFilter_FindPin(filter, L"output", &pin);
864 IPin_QueryInterface(pin, &IID_IMediaSeeking, (void **)&seeking);
865
866 hr = IMediaSeeking_GetCapabilities(seeking, &caps);
867 ok(hr == S_OK, "Got hr %#lx.\n", hr);
870 | AM_SEEKING_CanGetDuration | AM_SEEKING_CanDoSegments), "Got caps %#lx.\n", caps);
871
873 hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
874 ok(hr == S_OK, "Got hr %#lx.\n", hr);
875 ok(caps == (AM_SEEKING_CanSeekAbsolute | AM_SEEKING_CanSeekForwards), "Got caps %#lx.\n", caps);
876
878 hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
879 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
880 ok(caps == AM_SEEKING_CanSeekAbsolute, "Got caps %#lx.\n", caps);
881
883 hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
884 ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
885 ok(!caps, "Got caps %#lx.\n", caps);
886
887 caps = 0;
888 hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
889 ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
890 ok(!caps, "Got caps %#lx.\n", caps);
891
892 for (i = 0; i < ARRAY_SIZE(format_tests); ++i)
893 {
894 hr = IMediaSeeking_IsFormatSupported(seeking, format_tests[i].guid);
895 todo_wine_if(i == 1) ok(hr == format_tests[i].hr, "Got hr %#lx for format %s.\n",
896 hr, wine_dbgstr_guid(format_tests[i].guid));
897 }
898
899 hr = IMediaSeeking_QueryPreferredFormat(seeking, &format);
900 ok(hr == S_OK, "Got hr %#lx.\n", hr);
901 ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format));
902
903 hr = IMediaSeeking_GetTimeFormat(seeking, &format);
904 ok(hr == S_OK, "Got hr %#lx.\n", hr);
905 ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format));
906
907 hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME);
908 ok(hr == S_OK, "Got hr %#lx.\n", hr);
909 hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_SAMPLE);
910 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
911
912 hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_FRAME);
913 ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
914 hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_SAMPLE);
915 todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
916
917 hr = IMediaSeeking_GetTimeFormat(seeking, &format);
918 ok(hr == S_OK, "Got hr %#lx.\n", hr);
919 todo_wine ok(IsEqualGUID(&format, &TIME_FORMAT_SAMPLE), "Got format %s.\n", wine_dbgstr_guid(&format));
920
921 hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME);
922 todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
923 hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_SAMPLE);
924 todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
925
926 hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME);
927 ok(hr == S_OK, "Got hr %#lx.\n", hr);
928
929 duration = 0xdeadbeef;
930 hr = IMediaSeeking_GetDuration(seeking, &duration);
931 ok(hr == S_OK, "Got hr %#lx.\n", hr);
932 ok(duration == 1000000, "Got duration %I64d.\n", duration);
933
934 stop = current = 0xdeadbeef;
935 hr = IMediaSeeking_GetStopPosition(seeking, &stop);
936 ok(hr == S_OK, "Got hr %#lx.\n", hr);
937 ok(stop == duration, "Expected time %s, got %s.\n",
938 wine_dbgstr_longlong(duration), wine_dbgstr_longlong(stop));
939 hr = IMediaSeeking_GetCurrentPosition(seeking, &current);
940 ok(hr == S_OK, "Got hr %#lx.\n", hr);
941 ok(!current, "Got time %s.\n", wine_dbgstr_longlong(current));
942 stop = current = 0xdeadbeef;
943 hr = IMediaSeeking_GetPositions(seeking, &current, &stop);
944 ok(hr == S_OK, "Got hr %#lx.\n", hr);
945 ok(!current, "Got time %s.\n", wine_dbgstr_longlong(current));
946 ok(stop == duration, "Expected time %s, got %s.\n",
947 wine_dbgstr_longlong(duration), wine_dbgstr_longlong(stop));
948
949 time = 0xdeadbeef;
950 hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &TIME_FORMAT_MEDIA_TIME, 0x123456789a, NULL);
951 ok(hr == S_OK, "Got hr %#lx.\n", hr);
952 ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time));
953 time = 0xdeadbeef;
954 hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, NULL, 0x123456789a, &TIME_FORMAT_MEDIA_TIME);
955 ok(hr == S_OK, "Got hr %#lx.\n", hr);
956 ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time));
957 time = 0xdeadbeef;
958 hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, NULL, 441, &TIME_FORMAT_SAMPLE);
959 todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
960 todo_wine ok(time == 100000, "Got time %s.\n", wine_dbgstr_longlong(time));
961
962 earliest = latest = 0xdeadbeef;
963 hr = IMediaSeeking_GetAvailable(seeking, &earliest, &latest);
964 ok(hr == S_OK, "Got hr %#lx.\n", hr);
965 ok(!earliest, "Got time %s.\n", wine_dbgstr_longlong(earliest));
966 ok(latest == duration, "Expected time %s, got %s.\n",
967 wine_dbgstr_longlong(duration), wine_dbgstr_longlong(latest));
968
969 rate = 0;
970 hr = IMediaSeeking_GetRate(seeking, &rate);
971 ok(hr == S_OK, "Got hr %#lx.\n", hr);
972 ok(rate == 1.0, "Got rate %.16e.\n", rate);
973
974 hr = IMediaSeeking_SetRate(seeking, 200.0);
975 todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
976 rate = 0;
977 hr = IMediaSeeking_GetRate(seeking, &rate);
978 ok(hr == S_OK, "Got hr %#lx.\n", hr);
979 todo_wine ok(rate == 200.0, "Got rate %.16e.\n", rate);
980
981 hr = IMediaSeeking_SetRate(seeking, -1.0);
982 todo_wine ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
983
984 hr = IMediaSeeking_GetPreroll(seeking, &time);
985 todo_wine ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
986
987 current = 200 * 10000;
988 stop = 400 * 10000;
989 hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning,
990 &stop, AM_SEEKING_AbsolutePositioning);
991 ok(hr == S_OK, "Got hr %#lx.\n", hr);
992 ok(current == 200 * 10000, "Got time %s.\n", wine_dbgstr_longlong(current));
993 ok(stop == 400 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
994
995 stop = current = 0xdeadbeef;
996 hr = IMediaSeeking_GetPositions(seeking, &current, &stop);
997 ok(hr == S_OK, "Got hr %#lx.\n", hr);
998 ok(current == 200 * 10000, "Got time %s.\n", wine_dbgstr_longlong(current));
999 ok(stop == 400 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
1000
1001 current = 200 * 10000;
1002 stop = 400 * 10000;
1003 hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning | AM_SEEKING_ReturnTime,
1004 &stop, AM_SEEKING_AbsolutePositioning | AM_SEEKING_ReturnTime);
1005 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1006 ok(current == 200 * 10000, "Got time %s.\n", wine_dbgstr_longlong(current));
1007 ok(stop == 400 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
1008
1009 current = 100 * 10000;
1010 stop = 200 * 10000;
1011 hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning | AM_SEEKING_ReturnTime,
1012 &stop, AM_SEEKING_AbsolutePositioning | AM_SEEKING_ReturnTime);
1013 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1014 ok(current == 100 * 10000, "Got time %s.\n", wine_dbgstr_longlong(current));
1015 ok(stop == 200 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
1016
1017 current = 50 * 10000;
1018 hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning,
1019 NULL, AM_SEEKING_NoPositioning);
1020 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1021
1022 stop = current = 0xdeadbeef;
1023 hr = IMediaSeeking_GetPositions(seeking, &current, &stop);
1024 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1025 ok(current == 50 * 10000, "Got time %s.\n", wine_dbgstr_longlong(current));
1026 ok(stop == 200 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
1027
1028 IMediaSeeking_Release(seeking);
1029 IPin_Release(pin);
1030 IFilterGraph2_Release(graph);
1031 ref = IBaseFilter_Release(filter);
1032 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1033 ret = DeleteFileW(filename);
1034 ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
1035}
unsigned int rate
Definition: audiorecord.c:87
@ AM_SEEKING_CanGetDuration
Definition: axcore.idl:609
@ AM_SEEKING_CanGetCurrentPos
Definition: axcore.idl:607
@ AM_SEEKING_CanSeekBackwards
Definition: axcore.idl:606
@ AM_SEEKING_CanDoSegments
Definition: axcore.idl:611
@ AM_SEEKING_CanSeekForwards
Definition: axcore.idl:605
@ AM_SEEKING_CanSeekAbsolute
Definition: axcore.idl:604
@ AM_SEEKING_CanGetStopPos
Definition: axcore.idl:608
#define E_FAIL
Definition: ddrawi.h:102
GUID guid
Definition: version.c:147
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define todo_wine_if(is_todo)
Definition: minitest.h:81
__u16 time
Definition: mkdosfs.c:8
struct task_struct * current
Definition: linux.c:32
int64_t LONGLONG
Definition: typedefs.h:68
static const GUID testguid
Definition: waveparser.c:26

Referenced by START_TEST().

◆ test_unconnected_filter_state()

static void test_unconnected_filter_state ( void  )
static

Definition at line 773 of file waveparser.c.

774{
776 FILTER_STATE state;
777 HRESULT hr;
778 ULONG ref;
779
780 hr = IBaseFilter_GetState(filter, 0, &state);
781 ok(hr == S_OK, "Got hr %#lx.\n", hr);
782 ok(state == State_Stopped, "Got state %u.\n", state);
783
784 hr = IBaseFilter_Pause(filter);
785 ok(hr == S_OK, "Got hr %#lx.\n", hr);
786
787 hr = IBaseFilter_GetState(filter, 0, &state);
788 ok(hr == S_OK, "Got hr %#lx.\n", hr);
789 ok(state == State_Paused, "Got state %u.\n", state);
790
791 hr = IBaseFilter_Run(filter, 0);
792 ok(hr == S_OK, "Got hr %#lx.\n", hr);
793
794 hr = IBaseFilter_GetState(filter, 0, &state);
795 ok(hr == S_OK, "Got hr %#lx.\n", hr);
796 ok(state == State_Running, "Got state %u.\n", state);
797
798 hr = IBaseFilter_Pause(filter);
799 ok(hr == S_OK, "Got hr %#lx.\n", hr);
800
801 hr = IBaseFilter_GetState(filter, 0, &state);
802 ok(hr == S_OK, "Got hr %#lx.\n", hr);
803 ok(state == State_Paused, "Got state %u.\n", state);
804
805 hr = IBaseFilter_Stop(filter);
806 ok(hr == S_OK, "Got hr %#lx.\n", hr);
807
808 hr = IBaseFilter_GetState(filter, 0, &state);
809 ok(hr == S_OK, "Got hr %#lx.\n", hr);
810 ok(state == State_Stopped, "Got state %u.\n", state);
811
812 hr = IBaseFilter_Run(filter, 0);
813 ok(hr == S_OK, "Got hr %#lx.\n", hr);
814
815 hr = IBaseFilter_GetState(filter, 0, &state);
816 ok(hr == S_OK, "Got hr %#lx.\n", hr);
817 ok(state == State_Running, "Got state %u.\n", state);
818
819 hr = IBaseFilter_Stop(filter);
820 ok(hr == S_OK, "Got hr %#lx.\n", hr);
821
822 hr = IBaseFilter_GetState(filter, 0, &state);
823 ok(hr == S_OK, "Got hr %#lx.\n", hr);
824 ok(state == State_Stopped, "Got state %u.\n", state);
825
826 ref = IBaseFilter_Release(filter);
827 ok(!ref, "Got outstanding refcount %ld.\n", ref);
828}
static int state
Definition: maze.c:121

Referenced by START_TEST().

Variable Documentation

◆ outer_ref

LONG outer_ref = 1
static

Definition at line 171 of file waveparser.c.

Referenced by outer_AddRef(), outer_Release(), and test_aggregation().

◆ outer_vtbl

const IUnknownVtbl outer_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI outer_AddRef(IUnknown *iface)
Definition: waveparser.c:186
static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID iid, void **out)
Definition: waveparser.c:173
static ULONG WINAPI outer_Release(IUnknown *iface)
Definition: waveparser.c:191

Definition at line 196 of file waveparser.c.

◆ test_iid

const GUID test_iid = {0x33333333}
static

Definition at line 170 of file waveparser.c.

Referenced by outer_QueryInterface(), and test_aggregation().

◆ test_outer

IUnknown test_outer = {&outer_vtbl}
static

Definition at line 203 of file waveparser.c.

Referenced by test_aggregation().

◆ testguid

const GUID testguid = {0xfacade}
static

Definition at line 26 of file waveparser.c.

Referenced by test_seeking().