amstream: Implement GetDirectDraw().

This commit is contained in:
Nikolay Sivov 2015-06-22 23:52:08 +03:00 committed by Alexandre Julliard
parent 17283f9be5
commit eb0b1d55e4
3 changed files with 35 additions and 4 deletions

View File

@ -1,5 +1,5 @@
MODULE = amstream.dll MODULE = amstream.dll
IMPORTS = strmiids strmbase uuid ole32 advapi32 IMPORTS = strmiids strmbase uuid ole32 advapi32 ddraw
C_SRCS = \ C_SRCS = \
amstream.c \ amstream.c \

View File

@ -42,6 +42,7 @@ typedef struct {
IMultiMediaStream* parent; IMultiMediaStream* parent;
MSPID purpose_id; MSPID purpose_id;
STREAM_TYPE stream_type; STREAM_TYPE stream_type;
IDirectDraw7 *ddraw;
} DirectDrawMediaStreamImpl; } DirectDrawMediaStreamImpl;
static inline DirectDrawMediaStreamImpl *impl_from_DirectDrawMediaStream_IAMMediaStream(IAMMediaStream *iface) static inline DirectDrawMediaStreamImpl *impl_from_DirectDrawMediaStream_IAMMediaStream(IAMMediaStream *iface)
@ -94,7 +95,11 @@ static ULONG WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_Release(IAMMediaStr
TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref); TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
if (!ref) if (!ref)
{
if (This->ddraw)
IDirectDraw7_Release(This->ddraw);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
}
return ref; return ref;
} }
@ -373,11 +378,21 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetFormat
} }
static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetDirectDraw(IDirectDrawMediaStream *iface, static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetDirectDraw(IDirectDrawMediaStream *iface,
IDirectDraw **ppDirectDraw) IDirectDraw **ddraw)
{ {
FIXME("(%p)->(%p) stub!\n", iface, ppDirectDraw); DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
return E_NOTIMPL; TRACE("(%p)->(%p)\n", iface, ddraw);
*ddraw = NULL;
if (!This->ddraw)
{
HRESULT hr = DirectDrawCreateEx(NULL, (void**)&This->ddraw, &IID_IDirectDraw7, NULL);
if (FAILED(hr))
return hr;
}
return IDirectDraw7_QueryInterface(This->ddraw, &IID_IDirectDraw, (void**)ddraw);
} }
static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetDirectDraw(IDirectDrawMediaStream *iface, static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetDirectDraw(IDirectDrawMediaStream *iface,

View File

@ -458,6 +458,8 @@ static void test_IDirectDrawStreamSample(void)
IDirectDrawMediaStream *pddstream = NULL; IDirectDrawMediaStream *pddstream = NULL;
IDirectDrawStreamSample *pddsample = NULL; IDirectDrawStreamSample *pddsample = NULL;
IDirectDrawSurface *surface, *surface2; IDirectDrawSurface *surface, *surface2;
IDirectDraw *ddraw, *ddraw2;
IDirectDraw7 *ddraw7;
RECT rect; RECT rect;
if (!(pams = create_ammultimediastream())) if (!(pams = create_ammultimediastream()))
@ -482,6 +484,20 @@ static void test_IDirectDrawStreamSample(void)
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
if (FAILED(hr)) goto error; if (FAILED(hr)) goto error;
hr = IDirectDrawMediaStream_GetDirectDraw(pddstream, &ddraw);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IDirectDrawMediaStream_GetDirectDraw(pddstream, &ddraw2);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(ddraw == ddraw2, "got %p, %p\n", ddraw, ddraw2);
hr = IDirectDraw_QueryInterface(ddraw, &IID_IDirectDraw7, (void**)&ddraw7);
ok(hr == S_OK, "got 0x%08x\n", hr);
IDirectDraw7_Release(ddraw7);
IDirectDraw_Release(ddraw2);
IDirectDraw_Release(ddraw);
hr = IDirectDrawMediaStream_CreateSample(pddstream, NULL, NULL, 0, &pddsample); hr = IDirectDrawMediaStream_CreateSample(pddstream, NULL, NULL, 0, &pddsample);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);