amstream: Add checks to GetFormat.

This commit is contained in:
Christian Costa 2012-05-01 10:21:20 +02:00 committed by Alexandre Julliard
parent bde73d8dfc
commit 49762b1679
2 changed files with 23 additions and 6 deletions

View File

@ -159,13 +159,13 @@ static HRESULT WINAPI IDirectDrawMediaStreamImpl_SendEndOfStream(IDirectDrawMedi
/*** IDirectDrawMediaStream methods ***/
static HRESULT WINAPI IDirectDrawMediaStreamImpl_GetFormat(IDirectDrawMediaStream *iface,
DDSURFACEDESC *pDDSDCurrent, IDirectDrawPalette **ppDirectDrawPalette,
DDSURFACEDESC *pDDSDDesired, DWORD *pdwFlags)
DDSURFACEDESC *current_format, IDirectDrawPalette **palette,
DDSURFACEDESC *desired_format, DWORD *flags)
{
FIXME("(%p)->(%p,%p,%p,%p) stub!\n", iface, pDDSDCurrent, ppDirectDrawPalette, pDDSDDesired,
pdwFlags);
FIXME("(%p)->(%p,%p,%p,%p) stub!\n", iface, current_format, palette, desired_format,
flags);
return E_NOTIMPL;
return MS_E_NOSTREAM;
}
@ -390,7 +390,10 @@ static HRESULT WINAPI IAudioMediaStreamImpl_GetFormat(IAudioMediaStream *iface,
FIXME("(%p/%p)->(%p) stub!\n", iface, This, wave_format_current);
return E_NOTIMPL;
if (!wave_format_current)
return E_POINTER;
return MS_E_NOSTREAM;
}

View File

@ -248,6 +248,13 @@ static void test_media_streams(void)
if (SUCCEEDED(hr))
{
DDSURFACEDESC current_format, desired_format;
IDirectDrawPalette *palette;
DWORD flags;
hr = IDirectDrawMediaStream_GetFormat(ddraw_stream, &current_format, &palette, &desired_format, &flags);
ok(hr == MS_E_NOSTREAM, "IDirectDrawoMediaStream_GetFormat returned: %x\n", hr);
hr = IDirectDrawMediaStream_CreateSample(ddraw_stream, NULL, NULL, 0, &ddraw_sample);
ok(hr == S_OK, "IDirectDrawMediaStream_CreateSample returned: %x\n", hr);
}
@ -333,9 +340,16 @@ static void test_media_streams(void)
if (SUCCEEDED(hr))
{
IAudioData* audio_data = NULL;
WAVEFORMATEX format;
hr = CoCreateInstance(&CLSID_AMAudioData, NULL, CLSCTX_INPROC_SERVER, &IID_IAudioData, (void **)&audio_data);
ok(hr == S_OK, "CoCreateInstance returned: %x\n", hr);
hr = IAudioMediaStream_GetFormat(audio_media_stream, NULL);
ok(hr == E_POINTER, "IAudioMediaStream_GetFormat returned: %x\n", hr);
hr = IAudioMediaStream_GetFormat(audio_media_stream, &format);
ok(hr == MS_E_NOSTREAM, "IAudioMediaStream_GetFormat returned: %x\n", hr);
hr = IAudioMediaStream_CreateSample(audio_media_stream, NULL, 0, &audio_sample);
ok(hr == E_POINTER, "IAudioMediaStream_CreateSample returned: %x\n", hr);
hr = IAudioMediaStream_CreateSample(audio_media_stream, audio_data, 0, &audio_sample);