amstream/tests: Get rid of global stream pointer that we don't really need.

This commit is contained in:
Nikolay Sivov 2015-06-21 00:26:50 +03:00 committed by Alexandre Julliard
parent 5b24854680
commit 84c2fda63d
1 changed files with 16 additions and 17 deletions

View File

@ -28,19 +28,15 @@
static const WCHAR filenameW[] = {'t','e','s','t','.','a','v','i',0}; static const WCHAR filenameW[] = {'t','e','s','t','.','a','v','i',0};
static IAMMultiMediaStream* pams;
static IDirectDraw7* pdd7; static IDirectDraw7* pdd7;
static IDirectDrawSurface7* pdds7; static IDirectDrawSurface7* pdds7;
static int create_ammultimediastream(void) static IAMMultiMediaStream *create_ammultimediastream(void)
{ {
return S_OK == CoCreateInstance( IAMMultiMediaStream *stream = NULL;
&CLSID_AMMultiMediaStream, NULL, CLSCTX_INPROC_SERVER, &IID_IAMMultiMediaStream, (LPVOID*)&pams); CoCreateInstance(&CLSID_AMMultiMediaStream, NULL, CLSCTX_INPROC_SERVER, &IID_IAMMultiMediaStream,
} (void**)&stream);
return stream;
static void release_ammultimediastream(void)
{
IAMMultiMediaStream_Release(pams);
} }
static int create_directdraw(void) static int create_directdraw(void)
@ -89,10 +85,11 @@ static void release_directdraw(void)
static void test_openfile(void) static void test_openfile(void)
{ {
IAMMultiMediaStream *pams;
HRESULT hr; HRESULT hr;
IGraphBuilder* pgraph; IGraphBuilder* pgraph;
if (!create_ammultimediastream()) if (!(pams = create_ammultimediastream()))
return; return;
hr = IAMMultiMediaStream_GetFilterGraph(pams, &pgraph); hr = IAMMultiMediaStream_GetFilterGraph(pams, &pgraph);
@ -112,21 +109,22 @@ static void test_openfile(void)
if (pgraph) if (pgraph)
IGraphBuilder_Release(pgraph); IGraphBuilder_Release(pgraph);
release_ammultimediastream(); IAMMultiMediaStream_Release(pams);
} }
static void test_renderfile(void) static void test_renderfile(void)
{ {
IAMMultiMediaStream *pams;
HRESULT hr; HRESULT hr;
IMediaStream *pvidstream = NULL; IMediaStream *pvidstream = NULL;
IDirectDrawMediaStream *pddstream = NULL; IDirectDrawMediaStream *pddstream = NULL;
IDirectDrawStreamSample *pddsample = NULL; IDirectDrawStreamSample *pddsample = NULL;
if (!create_ammultimediastream()) if (!(pams = create_ammultimediastream()))
return; return;
if (!create_directdraw()) if (!create_directdraw())
{ {
release_ammultimediastream(); IAMMultiMediaStream_Release(pams);
return; return;
} }
@ -162,22 +160,23 @@ error:
IMediaStream_Release(pvidstream); IMediaStream_Release(pvidstream);
release_directdraw(); release_directdraw();
release_ammultimediastream(); IAMMultiMediaStream_Release(pams);
} }
static void test_media_streams(void) static void test_media_streams(void)
{ {
IAMMultiMediaStream *pams;
HRESULT hr; HRESULT hr;
IMediaStream *video_stream = NULL; IMediaStream *video_stream = NULL;
IMediaStream *audio_stream = NULL; IMediaStream *audio_stream = NULL;
IMediaStream *dummy_stream; IMediaStream *dummy_stream;
IMediaStreamFilter* media_stream_filter = NULL; IMediaStreamFilter* media_stream_filter = NULL;
if (!create_ammultimediastream()) if (!(pams = create_ammultimediastream()))
return; return;
if (!create_directdraw()) if (!create_directdraw())
{ {
release_ammultimediastream(); IAMMultiMediaStream_Release(pams);
return; return;
} }
@ -424,7 +423,7 @@ static void test_media_streams(void)
IMediaStreamFilter_Release(media_stream_filter); IMediaStreamFilter_Release(media_stream_filter);
release_directdraw(); release_directdraw();
release_ammultimediastream(); IAMMultiMediaStream_Release(pams);
} }
START_TEST(amstream) START_TEST(amstream)