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

Go to the source code of this file.

Classes

struct  testfilter
 

Macros

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

Functions

static IBaseFilter * create_avi_splitter (void)
 
static BOOL compare_media_types (const AM_MEDIA_TYPE *a, const AM_MEDIA_TYPE *b)
 
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 struct testfilter * impl_from_strmbase_filter (struct strmbase_filter *iface)
 
static struct strmbase_pin * testfilter_get_pin (struct strmbase_filter *iface, unsigned int index)
 
static void testfilter_destroy (struct strmbase_filter *iface)
 
static HRESULT testfilter_init_stream (struct strmbase_filter *iface)
 
static HRESULT testsource_query_interface (struct strmbase_pin *iface, REFIID iid, void **out)
 
static HRESULT WINAPI testsource_AttemptConnection (struct strmbase_source *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
 
static HRESULT testsink_query_interface (struct strmbase_pin *iface, REFIID iid, void **out)
 
static HRESULT testsink_get_media_type (struct strmbase_pin *iface, unsigned int index, AM_MEDIA_TYPE *mt)
 
static HRESULT testsink_connect (struct strmbase_sink *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
 
static HRESULT WINAPI testsink_Receive (struct strmbase_sink *iface, IMediaSample *sample)
 
static HRESULT testsink_eos (struct strmbase_sink *iface)
 
static HRESULT testsink_new_segment (struct strmbase_sink *iface, REFERENCE_TIME start, REFERENCE_TIME end, double rate)
 
static struct testfilter * impl_from_IAsyncReader (IAsyncReader *iface)
 
static HRESULT WINAPI async_reader_QueryInterface (IAsyncReader *iface, REFIID iid, void **out)
 
static ULONG WINAPI async_reader_AddRef (IAsyncReader *iface)
 
static ULONG WINAPI async_reader_Release (IAsyncReader *iface)
 
static HRESULT WINAPI async_reader_RequestAllocator (IAsyncReader *iface, IMemAllocator *preferred, ALLOCATOR_PROPERTIES *props, IMemAllocator **allocator)
 
static HRESULT WINAPI async_reader_Request (IAsyncReader *iface, IMediaSample *sample, DWORD_PTR cookie)
 
static HRESULT WINAPI async_reader_WaitForNext (IAsyncReader *iface, DWORD timeout, IMediaSample **sample, DWORD_PTR *cookie)
 
static HRESULT WINAPI async_reader_SyncReadAligned (IAsyncReader *iface, IMediaSample *sample)
 
static HRESULT WINAPI async_reader_SyncRead (IAsyncReader *iface, LONGLONG position, LONG length, BYTE *buffer)
 
static HRESULT WINAPI async_reader_Length (IAsyncReader *iface, LONGLONG *total, LONGLONG *available)
 
static HRESULT WINAPI async_reader_BeginFlush (IAsyncReader *iface)
 
static HRESULT WINAPI async_reader_EndFlush (IAsyncReader *iface)
 
static void testfilter_init (struct testfilter *filter)
 
static void test_filter_state (IMediaControl *control)
 
static void test_connect_pin (void)
 
static void test_unconnected_filter_state (void)
 
static void test_seeking (void)
 
static void test_streaming (const WCHAR *resname)
 
 START_TEST (avisplit)
 

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}
 
static const struct strmbase_filter_ops testfilter_ops
 
static const struct strmbase_source_ops testsource_ops
 
static const struct strmbase_sink_ops testsink_ops
 
static const struct IAsyncReaderVtbl async_reader_vtbl
 

Macro Definition Documentation

◆ check_interface

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

Definition at line 108 of file avisplit.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file avisplit.c.

Function Documentation

◆ async_reader_AddRef()

static ULONG WINAPI async_reader_AddRef ( IAsyncReader *  iface)
static

Definition at line 1025 of file avisplit.c.

1026{
1027 return IPin_AddRef(&impl_from_IAsyncReader(iface)->source.pin.IPin_iface);
1028}
static struct testfilter * impl_from_IAsyncReader(IAsyncReader *iface)
Definition: avisplit.c:1015

◆ async_reader_BeginFlush()

static HRESULT WINAPI async_reader_BeginFlush ( IAsyncReader *  iface)
static

Definition at line 1067 of file avisplit.c.

1068{
1069 return IAsyncReader_BeginFlush(impl_from_IAsyncReader(iface)->reader);
1070}
Definition: reader.h:84

◆ async_reader_EndFlush()

static HRESULT WINAPI async_reader_EndFlush ( IAsyncReader *  iface)
static

Definition at line 1072 of file avisplit.c.

1073{
1074 return IAsyncReader_EndFlush(impl_from_IAsyncReader(iface)->reader);
1075}

◆ async_reader_Length()

static HRESULT WINAPI async_reader_Length ( IAsyncReader *  iface,
LONGLONG *  total,
LONGLONG *  available 
)
static

Definition at line 1062 of file avisplit.c.

1063{
1064 return IAsyncReader_Length(impl_from_IAsyncReader(iface)->reader, total, available);
1065}
static WCHAR available[MAX_STRING_RESOURCE_LEN]
Definition: object.c:2402
size_t total

◆ async_reader_QueryInterface()

static HRESULT WINAPI async_reader_QueryInterface ( IAsyncReader *  iface,
REFIID  iid,
void **  out 
)
static

Definition at line 1020 of file avisplit.c.

1021{
1022 return IPin_QueryInterface(&impl_from_IAsyncReader(iface)->source.pin.IPin_iface, iid, out);
1023}
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383

◆ async_reader_Release()

static ULONG WINAPI async_reader_Release ( IAsyncReader *  iface)
static

Definition at line 1030 of file avisplit.c.

1031{
1032 return IPin_Release(&impl_from_IAsyncReader(iface)->source.pin.IPin_iface);
1033}

◆ async_reader_Request()

static HRESULT WINAPI async_reader_Request ( IAsyncReader *  iface,
IMediaSample *  sample,
DWORD_PTR  cookie 
)
static

Definition at line 1041 of file avisplit.c.

1042{
1043 return IAsyncReader_Request(impl_from_IAsyncReader(iface)->reader, sample, cookie);
1044}
Definition: cookie.c:34
Definition: wave.c:25

◆ async_reader_RequestAllocator()

static HRESULT WINAPI async_reader_RequestAllocator ( IAsyncReader *  iface,
IMemAllocator *  preferred,
ALLOCATOR_PROPERTIES *  props,
IMemAllocator **  allocator 
)
static

Definition at line 1035 of file avisplit.c.

1037{
1038 return IAsyncReader_RequestAllocator(impl_from_IAsyncReader(iface)->reader, preferred, props, allocator);
1039}
static const WCHAR props[]
Definition: wbemdisp.c:288

◆ async_reader_SyncRead()

static HRESULT WINAPI async_reader_SyncRead ( IAsyncReader *  iface,
LONGLONG  position,
LONG  length,
BYTE *  buffer 
)
static

Definition at line 1057 of file avisplit.c.

1058{
1059 return IAsyncReader_SyncRead(impl_from_IAsyncReader(iface)->reader, position, length, buffer);
1060}
GLuint buffer
Definition: glext.h:5915
GLuint GLsizei GLsizei * length
Definition: glext.h:6040

◆ async_reader_SyncReadAligned()

static HRESULT WINAPI async_reader_SyncReadAligned ( IAsyncReader *  iface,
IMediaSample *  sample 
)
static

Definition at line 1052 of file avisplit.c.

1053{
1054 return IAsyncReader_SyncReadAligned(impl_from_IAsyncReader(iface)->reader, sample);
1055}

◆ async_reader_WaitForNext()

static HRESULT WINAPI async_reader_WaitForNext ( IAsyncReader *  iface,
DWORD  timeout,
IMediaSample **  sample,
DWORD_PTR *  cookie 
)
static

Definition at line 1046 of file avisplit.c.

1048{
1049 return IAsyncReader_WaitForNext(impl_from_IAsyncReader(iface)->reader, timeout, sample, cookie);
1050}
Definition: dhcpd.h:248

◆ check_interface_()

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

Definition at line 109 of file avisplit.c.

110{
111 IUnknown *iface = iface_ptr;
113 IUnknown *unk;
114
115 expected_hr = supported ? S_OK : E_NOINTERFACE;
116
117 hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
118 ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
119 if (SUCCEEDED(hr))
120 IUnknown_Release(unk);
121}
#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

◆ compare_media_types()

static BOOL compare_media_types ( const AM_MEDIA_TYPE *  a,
const AM_MEDIA_TYPE *  b 
)
inlinestatic

Definition at line 39 of file avisplit.c.

40{
41 return !memcmp(a, b, offsetof(AM_MEDIA_TYPE, pbFormat))
42 && !memcmp(a->pbFormat, b->pbFormat, a->cbFormat);
43}
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define offsetof(TYPE, MEMBER)

Referenced by test_connect_pin(), and testsink_connect().

◆ connect_input()

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

Definition at line 77 of file avisplit.c.

78{
79 IFileSourceFilter *filesource;
82 IPin *source, *sink;
83 HRESULT hr;
84
85 CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER,
86 &IID_IBaseFilter, (void **)&reader);
87 IBaseFilter_QueryInterface(reader, &IID_IFileSourceFilter, (void **)&filesource);
88 IFileSourceFilter_Load(filesource, filename, NULL);
89
90 CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
91 &IID_IFilterGraph2, (void **)&graph);
92 IFilterGraph2_AddFilter(graph, reader, NULL);
93 IFilterGraph2_AddFilter(graph, splitter, NULL);
94
95 IBaseFilter_FindPin(splitter, L"input pin", &sink);
96 IBaseFilter_FindPin(reader, L"Output", &source);
97
98 hr = IFilterGraph2_ConnectDirect(graph, source, sink, NULL);
99 ok(hr == S_OK, "Got hr %#lx.\n", hr);
100
101 IPin_Release(source);
102 IPin_Release(sink);
103 IBaseFilter_Release(reader);
104 IFileSourceFilter_Release(filesource);
105 return graph;
106}
#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

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

