Commit eb0b1d55 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

amstream: Implement GetDirectDraw().

parent 17283f9b
MODULE = amstream.dll
IMPORTS = strmiids strmbase uuid ole32 advapi32
IMPORTS = strmiids strmbase uuid ole32 advapi32 ddraw
C_SRCS = \
amstream.c \
......
......@@ -42,6 +42,7 @@ typedef struct {
IMultiMediaStream* parent;
MSPID purpose_id;
STREAM_TYPE stream_type;
IDirectDraw7 *ddraw;
} DirectDrawMediaStreamImpl;
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);
if (!ref)
{
if (This->ddraw)
IDirectDraw7_Release(This->ddraw);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
......@@ -373,11 +378,21 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetFormat
}
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,
......
......@@ -458,6 +458,8 @@ static void test_IDirectDrawStreamSample(void)
IDirectDrawMediaStream *pddstream = NULL;
IDirectDrawStreamSample *pddsample = NULL;
IDirectDrawSurface *surface, *surface2;
IDirectDraw *ddraw, *ddraw2;
IDirectDraw7 *ddraw7;
RECT rect;
if (!(pams = create_ammultimediastream()))
......@@ -482,6 +484,20 @@ static void test_IDirectDrawStreamSample(void)
ok(hr == S_OK, "got 0x%08x\n", hr);
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);
ok(hr == S_OK, "got 0x%08x\n", hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment