From: Gijs Vermeulen gijsvrm@gmail.com
Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com Signed-off-by: Zebediah Figura z.figura12@gmail.com --- v2: Use %#x instead of %x, and break a long line.
dlls/amstream/ddrawstream.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/dlls/amstream/ddrawstream.c b/dlls/amstream/ddrawstream.c index c471a66200d..0bfbe653e7e 100644 --- a/dlls/amstream/ddrawstream.c +++ b/dlls/amstream/ddrawstream.c @@ -28,9 +28,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(amstream);
static const WCHAR sink_id[] = L"I{A35FF56A-9FDA-11D0-8FDF-00C04FD9189D}";
-static HRESULT ddrawstreamsample_create(IDirectDrawMediaStream *parent, IDirectDrawSurface *surface, - const RECT *rect, IDirectDrawStreamSample **ddraw_stream_sample); - struct ddraw_stream { IAMMediaStream IAMMediaStream_iface; @@ -51,6 +48,9 @@ struct ddraw_stream AM_MEDIA_TYPE mt; };
+static HRESULT ddrawstreamsample_create(struct ddraw_stream *parent, IDirectDrawSurface *surface, + const RECT *rect, IDirectDrawStreamSample **ddraw_stream_sample); + static inline struct ddraw_stream *impl_from_IAMMediaStream(IAMMediaStream *iface) { return CONTAINING_RECORD(iface, struct ddraw_stream, IAMMediaStream_iface); @@ -401,12 +401,15 @@ static HRESULT WINAPI ddraw_IDirectDrawMediaStream_SetDirectDraw(IDirectDrawMedi }
static HRESULT WINAPI ddraw_IDirectDrawMediaStream_CreateSample(IDirectDrawMediaStream *iface, - IDirectDrawSurface *surface, const RECT *rect, DWORD dwFlags, - IDirectDrawStreamSample **ppSample) + IDirectDrawSurface *surface, const RECT *rect, DWORD flags, + IDirectDrawStreamSample **sample) { - TRACE("(%p)->(%p,%s,%x,%p)\n", iface, surface, wine_dbgstr_rect(rect), dwFlags, ppSample); + struct ddraw_stream *stream = impl_from_IDirectDrawMediaStream(iface); + + TRACE("stream %p, surface %p, rect %s, flags %#x, sample %p.\n", + stream, surface, wine_dbgstr_rect(rect), flags, sample);
- return ddrawstreamsample_create(iface, surface, rect, ppSample); + return ddrawstreamsample_create(stream, surface, rect, sample); }
static HRESULT WINAPI ddraw_IDirectDrawMediaStream_GetTimePerFrame(IDirectDrawMediaStream *iface, @@ -959,7 +962,7 @@ struct ddraw_sample { IDirectDrawStreamSample IDirectDrawStreamSample_iface; LONG ref; - IMediaStream *parent; + struct ddraw_stream *parent; IDirectDrawSurface *surface; RECT rect; }; @@ -1011,7 +1014,6 @@ static ULONG WINAPI ddraw_sample_Release(IDirectDrawStreamSample *iface) { if (sample->surface) IDirectDrawSurface_Release(sample->surface); - IMediaStream_Release(sample->parent); HeapFree(GetProcessHeap(), 0, sample); }
@@ -1102,7 +1104,7 @@ static const struct IDirectDrawStreamSampleVtbl DirectDrawStreamSample_Vtbl = ddraw_sample_SetRect };
-static HRESULT ddrawstreamsample_create(IDirectDrawMediaStream *parent, IDirectDrawSurface *surface, +static HRESULT ddrawstreamsample_create(struct ddraw_stream *parent, IDirectDrawSurface *surface, const RECT *rect, IDirectDrawStreamSample **ddraw_stream_sample) { struct ddraw_sample *object; @@ -1116,8 +1118,7 @@ static HRESULT ddrawstreamsample_create(IDirectDrawMediaStream *parent, IDirectD
object->IDirectDrawStreamSample_iface.lpVtbl = &DirectDrawStreamSample_Vtbl; object->ref = 1; - object->parent = (IMediaStream*)parent; - IMediaStream_AddRef(object->parent); + object->parent = parent;
if (surface) { @@ -1129,7 +1130,7 @@ static HRESULT ddrawstreamsample_create(IDirectDrawMediaStream *parent, IDirectD DDSURFACEDESC desc; IDirectDraw *ddraw;
- hr = IDirectDrawMediaStream_GetDirectDraw(parent, &ddraw); + hr = IDirectDrawMediaStream_GetDirectDraw(&parent->IDirectDrawMediaStream_iface, &ddraw); if (FAILED(hr)) { IDirectDrawStreamSample_Release(&object->IDirectDrawStreamSample_iface);