◆ create_avi_splitter()

static IBaseFilter * create_avi_splitter ( void  )
static

Definition at line 30 of file avisplit.c.

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

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

◆ get_refcount()

static ULONG get_refcount ( void *  iface)
static

Definition at line 70 of file avisplit.c.

71{
72 IUnknown *unknown = iface;
73 IUnknown_AddRef(unknown);
74 return IUnknown_Release(unknown);
75}
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1674

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

◆ impl_from_IAsyncReader()

◆ impl_from_strmbase_filter()

◆ load_resource()

static WCHAR * load_resource ( const WCHAR *  name)
static

Definition at line 45 of file avisplit.c.

46{
47 static WCHAR pathW[MAX_PATH];
48 DWORD written;
50 HRSRC res;
51 void *ptr;
52
55
57 ok(file != INVALID_HANDLE_VALUE, "Failed to create file %s, error %lu.\n",
59
61 ok(!!res, "Failed to load resource, error %lu.\n", GetLastError());
64 ok(written == SizeofResource(GetModuleHandleA(NULL), res), "Failed to write resource.\n");
66
67 return pathW;
68}
#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 194 of file avisplit.c.

195{
197}
#define InterlockedIncrement
Definition: armddk.h:53
static LONG outer_ref
Definition: avisplit.c:179

◆ outer_QueryInterface()

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

Definition at line 181 of file avisplit.c.

182{
183 if (IsEqualGUID(iid, &IID_IUnknown)
185 || IsEqualGUID(iid, &test_iid))
186 {
187 *out = (IUnknown *)0xdeadbeef;
188 return S_OK;
189 }
190 ok(0, "unexpected call %s\n", wine_dbgstr_guid(iid));
191 return E_NOINTERFACE;
192}
static const GUID test_iid
Definition: avisplit.c:178
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

◆ outer_Release()

static ULONG WINAPI outer_Release ( IUnknown *  iface)
static

Definition at line 199 of file avisplit.c.

200{
202}
#define InterlockedDecrement
Definition: armddk.h:52

◆ START_TEST()

START_TEST ( avisplit  )

Definition at line 1770 of file avisplit.c.

1771{
1773
1775
1776 if (FAILED(CoCreateInstance(&CLSID_AviSplitter, NULL, CLSCTX_INPROC_SERVER,
1777 &IID_IBaseFilter, (void **)&filter)))
1778 {
1779 skip("Failed to create AVI splitter.\n");
1780 return;
1781 }
1782 IBaseFilter_Release(filter);
1783
1787 test_find_pin();
1788 test_pin_info();
1793 test_seeking();
1794 test_streaming(L"test.avi");
1795 test_streaming(L"test_cinepak.avi");
1796
1798}
#define skip(...)
Definition: atltest.h:64
static void test_aggregation(void)
Definition: avisplit.c:213
static void test_pin_info(void)
Definition: avisplit.c:458
static void test_find_pin(void)
Definition: avisplit.c:406
static void test_enum_media_types(void)
Definition: avisplit.c:685
static void test_interfaces(void)
Definition: avisplit.c:123
static void test_connect_pin(void)
Definition: avisplit.c:1156
static void test_media_types(void)
Definition: avisplit.c:532
static void test_enum_pins(void)
Definition: avisplit.c:272
static void test_seeking(void)
Definition: avisplit.c:1476
static void test_unconnected_filter_state(void)
Definition: avisplit.c:1419
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_streaming(void)
Definition: mpegsplit.c:1822

◆ test_aggregation()

static void test_aggregation ( void  )
static

Definition at line 213 of file avisplit.c.

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

Referenced by START_TEST().

◆ test_connect_pin()

static void test_connect_pin ( void  )
static

Definition at line 1156 of file avisplit.c.

1157{
1158 AM_MEDIA_TYPE req_mt =
1159 {
1160 .majortype = MEDIATYPE_Stream,
1161 .subtype = MEDIASUBTYPE_Avi,
1162 .formattype = FORMAT_None,
1163 .lSampleSize = 888,
1164 };
1166 const WCHAR *filename = load_resource(L"test.avi");
1167 struct testfilter testsource, testsink;
1168 IFileSourceFilter *filesource;
1170 IPin *sink, *source, *peer;
1171 IEnumMediaTypes *enummt;
1172 IMediaControl *control;
1174 HRESULT hr;
1175 ULONG ref;
1176 BOOL ret;
1177
1178 CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
1179 &IID_IFilterGraph2, (void **)&graph);
1180 testfilter_init(&testsource);
1182 IFilterGraph2_AddFilter(graph, &testsink.filter.IBaseFilter_iface, L"sink");
1183 IFilterGraph2_AddFilter(graph, &testsource.filter.IBaseFilter_iface, L"source");
1184 IFilterGraph2_AddFilter(graph, filter, L"splitter");
1185 IBaseFilter_FindPin(filter, L"input pin", &sink);
1186 IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
1187
1188 CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER,
1189 &IID_IBaseFilter, (void **)&reader);
1190 IBaseFilter_QueryInterface(reader, &IID_IFileSourceFilter, (void **)&filesource);
1191 IFileSourceFilter_Load(filesource, filename, NULL);
1192 IFileSourceFilter_Release(filesource);
1193 IBaseFilter_FindPin(reader, L"Output", &source);
1194 IPin_QueryInterface(source, &IID_IAsyncReader, (void **)&testsource.reader);
1195 IPin_Release(source);
1196
1197 /* Test sink connection. */
1198
1199 peer = (IPin *)0xdeadbeef;
1200 hr = IPin_ConnectedTo(sink, &peer);
1201 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1202 ok(!peer, "Got peer %p.\n", peer);
1203
1204 hr = IPin_ConnectionMediaType(sink, &mt);
1205 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1206
1207 hr = IMediaControl_Pause(control);
1208 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1209 hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
1210 ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
1211 hr = IMediaControl_Stop(control);
1212 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1213
1214 req_mt.majortype = MEDIATYPE_Video;
1215 hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
1216 ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
1217 req_mt.majortype = MEDIATYPE_Stream;
1218
1219 req_mt.subtype = MEDIASUBTYPE_RGB8;
1220 hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
1221 ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
1222 req_mt.subtype = MEDIASUBTYPE_Avi;
1223
1224 hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
1225 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1226
1227 hr = IPin_ConnectedTo(sink, &peer);
1228 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1229 ok(peer == &testsource.source.pin.IPin_iface, "Got peer %p.\n", peer);
1230 IPin_Release(peer);
1231
1232 hr = IPin_ConnectionMediaType(sink, &mt);
1233 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1234 ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
1235 ok(compare_media_types(&testsource.source.pin.mt, &req_mt), "Media types didn't match.\n");
1236 FreeMediaType(&mt);
1237
1238 hr = IMediaControl_Pause(control);
1239 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1240 hr = IFilterGraph2_Disconnect(graph, sink);
1241 ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
1242 hr = IMediaControl_Stop(control);
1243 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1244
1245 /* Test source connection. */
1246
1247 IBaseFilter_FindPin(filter, L"Stream 00", &source);
1248
1249 peer = (IPin *)0xdeadbeef;
1250 hr = IPin_ConnectedTo(source, &peer);
1251 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1252 ok(!peer, "Got peer %p.\n", peer);
1253
1254 hr = IPin_ConnectionMediaType(source, &mt);
1255 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1256
1257 /* Exact connection. */
1258
1259 IPin_EnumMediaTypes(source, &enummt);
1260 IEnumMediaTypes_Next(enummt, 1, &source_mt, NULL);
1261 IEnumMediaTypes_Release(enummt);
1262 CopyMediaType(&req_mt, source_mt);
1263
1264 hr = IMediaControl_Pause(control);
1265 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1266 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1267 ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
1268 hr = IMediaControl_Stop(control);
1269 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1270
1271 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1272 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1273
1275
1276 hr = IPin_ConnectedTo(source, &peer);
1277 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1278 ok(peer == &testsink.sink.pin.IPin_iface, "Got peer %p.\n", peer);
1279 IPin_Release(peer);
1280
1281 hr = IPin_ConnectionMediaType(source, &mt);
1282 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1283 ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
1284 ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
1285 FreeMediaType(&mt);
1286
1287 hr = IMediaControl_Pause(control);
1288 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1289 hr = IFilterGraph2_Disconnect(graph, source);
1290 ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
1291 hr = IMediaControl_Stop(control);
1292 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1293
1294 hr = IFilterGraph2_Disconnect(graph, source);
1295 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1296 hr = IFilterGraph2_Disconnect(graph, source);
1297 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1298 ok(testsink.sink.pin.peer == source, "Got peer %p.\n", testsink.sink.pin.peer);
1299 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1300
1301 req_mt.lSampleSize = 999;
1302 req_mt.bTemporalCompression = req_mt.bFixedSizeSamples = TRUE;
1303 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1304 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1305 ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
1306 IFilterGraph2_Disconnect(graph, source);
1307 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1308
1309 req_mt.majortype = MEDIATYPE_Stream;
1310 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1311 ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
1312 req_mt.majortype = MEDIATYPE_Video;
1313
1314 req_mt.subtype = MEDIASUBTYPE_RGB32;
1315 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1316 ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
1317 req_mt.subtype = GUID_NULL;
1318 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1319 ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
1320 req_mt.subtype = MEDIASUBTYPE_I420;
1321
1322 /* Connection with wildcards. */
1323
1324 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
1325 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1326 ok(compare_media_types(&testsink.sink.pin.mt, source_mt), "Media types didn't match.\n");
1327 IFilterGraph2_Disconnect(graph, source);
1328 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1329
1330 req_mt.majortype = GUID_NULL;
1331 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1332 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1333 ok(compare_media_types(&testsink.sink.pin.mt, source_mt), "Media types didn't match.\n");
1334 IFilterGraph2_Disconnect(graph, source);
1335 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1336
1337 req_mt.subtype = MEDIASUBTYPE_RGB32;
1338 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1339 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1340
1341 req_mt.subtype = GUID_NULL;
1342 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1343 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1344 ok(compare_media_types(&testsink.sink.pin.mt, source_mt), "Media types didn't match.\n");
1345 IFilterGraph2_Disconnect(graph, source);
1346 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1347
1348 req_mt.formattype = FORMAT_None;
1349 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1350 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1351
1352 req_mt.majortype = MEDIATYPE_Video;
1353 req_mt.subtype = MEDIASUBTYPE_I420;
1354 req_mt.formattype = GUID_NULL;
1355 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1356 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1357 ok(compare_media_types(&testsink.sink.pin.mt, source_mt), "Media types didn't match.\n");
1358 IFilterGraph2_Disconnect(graph, source);
1359 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1360
1361 req_mt.subtype = MEDIASUBTYPE_RGB32;
1362 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1363 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1364
1365 req_mt.subtype = GUID_NULL;
1366 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1367 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1368 ok(compare_media_types(&testsink.sink.pin.mt, source_mt), "Media types didn't match.\n");
1369 IFilterGraph2_Disconnect(graph, source);
1370 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1371
1372 req_mt.majortype = MEDIATYPE_Audio;
1373 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1374 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1375
1376 /* Test enumeration of sink media types. */
1377
1378 testsink.mt = &req_mt;
1379 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
1380 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1381
1382 req_mt.majortype = MEDIATYPE_Video;
1383 req_mt.subtype = MEDIASUBTYPE_I420;
1384 req_mt.formattype = FORMAT_VideoInfo;
1385 req_mt.lSampleSize = 444;
1386 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
1387 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1388 ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
1389
1390 IPin_Release(source);
1391 hr = IFilterGraph2_Disconnect(graph, sink);
1392 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1393 hr = IFilterGraph2_Disconnect(graph, sink);
1394 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1395 ok(testsource.source.pin.peer == sink, "Got peer %p.\n", testsource.source.pin.peer);
1396 IFilterGraph2_Disconnect(graph, &testsource.source.pin.IPin_iface);
1397
1398 CoTaskMemFree(req_mt.pbFormat);
1399 CoTaskMemFree(source_mt->pbFormat);
1401
1402 IAsyncReader_Release(testsource.reader);
1403 IPin_Release(sink);
1404 IMediaControl_Release(control);
1405 ref = IFilterGraph2_Release(graph);
1406 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1407 ref = IBaseFilter_Release(reader);
1408 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1409 ref = IBaseFilter_Release(filter);
1410 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1411 ref = IBaseFilter_Release(&testsource.filter.IBaseFilter_iface);
1412 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1413 ref = IBaseFilter_Release(&testsink.filter.IBaseFilter_iface);
1414 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1416 ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
1417}
static BOOL compare_media_types(const AM_MEDIA_TYPE *a, const AM_MEDIA_TYPE *b)
Definition: avisplit.c:39
static IBaseFilter * create_avi_splitter(void)
Definition: avisplit.c:30
static void testfilter_init(struct testfilter *filter)
Definition: avisplit.c:1092
const GUID IID_IAsyncReader
#define TRUE
Definition: types.h:120
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
#define GUID_NULL
Definition: ks.h:106
#define load_resource(a, b, c)
Definition: font.c:46
static void test_filter_state(void)
Definition: filtergraph.c:3441
HRESULT WINAPI CopyMediaType(AM_MEDIA_TYPE *pDest, const AM_MEDIA_TYPE *pSrc)
Definition: mediatype.c:150
void WINAPI FreeMediaType(AM_MEDIA_TYPE *pMediaType)
Definition: mediatype.c:165
Definition: dialog.c:52
IBaseFilter * filter
Definition: amstream.c:2175
AM_MEDIA_TYPE source_mt
const AM_MEDIA_TYPE * mt
Definition: avidec.c:799
IFilterGraph * graph
Definition: filtergraph.c:850
struct strmbase_source source
Definition: amstream.c:1020
struct strmbase_sink pin
Definition: filesource.c:1211
struct strmbase_filter filter
Definition: filesource.c:1210
const AM_MEDIA_TYPE * mt
Definition: filesource.c:1214
#define VFW_E_TYPE_NOT_ACCEPTED
Definition: vfwmsgs.h:81
#define VFW_E_NOT_STOPPED
Definition: vfwmsgs.h:75
#define VFW_E_NO_ACCEPTABLE_TYPES
Definition: vfwmsgs.h:46
#define VFW_E_NOT_CONNECTED
Definition: vfwmsgs.h:48
#define S_FALSE
Definition: winerror.h:3451

