2 * Unit tests for MultiMedia Stream functions
4 * Copyright (C) 2009 Christian Costa
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #include "wine/test.h"
29 static const char fileA
[FILE_LEN
] = "test.avi";
31 IAMMultiMediaStream
* pams
;
33 static int create_ammultimediastream(void)
35 return S_OK
== CoCreateInstance(
36 &CLSID_AMMultiMediaStream
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IAMMultiMediaStream
, (LPVOID
*)&pams
);
39 static void release_ammultimediastream(void)
41 IAMMultiMediaStream_Release(pams
);
44 static void renderfile(const char * fileA
)
47 WCHAR fileW
[FILE_LEN
];
48 IGraphBuilder
* pgraph
;
50 MultiByteToWideChar(CP_ACP
, 0, fileA
, -1, fileW
, FILE_LEN
);
52 hr
= IAMMultiMediaStream_GetFilterGraph(pams
, &pgraph
);
53 ok(hr
==S_OK
, "GetFilterGraph returned: %x\n", hr
);
54 ok(pgraph
==NULL
, "Filtergraph should not be created yet\n");
57 IGraphBuilder_Release(pgraph
);
59 hr
= IAMMultiMediaStream_OpenFile(pams
, fileW
, 0);
60 ok(hr
==S_OK
, "OpenFile returned: %x\n", hr
);
62 hr
= IAMMultiMediaStream_GetFilterGraph(pams
, &pgraph
);
63 ok(hr
==S_OK
, "GetFilterGraph returned: %x\n", hr
);
64 ok(pgraph
!=NULL
, "Filtergraph should be created\n");
67 IGraphBuilder_Release(pgraph
);
70 static void test_render(void)
74 if (!create_ammultimediastream())
77 h
= CreateFileA(fileA
, 0, 0, NULL
, OPEN_EXISTING
, 0, NULL
);
78 if (h
!= INVALID_HANDLE_VALUE
) {
83 release_ammultimediastream();
88 CoInitializeEx(NULL
, COINIT_MULTITHREADED
);