ReactOS  0.4.14-dev-608-gd495a4f
avisplitter.c File Reference
#include "wine/test.h"
#include "dshow.h"
#include "tlhelp32.h"
Include dependency graph for avisplitter.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 
#define TEST_INTERFACE(riid, expected)
 

Functions

static BOOL create_avisplitter (void)
 
static void release_avisplitter (void)
 
static void test_query_interface (void)
 
static void test_pin (IPin *pin)
 
static void test_basefilter (void)
 
static void test_filesourcefilter (void)
 
static WCHARload_resource (const WCHAR *name)
 
static void test_filter_graph (void)
 
 START_TEST (avisplitter)
 

Variables

static IUnknownpAviSplitter = NULL
 
static const WCHAR avifile [] = {'t','e','s','t','.','a','v','i',0}
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file avisplitter.c.

◆ TEST_INTERFACE

#define TEST_INTERFACE (   riid,
  expected 
)
Value:
do { \
hr = IUnknown_QueryInterface(pAviSplitter, &riid, (void**)&iface); \
ok( hr == expected, #riid" should %s got %08X\n", expected==S_OK ? "exist" : "not be present", GetLastError() ); \
if (hr == S_OK) { \
ref = IUnknown_Release(iface); \
ok(ref == 1, "Reference is %u, expected 1\n", ref); \
} \
iface = NULL; \
} while(0)
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
Definition: send.c:47
smooth NULL
Definition: ftsmooth.c:416
#define S_OK
Definition: intsafe.h:59
static IUnknown * pAviSplitter
Definition: avisplitter.c:28
BOOL expected
Definition: store.c:2063

Function Documentation

◆ create_avisplitter()

static BOOL create_avisplitter ( void  )
static

Definition at line 30 of file avisplitter.c.

31 {
32  HRESULT hr;
33 
34  hr = CoCreateInstance(&CLSID_AviSplitter, NULL, CLSCTX_INPROC_SERVER,
36  return (hr == S_OK && pAviSplitter != NULL);
37 }
HRESULT hr
Definition: shlfolder.c:183
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define S_OK
Definition: intsafe.h:59
static IUnknown * pAviSplitter
Definition: avisplitter.c:28

Referenced by START_TEST().

◆ load_resource()

static WCHAR* load_resource ( const WCHAR name)
static

Definition at line 275 of file avisplitter.c.

276 {
277  static WCHAR pathW[MAX_PATH];
278  DWORD written;
279  HANDLE file;
280  HRSRC res;
281  void *ptr;
282 
283  GetTempPathW(sizeof(pathW)/sizeof(WCHAR), pathW);
284  lstrcatW(pathW, name);
285 
287  ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %d\n", wine_dbgstr_w(pathW),
288  GetLastError());
289 
291  ok( res != 0, "couldn't find resource\n" );
294  ok( written == SizeofResource( GetModuleHandleA(NULL), res ), "couldn't write resource\n" );
295  CloseHandle( file );
296 
297  return pathW;
298 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define CloseHandle
Definition: compat.h:406
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2079
#define GENERIC_WRITE
Definition: nt_native.h:90
static PVOID ptr
Definition: dispmode.c:27
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
#define RT_RCDATA
Definition: pedump.c:372
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
#define GENERIC_READ
Definition: compat.h:124
#define CREATE_ALWAYS
Definition: disk.h:72
#define ok(value,...)
Definition: atltest.h:57
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
#define CreateFileW
Definition: compat.h:408
Definition: name.c:38
GLuint res
Definition: glext.h:9613
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
Definition: fci.c:126

Referenced by test_filter_graph().

◆ release_avisplitter()

static void release_avisplitter ( void  )
static

Definition at line 39 of file avisplitter.c.

40 {
41  HRESULT hr;
42 
43  Sleep(1000);
44  hr = IUnknown_Release(pAviSplitter);
45 
46  /* Looks like wine has a reference leak somewhere on test_threads tests,
47  * it passes in windows
48  */
49  ok(hr == 0, "IUnknown_Release failed with %d\n", (INT)hr);
50 
51  while (hr > 0)
52  hr = IUnknown_Release(pAviSplitter);
54 }
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
HRESULT hr
Definition: shlfolder.c:183
int32_t INT
Definition: typedefs.h:56
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
static IUnknown * pAviSplitter
Definition: avisplitter.c:28
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( avisplitter  )

Definition at line 548 of file avisplitter.c.

549 {
551 
552  if (!create_avisplitter())
553  {
554  skip("Could not create avisplitter\n");
555  return;
556  }
557 
559  test_basefilter();
562 
564 
565  CoUninitialize();
566 }
static void test_filesourcefilter(void)
Definition: avisplitter.c:142
smooth NULL
Definition: ftsmooth.c:416
static void test_query_interface(void)
Definition: avisplitter.c:56
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
static void release_avisplitter(void)
Definition: avisplitter.c:39
#define skip(...)
Definition: atltest.h:64
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
static void test_filter_graph(void)
Definition: avisplitter.c:300
static BOOL create_avisplitter(void)
Definition: avisplitter.c:30
static void test_basefilter(void)
Definition: avisplitter.c:93

◆ test_basefilter()

static void test_basefilter ( void  )
static

Definition at line 93 of file avisplitter.c.

94 {
95  IEnumPins *pin_enum = NULL;
97  IPin *pins[2];
98  ULONG ref;
99  HRESULT hr;
100 
101  IUnknown_QueryInterface(pAviSplitter, &IID_IBaseFilter, (void **)&base);
102  if (base == NULL)
103  {
104  /* test_query_interface handles this case */
105  skip("No IBaseFilter\n");
106  return;
107  }
108 
109  hr = IBaseFilter_EnumPins(base, NULL);
110  ok(hr == E_POINTER, "hr = %08x and not E_POINTER\n", hr);
111 
112  hr= IBaseFilter_EnumPins(base, &pin_enum);
113  ok(hr == S_OK, "hr = %08x and not S_OK\n", hr);
114 
115  hr = IEnumPins_Next(pin_enum, 1, NULL, NULL);
116  ok(hr == E_POINTER, "hr = %08x and not E_POINTER\n", hr);
117 
118  hr = IEnumPins_Next(pin_enum, 2, pins, NULL);
119  ok(hr == E_INVALIDARG, "hr = %08x and not E_INVALIDARG\n", hr);
120 
121  pins[0] = (void *)0xdead;
122  pins[1] = (void *)0xdeed;
123 
124  hr = IEnumPins_Next(pin_enum, 2, pins, &ref);
125  ok(hr == S_FALSE, "hr = %08x instead of S_FALSE\n", hr);
126  ok(pins[0] != (void *)0xdead && pins[0] != NULL,
127  "pins[0] = %p\n", pins[0]);
128  if (pins[0] != (void *)0xdead && pins[0] != NULL)
129  {
130  test_pin(pins[0]);
131  IPin_Release(pins[0]);
132  }
133 
134  ok(pins[1] == (void *)0xdeed, "pins[1] = %p\n", pins[1]);
135 
136  ref = IEnumPins_Release(pin_enum);
137  ok(ref == 0, "ref is %u and not 0!\n", ref);
138 
139  IBaseFilter_Release(base);
140 }
const GUID IID_IBaseFilter
HRESULT hr
Definition: shlfolder.c:183
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
static IUnknown * pAviSplitter
Definition: avisplitter.c:28
Definition: axcore.idl:91
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
unsigned int ULONG
Definition: retypes.h:1
static void test_pin(IPin *pin)
Definition: avisplitter.c:81
#define E_POINTER
Definition: winerror.h:2365

Referenced by START_TEST().

◆ test_filesourcefilter()

static void test_filesourcefilter ( void  )
static

Definition at line 142 of file avisplitter.c.

143 {
144  static const WCHAR prefix[] = {'w','i','n',0};
145  static const struct
146  {
147  const char *label;
148  const char *data;
149  DWORD size;
150  const GUID *subtype;
151  }
152  tests[] =
153  {
154  {
155  "AVI",
156  "\x52\x49\x46\x46xxxx\x41\x56\x49\x20",
157  12,
158  &MEDIASUBTYPE_Avi,
159  },
160  {
161  "MPEG1 System",
162  "\x00\x00\x01\xBA\x21\x00\x01\x00\x01\x80\x00\x01\x00\x00\x01\xBB",
163  16,
164  &MEDIASUBTYPE_MPEG1System,
165  },
166  {
167  "MPEG1 Video",
168  "\x00\x00\x01\xB3",
169  4,
170  &MEDIASUBTYPE_MPEG1Video,
171  },
172  {
173  "MPEG1 Audio",
174  "\xFF\xE0",
175  2,
176  &MEDIASUBTYPE_MPEG1Audio,
177  },
178  {
179  "MPEG2 Program",
180  "\x00\x00\x01\xBA\x40",
181  5,
182  &MEDIASUBTYPE_MPEG2_PROGRAM,
183  },
184  {
185  "WAVE",
186  "\x52\x49\x46\x46xxxx\x57\x41\x56\x45",
187  12,
188  &MEDIASUBTYPE_WAVE,
189  },
190  {
191  "unknown format",
192  "Hello World",
193  11,
194  NULL, /* FIXME: should be &MEDIASUBTYPE_NULL */
195  },
196  };
198  IFileSourceFilter *filesource;
199  DWORD ret, written;
200  IBaseFilter *base;
201  AM_MEDIA_TYPE mt;
202  OLECHAR *olepath;
203  BOOL success;
204  HANDLE file;
205  HRESULT hr;
206  int i;
207 
209  ok(ret, "GetTempPathW failed with error %u\n", GetLastError());
210  ret = GetTempFileNameW(temp, prefix, 0, path);
211  ok(ret, "GetTempFileNameW failed with error %u\n", GetLastError());
212 
213  for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
214  {
215  trace("Running test for %s\n", tests[i].label);
216 
219  ok(file != INVALID_HANDLE_VALUE, "CreateFileW failed with error %u\n", GetLastError());
220  success = WriteFile(file, tests[i].data, tests[i].size, &written, NULL);
221  ok(success, "WriteFile failed with error %u\n", GetLastError());
222  ok(written == tests[i].size, "could not write test data\n");
223  CloseHandle(file);
224 
225  hr = CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER,
226  &IID_IBaseFilter, (void **)&base);
227  ok(hr == S_OK, "CoCreateInstance failed with %08x\n", hr);
228  hr = IBaseFilter_QueryInterface(base, &IID_IFileSourceFilter, (void **)&filesource);
229  ok(hr == S_OK, "IBaseFilter_QueryInterface failed with %08x\n", hr);
230 
231  olepath = (void *)0xdeadbeef;
232  hr = IFileSourceFilter_GetCurFile(filesource, &olepath, NULL);
233  ok(hr == S_OK, "expected S_OK, got %08x\n", hr);
234  ok(olepath == NULL, "expected NULL, got %p\n", olepath);
235 
236  hr = IFileSourceFilter_Load(filesource, NULL, NULL);
237  ok(hr == E_POINTER, "expected E_POINTER, got %08x\n", hr);
238 
239  hr = IFileSourceFilter_Load(filesource, path, NULL);
240  ok(hr == S_OK, "IFileSourceFilter_Load failed with %08x\n", hr);
241 
242  hr = IFileSourceFilter_GetCurFile(filesource, NULL, &mt);
243  ok(hr == E_POINTER, "expected E_POINTER, got %08x\n", hr);
244 
245  olepath = NULL;
246  hr = IFileSourceFilter_GetCurFile(filesource, &olepath, NULL);
247  ok(hr == S_OK, "expected S_OK, got %08x\n", hr);
248  CoTaskMemFree(olepath);
249 
250  olepath = NULL;
251  memset(&mt, 0x11, sizeof(mt));
252  hr = IFileSourceFilter_GetCurFile(filesource, &olepath, &mt);
253  ok(hr == S_OK, "expected S_OK, got %08x\n", hr);
254  ok(!lstrcmpW(olepath, path),
255  "expected %s, got %s\n", wine_dbgstr_w(path), wine_dbgstr_w(olepath));
256  if (tests[i].subtype)
257  {
258  ok(IsEqualGUID(&mt.majortype, &MEDIATYPE_Stream),
259  "expected MEDIATYPE_Stream, got %s\n", wine_dbgstr_guid(&mt.majortype));
260  ok(IsEqualGUID(&mt.subtype, tests[i].subtype),
261  "expected %s, got %s\n", wine_dbgstr_guid(tests[i].subtype), wine_dbgstr_guid(&mt.subtype));
262  }
263  CoTaskMemFree(olepath);
264 
265  IFileSourceFilter_Release(filesource);
266  IBaseFilter_Release(base);
267 
269  ok(success, "DeleteFileW failed with error %u\n", GetLastError());
270  }
271 }
const GUID IID_IBaseFilter
WCHAR OLECHAR
Definition: compat.h:1941
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
struct param_test tests[]
#define CloseHandle
Definition: compat.h:406
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
const char * wine_dbgstr_guid(const GUID *guid)
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
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
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2079
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint base
Definition: 3dtext.c:35
#define GENERIC_WRITE
Definition: nt_native.h:90
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
#define trace
Definition: atltest.h:70
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
const char file[]
Definition: icontest.c:11
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
Definition: filename.c:84
unsigned long DWORD
Definition: ntddk_ex.h:95
#define success(from, fromstr, to, tostr)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int ret
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define GENERIC_READ
Definition: compat.h:124
uint8_t label[11]
Definition: fsck.fat.h:65
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define S_OK
Definition: intsafe.h:59
#define CREATE_ALWAYS
Definition: disk.h:72
static calc_node_t temp
Definition: rpn_ieee.c:38
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define CreateFileW
Definition: compat.h:408
#define E_POINTER
Definition: winerror.h:2365
#define memset(x, y, z)
Definition: compat.h:39
Definition: fci.c:126

Referenced by START_TEST().

◆ test_filter_graph()

static void test_filter_graph ( void  )
static

Definition at line 300 of file avisplitter.c.

301 {
302  IFileSourceFilter *pfile = NULL;
303  IBaseFilter *preader = NULL, *pavi = NULL;
304  IEnumPins *enumpins = NULL;
305  IPin *filepin = NULL, *avipin = NULL;
306  HRESULT hr;
307  HANDLE file = NULL;
309  char buffer[13];
310  DWORD readbytes;
311  FILTER_STATE state;
312 
314 
316  NULL, OPEN_EXISTING, 0, NULL);
317  if (file == INVALID_HANDLE_VALUE)
318  {
319  skip("Could not read test file \"%s\", skipping test\n", wine_dbgstr_w(filename));
321  return;
322  }
323 
324  memset(buffer, 0, 13);
325  readbytes = 12;
326  ReadFile(file, buffer, readbytes, &readbytes, NULL);
327  CloseHandle(file);
328  if (strncmp(buffer, "RIFF", 4) || strcmp(buffer + 8, "AVI "))
329  {
330  skip("%s is not an avi riff file, not doing the avi splitter test\n",
333  return;
334  }
335 
336  hr = IUnknown_QueryInterface(pAviSplitter, &IID_IFileSourceFilter,
337  (void **)&pfile);
338  ok(hr == E_NOINTERFACE,
339  "Avi splitter returns unexpected error: %08x\n", hr);
340  if (pfile)
341  IFileSourceFilter_Release(pfile);
342  pfile = NULL;
343 
344  hr = CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER,
345  &IID_IBaseFilter, (LPVOID*)&preader);
346  ok(hr == S_OK, "Could not create asynchronous reader: %08x\n", hr);
347  if (hr != S_OK)
348  goto fail;
349 
350  hr = IBaseFilter_QueryInterface(preader, &IID_IFileSourceFilter,
351  (void**)&pfile);
352  ok(hr == S_OK, "Could not get IFileSourceFilter: %08x\n", hr);
353  if (hr != S_OK)
354  goto fail;
355 
356  hr = IUnknown_QueryInterface(pAviSplitter, &IID_IBaseFilter,
357  (void**)&pavi);
358  ok(hr == S_OK, "Could not get base filter: %08x\n", hr);
359  if (hr != S_OK)
360  goto fail;
361 
362  hr = IFileSourceFilter_Load(pfile, filename, NULL);
363  if (hr != S_OK)
364  {
365  trace("Could not load file: %08x\n", hr);
366  goto fail;
367  }
368 
369  hr = IBaseFilter_EnumPins(preader, &enumpins);
370  ok(hr == S_OK, "No enumpins: %08x\n", hr);
371  if (hr != S_OK)
372  goto fail;
373 
374  hr = IEnumPins_Next(enumpins, 1, &filepin, NULL);
375  ok(hr == S_OK, "No pin: %08x\n", hr);
376  if (hr != S_OK)
377  goto fail;
378 
379  IEnumPins_Release(enumpins);
380  enumpins = NULL;
381 
382  hr = IBaseFilter_EnumPins(pavi, &enumpins);
383  ok(hr == S_OK, "No enumpins: %08x\n", hr);
384  if (hr != S_OK)
385  goto fail;
386 
387  hr = IEnumPins_Next(enumpins, 1, &avipin, NULL);
388  ok(hr == S_OK, "No pin: %08x\n", hr);
389  if (hr != S_OK)
390  goto fail;
391 
392  hr = IPin_Connect(filepin, avipin, NULL);
393  ok(hr == S_OK, "Could not connect: %08x\n", hr);
394  if (hr != S_OK)
395  goto fail;
396 
397  IPin_Release(avipin);
398  avipin = NULL;
399 
400  IEnumPins_Reset(enumpins);
401 
402  /* Windows puts the pins in the order: Outputpins - Inputpin,
403  * wine does the reverse, just don't test it for now
404  * Hate to admit it, but windows way makes more sense
405  */
406  while (IEnumPins_Next(enumpins, 1, &avipin, NULL) == S_OK)
407  {
408  IPin_QueryDirection(avipin, &dir);
409  if (dir == PINDIR_OUTPUT)
410  {
411  /* Well, connect it to a null renderer! */
412  IBaseFilter *pnull = NULL;
413  IEnumPins *nullenum = NULL;
414  IPin *nullpin = NULL;
415 
416  hr = CoCreateInstance(&CLSID_NullRenderer, NULL,
417  CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&pnull);
418  if (hr == REGDB_E_CLASSNOTREG)
419  {
420  win_skip("Null renderer not registered, skipping\n");
421  break;
422  }
423  ok(hr == S_OK, "Could not create null renderer: %08x\n", hr);
424 
425  hr = IBaseFilter_EnumPins(pnull, &nullenum);
426  ok(hr == S_OK, "Failed to enum pins, hr %#x.\n", hr);
427  hr = IEnumPins_Next(nullenum, 1, &nullpin, NULL);
428  ok(hr == S_OK, "Failed to get next pin, hr %#x.\n", hr);
429  IEnumPins_Release(nullenum);
430  IPin_QueryDirection(nullpin, &dir);
431 
432  hr = IPin_Connect(avipin, nullpin, NULL);
433  ok(hr == S_OK, "Failed to connect output pin: %08x\n", hr);
434  IPin_Release(nullpin);
435  if (hr != S_OK)
436  {
437  IBaseFilter_Release(pnull);
438  break;
439  }
440  IBaseFilter_Run(pnull, 0);
441  }
442 
443  IPin_Release(avipin);
444  avipin = NULL;
445  }
446 
447  if (avipin)
448  IPin_Release(avipin);
449  avipin = NULL;
450 
451  if (hr != S_OK)
452  goto fail2;
453  /* At this point there is a minimalistic connected avi splitter that can
454  * be used for all sorts of source filter tests. However that still needs
455  * to be written at a later time.
456  *
457  * Interesting tests:
458  * - Can you disconnect an output pin while running?
459  * Expecting: Yes
460  * - Can you disconnect the pullpin while running?
461  * Expecting: No
462  * - Is the reference count incremented during playback or when connected?
463  * Does this happen once for every output pin? Or is there something else
464  * going on.
465  * Expecting: You tell me
466  */
467 
468  IBaseFilter_Run(preader, 0);
469  IBaseFilter_Run(pavi, 0);
470  IBaseFilter_GetState(pavi, INFINITE, &state);
471 
472  IBaseFilter_Pause(pavi);
473  IBaseFilter_Pause(preader);
474  IBaseFilter_Stop(pavi);
475  IBaseFilter_Stop(preader);
476  IBaseFilter_GetState(pavi, INFINITE, &state);
477  IBaseFilter_GetState(preader, INFINITE, &state);
478 
479 fail2:
480  IEnumPins_Reset(enumpins);
481  while (IEnumPins_Next(enumpins, 1, &avipin, NULL) == S_OK)
482  {
483  IPin *to = NULL;
484 
485  IPin_QueryDirection(avipin, &dir);
486  IPin_ConnectedTo(avipin, &to);
487  if (to)
488  {
489  IPin_Release(to);
490 
491  if (dir == PINDIR_OUTPUT)
492  {
493  PIN_INFO info;
494 
495  hr = IPin_QueryPinInfo(to, &info);
496  ok(hr == S_OK, "Failed to query pin info, hr %#x.\n", hr);
497 
498  /* Release twice: Once normal, second from the
499  * previous while loop
500  */
501  IBaseFilter_Stop(info.pFilter);
502  IPin_Disconnect(to);
503  IPin_Disconnect(avipin);
504  IBaseFilter_Release(info.pFilter);
505  IBaseFilter_Release(info.pFilter);
506  }
507  else
508  {
509  IPin_Disconnect(to);
510  IPin_Disconnect(avipin);
511  }
512  }
513  IPin_Release(avipin);
514  avipin = NULL;
515  }
516 
517 fail:
518  if (hr != S_OK)
519  skip("Prerequisites not matched, skipping remainder of test\n");
520  if (enumpins)
521  IEnumPins_Release(enumpins);
522 
523  if (avipin)
524  IPin_Release(avipin);
525  if (filepin)
526  {
527  IPin *to = NULL;
528 
529  IPin_ConnectedTo(filepin, &to);
530  if (to)
531  {
532  IPin_Disconnect(filepin);
533  IPin_Disconnect(to);
534  }
535  IPin_Release(filepin);
536  }
537 
538  if (preader)
539  IBaseFilter_Release(preader);
540  if (pavi)
541  IBaseFilter_Release(pavi);
542  if (pfile)
543  IFileSourceFilter_Release(pfile);
544 
546 }
const GUID IID_IBaseFilter
#define CloseHandle
Definition: compat.h:406
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
GLuint buffer
Definition: glext.h:5915
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
const char * filename
Definition: ioapi.h:135
static const WCHAR avifile[]
Definition: avisplitter.c:273
#define FILE_SHARE_READ
Definition: compat.h:125
struct _test_info info[]
Definition: SetCursorPos.c:19
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
smooth NULL
Definition: ftsmooth.c:416
unsigned int dir
Definition: maze.c:112
#define OPEN_EXISTING
Definition: compat.h:434
#define trace
Definition: atltest.h:70
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
unsigned long DWORD
Definition: ntddk_ex.h:95
static int state
Definition: maze.c:121
#define GENERIC_READ
Definition: compat.h:124
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define S_OK
Definition: intsafe.h:59
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
static IUnknown * pAviSplitter
Definition: avisplitter.c:28
static WCHAR * load_resource(const WCHAR *name)
Definition: avisplitter.c:275
Definition: axcore.idl:91
#define ok(value,...)
Definition: atltest.h:57
enum _PinDirection PIN_DIRECTION
#define CreateFileW
Definition: compat.h:408
#define skip(...)
Definition: atltest.h:64
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define INFINITE
Definition: serial.h:102
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:150
Definition: fci.c:126