Referenced by START_TEST().

◆ test_enum_media_types()

static void test_enum_media_types ( void  )
static

Definition at line 685 of file avisplit.c.

686{
687 const WCHAR *filename = load_resource(L"test.avi");
690 IEnumMediaTypes *enum1, *enum2;
691 AM_MEDIA_TYPE *mts[2];
692 ULONG ref, count;
693 HRESULT hr;
694 IPin *pin;
695 BOOL ret;
696
697 IBaseFilter_FindPin(filter, L"input pin", &pin);
698
699 hr = IPin_EnumMediaTypes(pin, &enum1);
700 ok(hr == S_OK, "Got hr %#lx.\n", hr);
701
702 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
703 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
704
705 hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
706 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
707 ok(!count, "Got count %lu.\n", count);
708
709 hr = IEnumMediaTypes_Reset(enum1);
710 ok(hr == S_OK, "Got hr %#lx.\n", hr);
711
712 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
713 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
714
715 hr = IEnumMediaTypes_Clone(enum1, &enum2);
716 ok(hr == S_OK, "Got hr %#lx.\n", hr);
717
718 hr = IEnumMediaTypes_Skip(enum1, 1);
719 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
720
721 hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
722 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
723
724 IEnumMediaTypes_Release(enum1);
725 IEnumMediaTypes_Release(enum2);
726 IPin_Release(pin);
727
728 IBaseFilter_FindPin(filter, L"Stream 00", &pin);
729
730 hr = IPin_EnumMediaTypes(pin, &enum1);
731 ok(hr == S_OK, "Got hr %#lx.\n", hr);
732
733 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
734 ok(hr == S_OK, "Got hr %#lx.\n", hr);
735 CoTaskMemFree(mts[0]->pbFormat);
736 CoTaskMemFree(mts[0]);
737
738 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
739 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
740
741 hr = IEnumMediaTypes_Reset(enum1);
742 ok(hr == S_OK, "Got hr %#lx.\n", hr);
743
744 hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
745 ok(hr == S_OK, "Got hr %#lx.\n", hr);
746 ok(count == 1, "Got count %lu.\n", count);
747 CoTaskMemFree(mts[0]->pbFormat);
748 CoTaskMemFree(mts[0]);
749
750 hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
751 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
752 ok(!count, "Got count %lu.\n", count);
753
754 hr = IEnumMediaTypes_Reset(enum1);
755 ok(hr == S_OK, "Got hr %#lx.\n", hr);
756
757 hr = IEnumMediaTypes_Next(enum1, 2, mts, &count);
758 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
759 ok(count == 1, "Got count %lu.\n", count);
760 CoTaskMemFree(mts[0]->pbFormat);
761 CoTaskMemFree(mts[0]);
762
763 hr = IEnumMediaTypes_Reset(enum1);
764 ok(hr == S_OK, "Got hr %#lx.\n", hr);
765
766 hr = IEnumMediaTypes_Clone(enum1, &enum2);
767 ok(hr == S_OK, "Got hr %#lx.\n", hr);
768
769 hr = IEnumMediaTypes_Skip(enum1, 2);
770 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
771
772 hr = IEnumMediaTypes_Skip(enum1, 1);
773 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
774
775 hr = IEnumMediaTypes_Reset(enum1);
776 ok(hr == S_OK, "Got hr %#lx.\n", hr);
777
778 hr = IEnumMediaTypes_Skip(enum1, 1);
779 ok(hr == S_OK, "Got hr %#lx.\n", hr);
780
781 hr = IEnumMediaTypes_Skip(enum1, 1);
782 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
783
784 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
785 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
786
787 hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
788 ok(hr == S_OK, "Got hr %#lx.\n", hr);
789 CoTaskMemFree(mts[0]->pbFormat);
790 CoTaskMemFree(mts[0]);
791
792 IEnumMediaTypes_Release(enum1);
793 IEnumMediaTypes_Release(enum2);
794 IPin_Release(pin);
795
796 IFilterGraph2_Release(graph);
797 ref = IBaseFilter_Release(filter);
798 ok(!ref, "Got outstanding refcount %ld.\n", ref);
800 ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
801}
static IFilterGraph2 * connect_input(IBaseFilter *splitter, const WCHAR *filename)
Definition: avisplit.c:77
GLuint GLuint GLsizei count
Definition: gl.h:1545