Referenced by START_TEST().

◆ test_pin()

static void test_pin ( IPin pin)
static

Definition at line 81 of file avisplitter.c.

82 {
83  IMemInputPin *mpin = NULL;
84 
85  IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&mpin);
86 
87  ok(mpin == NULL, "IMemInputPin found!\n");
88  if (mpin)
89  IMemInputPin_Release(mpin);
90  /* TODO */
91 }
Definition: regsvr.c:103
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: atltest.h:57

Referenced by test_basefilter().

◆ test_query_interface()

static void test_query_interface ( void  )
static

Definition at line 56 of file avisplitter.c.

57 {
58  HRESULT hr;
59  ULONG ref;
60  IUnknown *iface= NULL;
61 
62 #define TEST_INTERFACE(riid,expected) do { \
63  hr = IUnknown_QueryInterface(pAviSplitter, &riid, (void**)&iface); \
64  ok( hr == expected, #riid" should %s got %08X\n", expected==S_OK ? "exist" : "not be present", GetLastError() ); \
65  if (hr == S_OK) { \
66  ref = IUnknown_Release(iface); \
67  ok(ref == 1, "Reference is %u, expected 1\n", ref); \
68  } \
69  iface = NULL; \
70  } while(0)
71 
73  TEST_INTERFACE(IID_IMediaSeeking,E_NOINTERFACE);
75  TEST_INTERFACE(IID_IMediaPosition,E_NOINTERFACE);
76  TEST_INTERFACE(IID_IQualityControl,E_NOINTERFACE);
77  TEST_INTERFACE(IID_IQualProp,E_NOINTERFACE);
78 #undef TEST_INTERFACE
79 }
const GUID IID_IBaseFilter
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT hr
Definition: shlfolder.c:183
GLenum GLint ref
Definition: glext.h:6028
#define TEST_INTERFACE(riid, expected)
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IKsPropertySet
Definition: controlnode.cpp:13
#define S_OK
Definition: intsafe.h:59
unsigned int ULONG
Definition: retypes.h:1

Referenced by START_TEST().

Variable Documentation

◆ avifile

const WCHAR avifile[] = {'t','e','s','t','.','a','v','i',0}
static

Definition at line 273 of file avisplitter.c.

Referenced by test_filter_graph().

◆ pAviSplitter

IUnknown* pAviSplitter = NULL
static