Referenced by START_TEST().

◆ test_enum_pins()

static void test_enum_pins ( void  )
static

Definition at line 272 of file avisplit.c.

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

Referenced by START_TEST().

◆ test_filter_state()

static void test_filter_state ( IMediaControl *  control)
static

Definition at line 1104 of file avisplit.c.

1105{
1107 HRESULT hr;
1108
1109 hr = IMediaControl_GetState(control, 0, &state);
1110 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1111 ok(state == State_Stopped, "Got state %lu.\n", state);
1112
1113 hr = IMediaControl_Pause(control);
1114 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1115
1116 hr = IMediaControl_GetState(control, 0, &state);
1117 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1118 ok(state == State_Paused, "Got state %lu.\n", state);
1119
1120 hr = IMediaControl_Run(control);
1121 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1122
1123 hr = IMediaControl_GetState(control, 0, &state);
1124 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1125 ok(state == State_Running, "Got state %lu.\n", state);
1126
1127 hr = IMediaControl_Pause(control);
1128 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1129
1130 hr = IMediaControl_GetState(control, 0, &state);
1131 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1132 ok(state == State_Paused, "Got state %lu.\n", state);
1133
1134 hr = IMediaControl_Stop(control);
1135 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1136
1137 hr = IMediaControl_GetState(control, 0, &state);
1138 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1139 ok(state == State_Stopped, "Got state %lu.\n", state);
1140
1141 hr = IMediaControl_Run(control);
1142 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1143
1144 hr = IMediaControl_GetState(control, 0, &state);
1145 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1146 ok(state == State_Running, "Got state %lu.\n", state);
1147
1148 hr = IMediaControl_Stop(control);
1149 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1150
1151 hr = IMediaControl_GetState(control, 0, &state);
1152 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1153 ok(state == State_Stopped, "Got state %lu.\n", state);
1154}
static int state
Definition: maze.c:121
LONG OAFilterState
Definition: control.idl:30

◆ test_find_pin()

static void test_find_pin ( void  )
static

Definition at line 406 of file avisplit.c.

407{
408 const WCHAR *filename = load_resource(L"test.avi");
412 IPin *pin, *pin2;
413 HRESULT hr;
414 ULONG ref;
415 BOOL ret;
416
417 hr = IBaseFilter_FindPin(filter, L"input pin", &pin);
418 ok(hr == S_OK, "Got hr %#lx.\n", hr);
419 IPin_Release(pin);
420
421 hr = IBaseFilter_FindPin(filter, L"Stream 00", &pin);
422 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
423
424 hr = IBaseFilter_FindPin(filter, L"Input", &pin);
425 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
426
428
429 hr = IBaseFilter_EnumPins(filter, &enum_pins);
430 ok(hr == S_OK, "Got hr %#lx.\n", hr);
431
432 hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
433 ok(hr == S_OK, "Got hr %#lx.\n", hr);
434
435 hr = IBaseFilter_FindPin(filter, L"Stream 00", &pin);
436 ok(hr == S_OK, "Got hr %#lx.\n", hr);
437 ok(pin == pin2, "Expected pin %p, got %p.\n", pin2, pin);
438 IPin_Release(pin);
439 IPin_Release(pin2);
440
441 hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
442 ok(hr == S_OK, "Got hr %#lx.\n", hr);
443
444 hr = IBaseFilter_FindPin(filter, L"input pin", &pin);
445 ok(hr == S_OK, "Got hr %#lx.\n", hr);
446 ok(pin == pin2, "Expected pin %p, got %p.\n", pin2, pin);
447 IPin_Release(pin);
448 IPin_Release(pin2);
449
450 IEnumPins_Release(enum_pins);
451 IFilterGraph2_Release(graph);
452 ref = IBaseFilter_Release(filter);
453 ok(!ref, "Got outstanding refcount %ld.\n", ref);
455 ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
456}
#define VFW_E_NOT_FOUND
Definition: vfwmsgs.h:61

Referenced by START_TEST().

◆ test_interfaces()

static void test_interfaces ( void  )
static

Definition at line 123 of file avisplit.c.

124{
125 const WCHAR *filename = load_resource(L"test.avi");
128 IPin *pin;
129
131 check_interface(filter, &IID_IMediaFilter, TRUE);
134
135 check_interface(filter, &IID_IAMFilterMiscFlags, FALSE);
136 check_interface(filter, &IID_IBasicAudio, FALSE);
137 check_interface(filter, &IID_IBasicVideo, FALSE);
139 check_interface(filter, &IID_IMediaPosition, FALSE);
140 check_interface(filter, &IID_IMediaSeeking, FALSE);
143 check_interface(filter, &IID_IQualityControl, FALSE);
144 check_interface(filter, &IID_IQualProp, FALSE);
145 check_interface(filter, &IID_IReferenceClock, FALSE);
146 check_interface(filter, &IID_IVideoWindow, FALSE);
147
148 IBaseFilter_FindPin(filter, L"input pin", &pin);
149
152
154 check_interface(pin, &IID_IMemInputPin, FALSE);
155 check_interface(pin, &IID_IMediaPosition, FALSE);
156 check_interface(pin, &IID_IMediaSeeking, FALSE);
157
158 IPin_Release(pin);
159
160 IBaseFilter_FindPin(filter, L"Stream 00", &pin);
161
162 todo_wine check_interface(pin, &IID_IMediaPosition, TRUE);
163 check_interface(pin, &IID_IMediaSeeking, TRUE);
165 check_interface(pin, &IID_IQualityControl, TRUE);
167
170
171 IPin_Release(pin);
172
173 IBaseFilter_Release(filter);
174 IFilterGraph2_Release(graph);
176}
#define check_interface(a, b, c)
Definition: avisplit.c:108
const GUID IID_IKsPropertySet
Definition: controlnode.cpp:13
#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

Referenced by START_TEST().

◆ test_media_types()

static void test_media_types ( void  )
static

Definition at line 532 of file avisplit.c.

533{
534 static const VIDEOINFOHEADER expect_vih =
535 {
536 .AvgTimePerFrame = 1000 * 10000,
537 .bmiHeader.biSize = sizeof(BITMAPINFOHEADER),
538 .bmiHeader.biWidth = 32,
539 .bmiHeader.biHeight = 24,
540 .bmiHeader.biPlanes = 1,
541 .bmiHeader.biBitCount = 12,
542 .bmiHeader.biCompression = mmioFOURCC('I','4','2','0'),
543 .bmiHeader.biSizeImage = 32 * 24 * 12 / 8,
544 };
545
546 const WCHAR *filename = load_resource(L"test.avi");
548 AM_MEDIA_TYPE mt = {{0}}, *pmt;
549 IEnumMediaTypes *enummt;
550 VIDEOINFOHEADER *vih;
552 HRESULT hr;
553 ULONG ref;
554 IPin *pin;
555 BOOL ret;
556
557 IBaseFilter_FindPin(filter, L"input pin", &pin);
558
559 hr = IPin_EnumMediaTypes(pin, &enummt);
560 ok(hr == S_OK, "Got hr %#lx.\n", hr);
561
562 hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
563 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
564
565 IEnumMediaTypes_Release(enummt);
566
567 mt.majortype = MEDIATYPE_Stream;
568 mt.subtype = MEDIASUBTYPE_Avi;
569 hr = IPin_QueryAccept(pin, &mt);
570 ok(hr == S_OK, "Got hr %#lx.\n", hr);
571
572 mt.bFixedSizeSamples = TRUE;
573 mt.bTemporalCompression = TRUE;
574 mt.lSampleSize = 123;
575 mt.formattype = FORMAT_WaveFormatEx;
576 hr = IPin_QueryAccept(pin, &mt);
577 ok(hr == S_OK, "Got hr %#lx.\n", hr);
578
579 mt.majortype = GUID_NULL;
580 hr = IPin_QueryAccept(pin, &mt);
581 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
582 mt.majortype = MEDIATYPE_Stream;
583
584 mt.subtype = GUID_NULL;
585 hr = IPin_QueryAccept(pin, &mt);
586 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
587 mt.subtype = MEDIASUBTYPE_Avi;
588
590
591 hr = IPin_EnumMediaTypes(pin, &enummt);
592 ok(hr == S_OK, "Got hr %#lx.\n", hr);
593
594 hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
595 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
596
597 IEnumMediaTypes_Release(enummt);
598 IPin_Release(pin);
599
600 IBaseFilter_FindPin(filter, L"Stream 00", &pin);
601
602 hr = IPin_EnumMediaTypes(pin, &enummt);
603 ok(hr == S_OK, "Got hr %#lx.\n", hr);
604
605 hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
606 ok(hr == S_OK, "Got hr %#lx.\n", hr);
607 ok(IsEqualGUID(&pmt->majortype, &MEDIATYPE_Video), "Got major type %s\n",
608 wine_dbgstr_guid(&pmt->majortype));
609 ok(IsEqualGUID(&pmt->subtype, &MEDIASUBTYPE_I420), "Got subtype %s\n",
610 wine_dbgstr_guid(&pmt->subtype));
611 ok(!pmt->bFixedSizeSamples, "Got fixed size %d.\n", pmt->bFixedSizeSamples);
612 todo_wine ok(!pmt->bTemporalCompression, "Got temporal compression %d.\n", pmt->bTemporalCompression);
613 ok(pmt->lSampleSize == 1, "Got sample size %lu.\n", pmt->lSampleSize);
614 ok(IsEqualGUID(&pmt->formattype, &FORMAT_VideoInfo), "Got format type %s.\n",
615 wine_dbgstr_guid(&pmt->formattype));
616 ok(!pmt->pUnk, "Got pUnk %p.\n", pmt->pUnk);
617 ok(pmt->cbFormat == sizeof(VIDEOINFOHEADER), "Got format size %lu.\n", pmt->cbFormat);
618 ok(!memcmp(pmt->pbFormat, &expect_vih, sizeof(VIDEOINFOHEADER)), "Format blocks didn't match.\n");
619
620 hr = IPin_QueryAccept(pin, pmt);
621 ok(hr == S_OK, "Got hr %#lx.\n", hr);
622
623 pmt->bFixedSizeSamples = TRUE;
624 pmt->bTemporalCompression = TRUE;
625 pmt->lSampleSize = 123;
626 hr = IPin_QueryAccept(pin, pmt);
627 ok(hr == S_OK, "Got hr %#lx.\n", hr);
628
629 pmt->majortype = GUID_NULL;
630 hr = IPin_QueryAccept(pin, pmt);
631 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
632 pmt->majortype = MEDIATYPE_Video;
633
634 pmt->subtype = GUID_NULL;
635 hr = IPin_QueryAccept(pin, pmt);
636 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
637 pmt->subtype = MEDIASUBTYPE_I420;
638
639 pmt->formattype = GUID_NULL;
640 hr = IPin_QueryAccept(pin, pmt);
641 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
642 pmt->formattype = FORMAT_None;
643 hr = IPin_QueryAccept(pin, pmt);
644 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
645 pmt->formattype = FORMAT_VideoInfo;
646
647 vih = (VIDEOINFOHEADER *)pmt->pbFormat;
648
649 vih->AvgTimePerFrame = 10000;
650 hr = IPin_QueryAccept(pin, pmt);
651 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
652 vih->AvgTimePerFrame = 1000 * 10000;
653
654 vih->dwBitRate = 1000000;
655 hr = IPin_QueryAccept(pin, pmt);
656 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
657 vih->dwBitRate = 0;
658
659 SetRect(&vih->rcSource, 0, 0, 32, 24);
660 hr = IPin_QueryAccept(pin, pmt);
661 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
662 SetRect(&vih->rcSource, 0, 0, 0, 0);
663
665 hr = IPin_QueryAccept(pin, pmt);
666 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
667 vih->bmiHeader.biCompression = mmioFOURCC('I','4','2','0');
668
669 CoTaskMemFree(pmt->pbFormat);
670 CoTaskMemFree(pmt);
671
672 hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
673 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
674
675 IEnumMediaTypes_Release(enummt);
676 IPin_Release(pin);
677
678 IFilterGraph2_Release(graph);
679 ref = IBaseFilter_Release(filter);
680 ok(!ref, "Got outstanding refcount %ld.\n", ref);
682 ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
683}
#define mmioFOURCC(c0, c1, c2, c3)
Definition: mmsystem.h:38
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
DWORD biCompression
Definition: amvideo.idl:35
BITMAPINFOHEADER bmiHeader
Definition: amvideo.idl:189
REFERENCE_TIME AvgTimePerFrame
Definition: amvideo.idl:187
#define BI_RGB
Definition: uefivid.c:46

Referenced by START_TEST().

◆ test_pin_info()

static void test_pin_info ( void  )
static

Definition at line 458 of file avisplit.c.

459{
460 const WCHAR *filename = load_resource(L"test.avi");
466 HRESULT hr;
467 WCHAR *id;
468 IPin *pin;
469 BOOL ret;
470
472
473 hr = IBaseFilter_FindPin(filter, L"input pin", &pin);
474 ok(hr == S_OK, "Got hr %#lx.\n", hr);
476 ref = get_refcount(pin);
477 ok(ref == expect_ref, "Got unexpected refcount %ld.\n", ref);
478
479 hr = IPin_QueryPinInfo(pin, &info);
480 ok(hr == S_OK, "Got hr %#lx.\n", hr);
481 ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
482 ok(info.dir == PINDIR_INPUT, "Got direction %d.\n", info.dir);
483 ok(!wcscmp(info.achName, L"input pin"), "Got name %s.\n", wine_dbgstr_w(info.achName));
485 ok(ref == expect_ref + 1, "Got unexpected refcount %ld.\n", ref);
486 ref = get_refcount(pin);
487 ok(ref == expect_ref + 1, "Got unexpected refcount %ld.\n", ref);
488 IBaseFilter_Release(info.pFilter);
489
490 hr = IPin_QueryDirection(pin, &dir);
491 ok(hr == S_OK, "Got hr %#lx.\n", hr);
492 ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir);
493
494 hr = IPin_QueryId(pin, &id);
495 ok(hr == S_OK, "Got hr %#lx.\n", hr);
496 ok(!wcscmp(id, L"input pin"), "Got id %s.\n", wine_dbgstr_w(id));
497 CoTaskMemFree(id);
498
499 IPin_Release(pin);
500
501 hr = IBaseFilter_FindPin(filter, L"Stream 00", &pin);
502 ok(hr == S_OK, "Got hr %#lx.\n", hr);
503
505 check_interface(pin, &IID_IMediaSeeking, TRUE);
506
507 hr = IPin_QueryPinInfo(pin, &info);
508 ok(hr == S_OK, "Got hr %#lx.\n", hr);
509 ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
510 ok(info.dir == PINDIR_OUTPUT, "Got direction %d.\n", info.dir);
511 ok(!wcscmp(info.achName, L"Stream 00"), "Got name %s.\n", wine_dbgstr_w(info.achName));
512 IBaseFilter_Release(info.pFilter);
513
514 hr = IPin_QueryDirection(pin, &dir);
515 ok(hr == S_OK, "Got hr %#lx.\n", hr);
516 ok(dir == PINDIR_OUTPUT, "Got direction %d.\n", dir);
517
518 hr = IPin_QueryId(pin, &id);
519 ok(hr == S_OK, "Got hr %#lx.\n", hr);
520 ok(!wcscmp(id, L"Stream 00"), "Got id %s.\n", wine_dbgstr_w(id));
521 CoTaskMemFree(id);
522
523 IPin_Release(pin);
524
525 IFilterGraph2_Release(graph);
526 ref = IBaseFilter_Release(filter);
527 ok(!ref, "Got outstanding refcount %ld.\n", ref);
529 ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
530}
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 1476 of file avisplit.c.

1477{
1478 LONGLONG time, current, stop, prev_stop, earliest, latest, duration;
1479 const WCHAR *filename = load_resource(L"test.avi");
1482 IMediaSeeking *seeking;
1483 unsigned int i;
1484 double rate;
1485 GUID format;
1486 HRESULT hr;
1487 DWORD caps;
1488 ULONG ref;
1489 IPin *pin;
1490 BOOL ret;
1491
1492 static const struct
1493 {
1494 const GUID *guid;
1495 HRESULT hr;
1496 }
1497 format_tests[] =
1498 {
1499 {&TIME_FORMAT_MEDIA_TIME, S_OK},
1500 {&TIME_FORMAT_FRAME, S_OK},
1501
1502 {&TIME_FORMAT_BYTE, S_FALSE},
1503 {&TIME_FORMAT_NONE, S_FALSE},
1504 {&TIME_FORMAT_SAMPLE, S_FALSE},
1505 {&TIME_FORMAT_FIELD, S_FALSE},
1506 {&testguid, S_FALSE},
1507 };
1508
1509 IBaseFilter_FindPin(filter, L"Stream 00", &pin);
1510 IPin_QueryInterface(pin, &IID_IMediaSeeking, (void **)&seeking);
1511
1512 hr = IMediaSeeking_GetCapabilities(seeking, &caps);
1513 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1516 | AM_SEEKING_CanGetDuration), "Got caps %#lx.\n", caps);
1517
1519 hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
1520 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1521 ok(caps == (AM_SEEKING_CanSeekAbsolute | AM_SEEKING_CanSeekForwards), "Got caps %#lx.\n", caps);
1522
1524 hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
1525 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1526 ok(caps == AM_SEEKING_CanSeekAbsolute, "Got caps %#lx.\n", caps);
1527
1529 hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
1530 ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
1531 ok(!caps, "Got caps %#lx.\n", caps);
1532
1533 caps = 0;
1534 hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
1535 ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
1536 ok(!caps, "Got caps %#lx.\n", caps);
1537
1538 for (i = 0; i < ARRAY_SIZE(format_tests); ++i)
1539 {
1540 hr = IMediaSeeking_IsFormatSupported(seeking, format_tests[i].guid);
1541 todo_wine_if(i == 1) ok(hr == format_tests[i].hr, "Got hr %#lx for format %s.\n",
1542 hr, wine_dbgstr_guid(format_tests[i].guid));
1543 }
1544
1545 hr = IMediaSeeking_QueryPreferredFormat(seeking, &format);
1546 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1547 ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format));
1548
1549 hr = IMediaSeeking_GetTimeFormat(seeking, &format);
1550 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1551 ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format));
1552
1553 hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME);
1554 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1555 hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_FRAME);
1556 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1557
1558 hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_SAMPLE);
1559 ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
1560 hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_FRAME);
1561 todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
1562
1563 hr = IMediaSeeking_GetTimeFormat(seeking, &format);
1564 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1565 todo_wine ok(IsEqualGUID(&format, &TIME_FORMAT_FRAME), "Got format %s.\n", wine_dbgstr_guid(&format));
1566
1567 hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME);
1568 todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1569 hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_FRAME);
1570 todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
1571
1572 hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME);
1573 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1574
1575 duration = 0;
1576 hr = IMediaSeeking_GetDuration(seeking, &duration);
1577 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1578 ok(duration == 50000000, "Got duration %I64d.\n", duration);
1579
1580 stop = current = 0xdeadbeef;
1581 hr = IMediaSeeking_GetStopPosition(seeking, &stop);
1582 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1583 ok(stop == duration, "Expected time %s, got %s.\n",
1584 wine_dbgstr_longlong(duration), wine_dbgstr_longlong(stop));
1585 hr = IMediaSeeking_GetCurrentPosition(seeking, &current);
1586 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1587 ok(!current, "Got time %s.\n", wine_dbgstr_longlong(current));
1588 stop = current = 0xdeadbeef;
1589 hr = IMediaSeeking_GetPositions(seeking, &current, &stop);
1590 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1591 ok(!current, "Got time %s.\n", wine_dbgstr_longlong(current));
1592 ok(stop == duration, "Expected time %s, got %s.\n",
1593 wine_dbgstr_longlong(duration), wine_dbgstr_longlong(stop));
1594
1595 time = 0xdeadbeef;
1596 hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &TIME_FORMAT_MEDIA_TIME, 0x123456789a, NULL);
1597 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1598 ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time));
1599 time = 0xdeadbeef;
1600 hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, NULL, 0x123456789a, &TIME_FORMAT_MEDIA_TIME);
1601 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1602 ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time));
1603 time = 0xdeadbeef;
1604 hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, NULL, 123, &TIME_FORMAT_FRAME);
1605 todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
1606 todo_wine ok(time == 123 * 10000000, "Got time %s.\n", wine_dbgstr_longlong(time));
1607
1608 earliest = latest = 0xdeadbeef;
1609 hr = IMediaSeeking_GetAvailable(seeking, &earliest, &latest);
1610 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1611 ok(!earliest, "Got time %s.\n", wine_dbgstr_longlong(earliest));
1612 ok(latest == duration, "Expected time %s, got %s.\n",
1613 wine_dbgstr_longlong(duration), wine_dbgstr_longlong(latest));
1614
1615 rate = 0;
1616 hr = IMediaSeeking_GetRate(seeking, &rate);
1617 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1618 ok(rate == 1.0, "Got rate %.16e.\n", rate);
1619
1620 hr = IMediaSeeking_SetRate(seeking, 200.0);
1621 todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
1622 rate = 0;
1623 hr = IMediaSeeking_GetRate(seeking, &rate);
1624 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1625 todo_wine ok(rate == 200.0, "Got rate %.16e.\n", rate);
1626
1627 hr = IMediaSeeking_SetRate(seeking, -1.0);
1628 todo_wine ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
1629
1630 hr = IMediaSeeking_GetPreroll(seeking, &time);
1631 todo_wine ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
1632
1633 current = 1500 * 10000;
1634 stop = 3500 * 10000;
1635 hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning,
1636 &stop, AM_SEEKING_AbsolutePositioning);
1637 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1638 ok(current == 1500 * 10000, "Got time %s.\n", wine_dbgstr_longlong(current));
1639 ok(stop == 3500 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
1640
1641 stop = current = 0xdeadbeef;
1642 hr = IMediaSeeking_GetPositions(seeking, &current, &stop);
1643 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1644 /* Native snaps to the nearest frame. */
1645 ok(current > 0 && current < duration, "Got time %s.\n", wine_dbgstr_longlong(current));
1646 ok(stop > 0 && stop < duration && stop > current, "Got time %s.\n", wine_dbgstr_longlong(stop));
1647
1648 current = 1500 * 10000;
1649 stop = 3500 * 10000;
1650 hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning | AM_SEEKING_ReturnTime,
1651 &stop, AM_SEEKING_AbsolutePositioning | AM_SEEKING_ReturnTime);
1652 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1653 ok(current > 0 && current < duration, "Got time %s.\n", wine_dbgstr_longlong(current));
1654 ok(stop > 0 && stop < duration && stop > current, "Got time %s.\n", wine_dbgstr_longlong(stop));
1655
1656 hr = IMediaSeeking_GetStopPosition(seeking, &prev_stop);
1657 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1658
1659 current = 0;
1660 hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning,
1661 NULL, AM_SEEKING_NoPositioning);
1662 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1663
1664 stop = current = 0xdeadbeef;
1665 hr = IMediaSeeking_GetPositions(seeking, &current, &stop);
1666 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1667 ok(!current, "Got time %s.\n", wine_dbgstr_longlong(current));
1668 ok(stop == prev_stop, "Expected time %s, got %s.\n",
1669 wine_dbgstr_longlong(prev_stop), wine_dbgstr_longlong(stop));
1670
1671 IMediaSeeking_Release(seeking);
1672 IPin_Release(pin);
1673 IFilterGraph2_Release(graph);
1674 ref = IBaseFilter_Release(filter);
1675 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1676 ret = DeleteFileW(filename);
1677 ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
1678}
unsigned int rate
Definition: audiorecord.c:87
static const GUID testguid
Definition: avisplit.c:28
@ AM_SEEKING_CanGetDuration
Definition: axcore.idl:609
@ AM_SEEKING_CanGetCurrentPos
Definition: axcore.idl:607
@ AM_SEEKING_CanSeekBackwards
Definition: axcore.idl:606
@ 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

Referenced by START_TEST().

◆ test_streaming()

static void test_streaming ( const WCHAR *  resname)
static

Definition at line 1680 of file avisplit.c.

1681{
1682 const WCHAR *filename = load_resource(resname);
1685 struct testfilter testsink;
1687 IMediaSeeking *seeking;
1688 IMediaControl *control;
1689 IPin *source;
1690 HRESULT hr;
1691 ULONG ref;
1692 DWORD ret;
1693
1694 winetest_push_context("File %ls", resname);
1695
1697 IFilterGraph2_AddFilter(graph, &testsink.filter.IBaseFilter_iface, L"sink");
1698 IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
1699 IBaseFilter_FindPin(filter, L"Stream 00", &source);
1700 IPin_QueryInterface(source, &IID_IMediaSeeking, (void **)&seeking);
1701
1702 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
1703 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1704
1705 ok(WaitForSingleObject(testsink.eos_event, 100) == WAIT_TIMEOUT, "Expected timeout.\n");
1706
1707 hr = IMediaControl_Pause(control);
1708 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1709
1710 ok(!WaitForSingleObject(testsink.eos_event, 1000), "Did not receive EOS.\n");
1711 ok(WaitForSingleObject(testsink.eos_event, 100) == WAIT_TIMEOUT, "Got more than one EOS.\n");
1712 ok(testsink.sample_count, "Expected at least one sample.\n");
1713
1714 hr = IMediaControl_Stop(control);
1715 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1716 hr = IMediaControl_Pause(control);
1717 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1718
1719 ok(!WaitForSingleObject(testsink.eos_event, 1000), "Did not receive EOS.\n");
1720 ok(WaitForSingleObject(testsink.eos_event, 100) == WAIT_TIMEOUT, "Got more than one EOS.\n");
1721 ok(testsink.sample_count, "Expected at least one sample.\n");
1722
1723 testsink.new_segment_count = testsink.sample_count = testsink.eos_count = 0;
1724 testsink.segment_start = 1500 * 10000;
1725 testsink.segment_end = 3500 * 10000;
1726 hr = IMediaSeeking_SetPositions(seeking, &testsink.segment_start, AM_SEEKING_AbsolutePositioning,
1728 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1729
1730 ok(!WaitForSingleObject(testsink.eos_event, 1000), "Did not receive EOS.\n");
1731 ok(WaitForSingleObject(testsink.eos_event, 100) == WAIT_TIMEOUT, "Got more than one EOS.\n");
1732 ok(testsink.sample_count, "Expected at least one sample.\n");
1733
1734 start = end = 0xdeadbeef;
1735 hr = IMediaSeeking_GetPositions(seeking, &start, &end);
1736 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1737 ok(start == testsink.seek_start, "Expected start position %I64u, got %I64u.\n", testsink.seek_start, start);
1738 ok(end == testsink.seek_end, "Expected end position %I64u, got %I64u.\n", testsink.seek_end, end);
1739
1740 hr = IMediaControl_Stop(control);
1741 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1742 hr = IMediaControl_Pause(control);
1743 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1744
1745 ok(!WaitForSingleObject(testsink.eos_event, 1000), "Did not receive EOS.\n");
1746 ok(WaitForSingleObject(testsink.eos_event, 100) == WAIT_TIMEOUT, "Got more than one EOS.\n");
1747 ok(testsink.sample_count, "Expected at least one sample.\n");
1748
1749 start = end = 0xdeadbeef;
1750 hr = IMediaSeeking_GetPositions(seeking, &start, &end);
1751 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1752 ok(start == testsink.seek_start, "Expected start position %I64u, got %I64u.\n", testsink.seek_start, start);
1753 ok(end == testsink.seek_end, "Expected end position %I64u, got %I64u.\n", testsink.seek_end, end);
1754
1755 IMediaSeeking_Release(seeking);
1756 IPin_Release(source);
1757 IMediaControl_Release(control);
1758 ref = IFilterGraph2_Release(graph);
1759 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1760 ref = IBaseFilter_Release(filter);
1761 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1762 ref = IBaseFilter_Release(&testsink.filter.IBaseFilter_iface);
1763 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1765 ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
1766
1768}
@ AM_SEEKING_AbsolutePositioning
Definition: axcore.idl:592
#define WAIT_TIMEOUT
Definition: dderror.h:14
LONGLONG REFERENCE_TIME
Definition: dmusicks.h:9
GLuint start
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl void winetest_pop_context(void)
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl winetest_push_context(const char *fmt,...) __WINE_PRINTF_ATTR(1
Definition: test.h:539
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82

◆ test_unconnected_filter_state()

static void test_unconnected_filter_state ( void  )
static

Definition at line 1419 of file avisplit.c.

1420{
1422 FILTER_STATE state;
1423 HRESULT hr;
1424 ULONG ref;
1425
1426 hr = IBaseFilter_GetState(filter, 0, &state);
1427 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1428 ok(state == State_Stopped, "Got state %u.\n", state);
1429
1430 hr = IBaseFilter_Pause(filter);
1431 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1432
1433 hr = IBaseFilter_GetState(filter, 0, &state);
1434 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1435 ok(state == State_Paused, "Got state %u.\n", state);
1436
1437 hr = IBaseFilter_Run(filter, 0);
1438 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1439
1440 hr = IBaseFilter_GetState(filter, 0, &state);
1441 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1442 ok(state == State_Running, "Got state %u.\n", state);
1443
1444 hr = IBaseFilter_Pause(filter);
1445 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1446
1447 hr = IBaseFilter_GetState(filter, 0, &state);
1448 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1449 ok(state == State_Paused, "Got state %u.\n", state);
1450
1451 hr = IBaseFilter_Stop(filter);
1452 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1453
1454 hr = IBaseFilter_GetState(filter, 0, &state);
1455 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1456 ok(state == State_Stopped, "Got state %u.\n", state);
1457
1458 hr = IBaseFilter_Run(filter, 0);
1459 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1460
1461 hr = IBaseFilter_GetState(filter, 0, &state);
1462 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1463 ok(state == State_Running, "Got state %u.\n", state);
1464
1465 hr = IBaseFilter_Stop(filter);
1466 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1467
1468 hr = IBaseFilter_GetState(filter, 0, &state);
1469 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1470 ok(state == State_Stopped, "Got state %u.\n", state);
1471
1472 ref = IBaseFilter_Release(filter);
1473 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1474}

Referenced by START_TEST().

◆ testfilter_destroy()

static void testfilter_destroy ( struct strmbase_filter *  iface)
static

Definition at line 830 of file avisplit.c.

831{
833 CloseHandle(filter->eos_event);
837}
static struct testfilter * impl_from_strmbase_filter(struct strmbase_filter *iface)
Definition: avisplit.c:815
void strmbase_sink_cleanup(struct strmbase_sink *pin)
Definition: pin.c:1185
void strmbase_filter_cleanup(struct strmbase_filter *filter)
Definition: filter.c:540
void strmbase_source_cleanup(struct strmbase_source *pin)
Definition: pin.c:778
IBaseFilter * filter
Definition: filtergraph.c:75

◆ testfilter_get_pin()

static struct strmbase_pin * testfilter_get_pin ( struct strmbase_filter *  iface,
unsigned int  index 
)
static

Definition at line 820 of file avisplit.c.

821{
823 if (!index)
824 return &filter->source.pin;
825 else if (index == 1)
826 return &filter->sink.pin;
827 return NULL;
828}
GLuint index
Definition: glext.h:6031

◆ testfilter_init()

static void testfilter_init ( struct testfilter *  filter)
static

Definition at line 1092 of file avisplit.c.

1093{
1094 static const GUID clsid = {0xabacab};
1095 memset(filter, 0, sizeof(*filter));
1097 strmbase_source_init(&filter->source, &filter->filter, L"source", &testsource_ops);
1099 filter->IAsyncReader_iface.lpVtbl = &async_reader_vtbl;
1100 filter->eos_event = CreateEventW(NULL, FALSE, FALSE, NULL);
1101 filter->segment_end = 50000000;
1102}
static const struct strmbase_sink_ops testsink_ops
Definition: avisplit.c:1005
static const struct IAsyncReaderVtbl async_reader_vtbl
Definition: avisplit.c:1077
static const struct strmbase_source_ops testsource_ops
Definition: avisplit.c:889
static const struct strmbase_filter_ops testfilter_ops
Definition: avisplit.c:849
const CLSID * clsid
Definition: msctf.cpp:50
#define memset(x, y, z)
Definition: compat.h:39
void strmbase_source_init(struct strmbase_source *pin, struct strmbase_filter *filter, const WCHAR *name, const struct strmbase_source_ops *func_table)
Definition: pin.c:765
void strmbase_sink_init(struct strmbase_sink *pin, struct strmbase_filter *filter, const WCHAR *name, const struct strmbase_sink_ops *ops, IMemAllocator *allocator)
Definition: pin.c:1168
void strmbase_filter_init(struct strmbase_filter *filter, IUnknown *outer, const CLSID *clsid, const struct strmbase_filter_ops *func_table)
Definition: filter.c:517
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:587

Referenced by test_connect_pin(), and test_streaming().

◆ testfilter_init_stream()

static HRESULT testfilter_init_stream ( struct strmbase_filter *  iface)
static

Definition at line 839 of file avisplit.c.

840{
842
843 filter->new_segment_count = 0;
844 filter->eos_count = 0;
845 filter->sample_count = 0;
846 return S_OK;
847}
LONG eos_count
Definition: filter.c:181

◆ testsink_connect()

static HRESULT testsink_connect ( struct strmbase_sink *  iface,
IPin *  peer,
const AM_MEDIA_TYPE *  mt 
)
static

Definition at line 919 of file avisplit.c.

920{
921 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
922 AM_MEDIA_TYPE mt2;
923 IPin *peer2;
924 HRESULT hr;
925
926 hr = IPin_ConnectedTo(peer, &peer2);
927 ok(hr == S_OK, "Got hr %#lx.\n", hr);
928 ok(peer2 == &iface->pin.IPin_iface, "Peer didn't match.\n");
929 IPin_Release(peer2);
930
931 hr = IPin_ConnectionMediaType(peer, &mt2);
932 ok(hr == S_OK, "Got hr %#lx.\n", hr);
933 ok(compare_media_types(mt, &mt2), "Media types didn't match.\n");
934 FreeMediaType(&mt2);
935
936 if (filter->mt && !IsEqualGUID(&mt->majortype, &filter->mt->majortype))
938 return S_OK;
939}
struct strmbase_pin pin
Definition: strmbase.h:106

◆ testsink_eos()

static HRESULT testsink_eos ( struct strmbase_sink *  iface)
static

Definition at line 968 of file avisplit.c.

969{
970 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
971
972 if (winetest_debug > 1)
973 trace("%04lx: Got EOS.\n", GetCurrentThreadId());
974
975 ok(!filter->eos_count, "Got %u EOS events.\n", filter->eos_count + 1);
976 ++filter->eos_count;
977 SetEvent(filter->eos_event);
978 return S_OK;
979}
#define trace
Definition: atltest.h:70
int winetest_debug
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:669
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459

◆ testsink_get_media_type()

static HRESULT testsink_get_media_type ( struct strmbase_pin *  iface,
unsigned int  index,
AM_MEDIA_TYPE *  mt 
)
static

Definition at line 908 of file avisplit.c.

909{
911 if (!index && filter->mt)
912 {
913 CopyMediaType(mt, filter->mt);
914 return S_OK;
915 }
916 return VFW_S_NO_MORE_ITEMS;
917}
struct strmbase_filter * filter
Definition: strmbase.h:58
#define VFW_S_NO_MORE_ITEMS
Definition: vfwmsgs.h:19

◆ testsink_new_segment()

static HRESULT testsink_new_segment ( struct strmbase_sink *  iface,
REFERENCE_TIME  start,
REFERENCE_TIME  end,
double  rate 
)
static

Definition at line 981 of file avisplit.c.

983{
984 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
985 IMediaSeeking *seeking;
986 HRESULT hr;
987
988 if (winetest_debug > 1)
989 trace("%04lx: Got segment with timestamps %I64d-%I64d.\n", GetCurrentThreadId(), start, end);
990
991 ++filter->new_segment_count;
992
993 IPin_QueryInterface(iface->pin.peer, &IID_IMediaSeeking, (void **)&seeking);
994 hr = IMediaSeeking_GetPositions(seeking, &filter->seek_start, &filter->seek_end);
995 ok(hr == S_OK, "Got hr %#lx.\n", hr);
996 IMediaSeeking_Release(seeking);
997
998 ok(start == filter->segment_start, "Expected start %I64d, got %I64d.\n", filter->segment_start, start);
999 ok(end == filter->segment_end, "Expected end %I64d, got %I64d.\n", filter->segment_end, end);
1000 ok(rate == 1.0, "Got rate %.16e.\n", rate);
1001
1002 return S_OK;
1003}

◆ testsink_query_interface()

static HRESULT testsink_query_interface ( struct strmbase_pin *  iface,
REFIID  iid,
void **  out 
)
static

Definition at line 895 of file avisplit.c.

896{
898
899 if (IsEqualGUID(iid, &IID_IMemInputPin))
900 *out = &filter->sink.IMemInputPin_iface;
901 else
902 return E_NOINTERFACE;
903
904 IUnknown_AddRef((IUnknown *)*out);
905 return S_OK;
906}

◆ testsink_Receive()

static HRESULT WINAPI testsink_Receive ( struct strmbase_sink *  iface,
IMediaSample *  sample 
)
static

Definition at line 941 of file avisplit.c.

942{
943 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
945 IMediaSeeking *seeking;
946 HRESULT hr;
947
948 hr = IMediaSample_GetTime(sample, &start, &end);
949 todo_wine_if (hr == VFW_S_NO_STOP_TIME) ok(hr == S_OK, "Got hr %#lx.\n", hr);
950
951 if (winetest_debug > 1)
952 trace("%04lx: Got sample with timestamps %I64d-%I64d.\n", GetCurrentThreadId(), start, end);
953
954 ok(filter->new_segment_count, "Expected NewSegment() before Receive().\n");
955
956 IPin_QueryInterface(iface->pin.peer, &IID_IMediaSeeking, (void **)&seeking);
957 hr = IMediaSeeking_GetPositions(seeking, &start, &end);
958 ok(hr == S_OK, "Got hr %#lx.\n", hr);
959 ok(start == filter->seek_start, "Expected start position %I64u, got %I64u.\n", filter->seek_start, start);
960 ok(end == filter->seek_end, "Expected end position %I64u, got %I64u.\n", filter->seek_end, end);
961 IMediaSeeking_Release(seeking);
962
963 ok(!filter->eos_count, "Got a sample after EOS.\n");
964 ++filter->sample_count;
965 return S_OK;
966}
#define VFW_S_NO_STOP_TIME
Definition: vfwmsgs.h:34

◆ testsource_AttemptConnection()

static HRESULT WINAPI testsource_AttemptConnection ( struct strmbase_source *  iface,
IPin *  peer,
const AM_MEDIA_TYPE *  mt 
)
static

Definition at line 869 of file avisplit.c.

871{
872 HRESULT hr;
873
874 iface->pin.peer = peer;
875 IPin_AddRef(peer);
876 CopyMediaType(&iface->pin.mt, mt);
877
878 if (FAILED(hr = IPin_ReceiveConnection(peer, &iface->pin.IPin_iface, mt)))
879 {
880 ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
881 IPin_Release(peer);
882 iface->pin.peer = NULL;
883 FreeMediaType(&iface->pin.mt);
884 }
885
886 return hr;
887}
struct strmbase_pin pin
Definition: strmbase.h:79

◆ testsource_query_interface()

static HRESULT testsource_query_interface ( struct strmbase_pin *  iface,
REFIID  iid,
void **  out 
)
static

Definition at line 856 of file avisplit.c.

857{
859
860 if (IsEqualGUID(iid, &IID_IAsyncReader))
861 *out = &filter->IAsyncReader_iface;
862 else
863 return E_NOINTERFACE;
864
865 IUnknown_AddRef((IUnknown *)*out);
866 return S_OK;
867}

Variable Documentation

◆ async_reader_vtbl

const struct IAsyncReaderVtbl async_reader_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI async_reader_WaitForNext(IAsyncReader *iface, DWORD timeout, IMediaSample **sample, DWORD_PTR *cookie)
Definition: avisplit.c:1046
static HRESULT WINAPI async_reader_SyncRead(IAsyncReader *iface, LONGLONG position, LONG length, BYTE *buffer)
Definition: avisplit.c:1057
static HRESULT WINAPI async_reader_SyncReadAligned(IAsyncReader *iface, IMediaSample *sample)
Definition: avisplit.c:1052
static HRESULT WINAPI async_reader_Length(IAsyncReader *iface, LONGLONG *total, LONGLONG *available)
Definition: avisplit.c:1062
static HRESULT WINAPI async_reader_BeginFlush(IAsyncReader *iface)
Definition: avisplit.c:1067
static HRESULT WINAPI async_reader_EndFlush(IAsyncReader *iface)
Definition: avisplit.c:1072
static HRESULT WINAPI async_reader_RequestAllocator(IAsyncReader *iface, IMemAllocator *preferred, ALLOCATOR_PROPERTIES *props, IMemAllocator **allocator)
Definition: avisplit.c:1035
static ULONG WINAPI async_reader_Release(IAsyncReader *iface)
Definition: avisplit.c:1030
static HRESULT WINAPI async_reader_Request(IAsyncReader *iface, IMediaSample *sample, DWORD_PTR cookie)
Definition: avisplit.c:1041
static ULONG WINAPI async_reader_AddRef(IAsyncReader *iface)
Definition: avisplit.c:1025
static HRESULT WINAPI async_reader_QueryInterface(IAsyncReader *iface, REFIID iid, void **out)
Definition: avisplit.c:1020

Definition at line 1077 of file avisplit.c.

Referenced by testfilter_init().

◆ outer_ref

LONG outer_ref = 1
static

Definition at line 179 of file avisplit.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: avisplit.c:194
static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID iid, void **out)
Definition: avisplit.c:181
static ULONG WINAPI outer_Release(IUnknown *iface)
Definition: avisplit.c:199

Definition at line 204 of file avisplit.c.

◆ test_iid

const GUID test_iid = {0x33333333}
static

Definition at line 178 of file avisplit.c.

Referenced by outer_QueryInterface(), and test_aggregation().

◆ test_outer

IUnknown test_outer = {&outer_vtbl}
static

Definition at line 211 of file avisplit.c.

Referenced by test_aggregation().

◆ testfilter_ops

const struct strmbase_filter_ops testfilter_ops
static
Initial value:
=
{
.filter_get_pin = testfilter_get_pin,
.filter_destroy = testfilter_destroy,
.filter_init_stream = testfilter_init_stream,
}
static void testfilter_destroy(struct strmbase_filter *iface)
Definition: avisplit.c:830
static struct strmbase_pin * testfilter_get_pin(struct strmbase_filter *iface, unsigned int index)
Definition: avisplit.c:820
static HRESULT testfilter_init_stream(struct strmbase_filter *iface)
Definition: avisplit.c:839

Definition at line 849 of file avisplit.c.

Referenced by testfilter_init().

◆ testguid

const GUID testguid = {0xfacade}
static

Definition at line 28 of file avisplit.c.

Referenced by test_seeking().

◆ testsink_ops

const struct strmbase_sink_ops testsink_ops
static
Initial value:
=
{
.base.pin_query_interface = testsink_query_interface,
.base.pin_get_media_type = testsink_get_media_type,
.sink_connect = testsink_connect,
.pfnReceive = testsink_Receive,
.sink_eos = testsink_eos,
.sink_new_segment = testsink_new_segment,
}
static HRESULT testsink_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
Definition: avisplit.c:895
static HRESULT testsink_connect(struct strmbase_sink *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
Definition: avisplit.c:919
static HRESULT testsink_new_segment(struct strmbase_sink *iface, REFERENCE_TIME start, REFERENCE_TIME end, double rate)
Definition: avisplit.c:981
static HRESULT testsink_eos(struct strmbase_sink *iface)
Definition: avisplit.c:968
static HRESULT WINAPI testsink_Receive(struct strmbase_sink *iface, IMediaSample *sample)
Definition: avisplit.c:941
static HRESULT testsink_get_media_type(struct strmbase_pin *iface, unsigned int index, AM_MEDIA_TYPE *mt)
Definition: avisplit.c:908

Definition at line 1005 of file avisplit.c.

Referenced by testfilter_init().

◆ testsource_ops

const struct strmbase_source_ops testsource_ops
static
Initial value:
=
{
.base.pin_query_interface = testsource_query_interface,
.pfnAttemptConnection = testsource_AttemptConnection,
}
static HRESULT testsource_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
Definition: avisplit.c:856
static HRESULT WINAPI testsource_AttemptConnection(struct strmbase_source *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
Definition: avisplit.c:869

Definition at line 889 of file avisplit.c.

Referenced by testfilter_init().