Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/amstream/ddrawstream.c | 102 ++++++++++++++++++++++++++++++++- dlls/amstream/tests/amstream.c | 1 + 2 files changed, 102 insertions(+), 1 deletion(-)
diff --git a/dlls/amstream/ddrawstream.c b/dlls/amstream/ddrawstream.c index abff80ab80a..88fadaf2f73 100644 --- a/dlls/amstream/ddrawstream.c +++ b/dlls/amstream/ddrawstream.c @@ -40,13 +40,17 @@ struct ddraw_stream { IAMMediaStream IAMMediaStream_iface; IDirectDrawMediaStream IDirectDrawMediaStream_iface; + IMemInputPin IMemInputPin_iface; LONG ref; + IMultiMediaStream* parent; MSPID purpose_id; STREAM_TYPE stream_type; IDirectDraw7 *ddraw; DirectDrawMediaStreamInputPin *input_pin; CRITICAL_SECTION critical_section; + + IMemAllocator *allocator; };
static inline struct ddraw_stream *impl_from_IAMMediaStream(IAMMediaStream *iface) @@ -85,7 +89,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_QueryInterface(IA else if (IsEqualGUID(riid, &IID_IMemInputPin)) { IAMMediaStream_AddRef(iface); - *ret_iface = &This->input_pin->pin.IMemInputPin_iface; + *ret_iface = &This->IMemInputPin_iface; return S_OK; }
@@ -725,6 +729,101 @@ static const BaseInputPinFuncTable DirectDrawMediaStreamInputPin_FuncTable = DirectDrawMediaStreamInputPin_Receive, };
+static inline struct ddraw_stream *impl_from_IMemInputPin(IMemInputPin *iface) +{ + return CONTAINING_RECORD(iface, struct ddraw_stream, IMemInputPin_iface); +} + +static HRESULT WINAPI ddraw_meminput_QueryInterface(IMemInputPin *iface, REFIID iid, void **out) +{ + struct ddraw_stream *stream = impl_from_IMemInputPin(iface); + return IAMMediaStream_QueryInterface(&stream->IAMMediaStream_iface, iid, out); +} + +static ULONG WINAPI ddraw_meminput_AddRef(IMemInputPin *iface) +{ + struct ddraw_stream *stream = impl_from_IMemInputPin(iface); + return IAMMediaStream_AddRef(&stream->IAMMediaStream_iface); +} + +static ULONG WINAPI ddraw_meminput_Release(IMemInputPin *iface) +{ + struct ddraw_stream *stream = impl_from_IMemInputPin(iface); + return IAMMediaStream_Release(&stream->IAMMediaStream_iface); +} + +static HRESULT WINAPI ddraw_meminput_GetAllocator(IMemInputPin *iface, IMemAllocator **allocator) +{ + struct ddraw_stream *stream = impl_from_IMemInputPin(iface); + + TRACE("stream %p, allocator %p.\n", stream, allocator); + + if (stream->allocator) + { + IMemAllocator_AddRef(*allocator = stream->allocator); + return S_OK; + } + + *allocator = NULL; + return VFW_E_NO_ALLOCATOR; +} + +static HRESULT WINAPI ddraw_meminput_NotifyAllocator(IMemInputPin *iface, IMemAllocator *allocator, BOOL readonly) +{ + struct ddraw_stream *stream = impl_from_IMemInputPin(iface); + + TRACE("stream %p, allocator %p, readonly %d.\n", stream, allocator, readonly); + + if (!allocator) + return E_POINTER; + + if (allocator) + IMemAllocator_AddRef(allocator); + if (stream->allocator) + IMemAllocator_Release(stream->allocator); + stream->allocator = allocator; + + return S_OK; +} + +static HRESULT WINAPI ddraw_meminput_GetAllocatorRequirements(IMemInputPin *iface, ALLOCATOR_PROPERTIES *props) +{ + TRACE("iface %p, props %p.\n", iface, props); + return E_NOTIMPL; +} + +static HRESULT WINAPI ddraw_meminput_Receive(IMemInputPin *iface, IMediaSample *sample) +{ + FIXME("iface %p, sample %p, stub!\n", iface, sample); + return E_NOTIMPL; +} + +static HRESULT WINAPI ddraw_meminput_ReceiveMultiple(IMemInputPin *iface, + IMediaSample **samples, LONG count, LONG *processed) +{ + FIXME("iface %p, samples %p, count %u, processed %p, stub!\n", iface, samples, count, processed); + return E_NOTIMPL; +} + +static HRESULT WINAPI ddraw_meminput_ReceiveCanBlock(IMemInputPin *iface) +{ + TRACE("iface %p.\n", iface); + return S_OK; +} + +static const IMemInputPinVtbl ddraw_meminput_vtbl = +{ + ddraw_meminput_QueryInterface, + ddraw_meminput_AddRef, + ddraw_meminput_Release, + ddraw_meminput_GetAllocator, + ddraw_meminput_NotifyAllocator, + ddraw_meminput_GetAllocatorRequirements, + ddraw_meminput_Receive, + ddraw_meminput_ReceiveMultiple, + ddraw_meminput_ReceiveCanBlock, +}; + HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id, IUnknown *stream_object, STREAM_TYPE stream_type, IAMMediaStream **media_stream) { @@ -740,6 +839,7 @@ HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_
object->IAMMediaStream_iface.lpVtbl = &DirectDrawMediaStreamImpl_IAMMediaStream_Vtbl; object->IDirectDrawMediaStream_iface.lpVtbl = &DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Vtbl; + object->IMemInputPin_iface.lpVtbl = &ddraw_meminput_vtbl; object->ref = 1;
InitializeCriticalSection(&object->critical_section); diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index c224d00ca30..9176622ab04 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -189,6 +189,7 @@ static void test_interfaces(void) check_interface(stream, &IID_IAMMediaStream, TRUE); check_interface(stream, &IID_IDirectDrawMediaStream, TRUE); check_interface(stream, &IID_IMediaStream, TRUE); + check_interface(stream, &IID_IMemInputPin, TRUE); check_interface(stream, &IID_IPin, TRUE); check_interface(stream, &IID_IUnknown, TRUE);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/amstream/ddrawstream.c | 364 +++++++++++++++++++++++------------- 1 file changed, 236 insertions(+), 128 deletions(-)
diff --git a/dlls/amstream/ddrawstream.c b/dlls/amstream/ddrawstream.c index 88fadaf2f73..2012de923de 100644 --- a/dlls/amstream/ddrawstream.c +++ b/dlls/amstream/ddrawstream.c @@ -26,6 +26,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
+static const WCHAR sink_id[] = {'I','{','A','3','5','F','F','5','6','A', + '-','9','F','D','A','-','1','1','D','0','-','8','F','D','F', + '-','0','0','C','0','4','F','D','9','1','8','9','D','}',0}; + static HRESULT ddrawstreamsample_create(IDirectDrawMediaStream *parent, IDirectDrawSurface *surface, const RECT *rect, IDirectDrawStreamSample **ddraw_stream_sample);
@@ -41,16 +45,19 @@ struct ddraw_stream IAMMediaStream IAMMediaStream_iface; IDirectDrawMediaStream IDirectDrawMediaStream_iface; IMemInputPin IMemInputPin_iface; + IPin IPin_iface; LONG ref;
IMultiMediaStream* parent; MSPID purpose_id; STREAM_TYPE stream_type; IDirectDraw7 *ddraw; - DirectDrawMediaStreamInputPin *input_pin; - CRITICAL_SECTION critical_section; + CRITICAL_SECTION cs; + IMediaStreamFilter *filter;
+ IPin *peer; IMemAllocator *allocator; + AM_MEDIA_TYPE mt; };
static inline struct ddraw_stream *impl_from_IAMMediaStream(IAMMediaStream *iface) @@ -83,7 +90,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_QueryInterface(IA else if (IsEqualGUID(riid, &IID_IPin)) { IAMMediaStream_AddRef(iface); - *ret_iface = &This->input_pin->pin.pin.IPin_iface; + *ret_iface = &This->IPin_iface; return S_OK; } else if (IsEqualGUID(riid, &IID_IMemInputPin)) @@ -116,8 +123,7 @@ static ULONG WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_Release(IAMMediaStr
if (!ref) { - BaseInputPin_Destroy((BaseInputPin *)This->input_pin); - DeleteCriticalSection(&This->critical_section); + DeleteCriticalSection(&This->cs); if (This->ddraw) IDirectDraw7_Release(This->ddraw); HeapFree(GetProcessHeap(), 0, This); @@ -226,13 +232,13 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinAMMultiMediaS return S_FALSE; }
-static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilter(IAMMediaStream *iface, IMediaStreamFilter *media_stream_filter) +static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilter(IAMMediaStream *iface, IMediaStreamFilter *filter) { - struct ddraw_stream *This = impl_from_IAMMediaStream(iface); + struct ddraw_stream *stream = impl_from_IAMMediaStream(iface);
- TRACE("(%p/%p)->(%p)\n", This, iface, media_stream_filter); + TRACE("iface %p, filter %p.\n", iface, filter);
- This->input_pin->pin.pin.pinInfo.pFilter = (IBaseFilter *)media_stream_filter; + stream->filter = filter;
return S_OK; } @@ -577,81 +583,37 @@ static const IEnumMediaTypesVtbl enum_media_types_vtbl = enum_media_types_Clone, };
-static inline DirectDrawMediaStreamInputPin *impl_from_DirectDrawMediaStreamInputPin_IPin(IPin *iface) +static inline struct ddraw_stream *impl_from_IPin(IPin *iface) { - return CONTAINING_RECORD(iface, DirectDrawMediaStreamInputPin, pin.pin.IPin_iface); + return CONTAINING_RECORD(iface, struct ddraw_stream, IPin_iface); }
-/*** IUnknown methods ***/ -static HRESULT WINAPI DirectDrawMediaStreamInputPin_IPin_QueryInterface(IPin *iface, REFIID riid, void **ret_iface) +static HRESULT WINAPI ddraw_sink_QueryInterface(IPin *iface, REFIID iid, void **out) { - DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(iface); - - return IAMMediaStream_QueryInterface(&This->parent->IAMMediaStream_iface, riid, ret_iface); + struct ddraw_stream *stream = impl_from_IPin(iface); + return IAMMediaStream_QueryInterface(&stream->IAMMediaStream_iface, iid, out); }
-static ULONG WINAPI DirectDrawMediaStreamInputPin_IPin_AddRef(IPin *iface) +static ULONG WINAPI ddraw_sink_AddRef(IPin *iface) { - DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(iface); - - return IAMMediaStream_AddRef(&This->parent->IAMMediaStream_iface); + struct ddraw_stream *stream = impl_from_IPin(iface); + return IAMMediaStream_AddRef(&stream->IAMMediaStream_iface); }
-static ULONG WINAPI DirectDrawMediaStreamInputPin_IPin_Release(IPin *iface) +static ULONG WINAPI ddraw_sink_Release(IPin *iface) { - DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(iface); - - return IAMMediaStream_Release(&This->parent->IAMMediaStream_iface); + struct ddraw_stream *stream = impl_from_IPin(iface); + return IAMMediaStream_Release(&stream->IAMMediaStream_iface); }
-static HRESULT WINAPI ddraw_pin_EnumMediaTypes(IPin *iface, IEnumMediaTypes **enum_media_types) +static HRESULT WINAPI ddraw_sink_Connect(IPin *iface, IPin *peer, const AM_MEDIA_TYPE *mt) { - struct enum_media_types *object; - - TRACE("iface %p, enum_media_types %p.\n", iface, enum_media_types); - - if (!enum_media_types) - return E_POINTER; - - if (!(object = heap_alloc(sizeof(*object)))) - return E_OUTOFMEMORY; - - object->IEnumMediaTypes_iface.lpVtbl = &enum_media_types_vtbl; - object->refcount = 1; - object->index = 0; - - *enum_media_types = &object->IEnumMediaTypes_iface; - return S_OK; + WARN("iface %p, peer %p, mt %p, unexpected call!\n", iface, peer, mt); + return E_UNEXPECTED; }
-static const IPinVtbl DirectDrawMediaStreamInputPin_IPin_Vtbl = -{ - DirectDrawMediaStreamInputPin_IPin_QueryInterface, - DirectDrawMediaStreamInputPin_IPin_AddRef, - DirectDrawMediaStreamInputPin_IPin_Release, - BaseInputPinImpl_Connect, - BaseInputPinImpl_ReceiveConnection, - BasePinImpl_Disconnect, - BasePinImpl_ConnectedTo, - BasePinImpl_ConnectionMediaType, - BasePinImpl_QueryPinInfo, - BasePinImpl_QueryDirection, - BasePinImpl_QueryId, - BasePinImpl_QueryAccept, - ddraw_pin_EnumMediaTypes, - BasePinImpl_QueryInternalConnections, - BaseInputPinImpl_EndOfStream, - BaseInputPinImpl_BeginFlush, - BaseInputPinImpl_EndFlush, - BaseInputPinImpl_NewSegment, -}; - -static HRESULT WINAPI DirectDrawMediaStreamInputPin_CheckMediaType(BasePin *base, const AM_MEDIA_TYPE *media_type) +static BOOL check_media_type(const AM_MEDIA_TYPE *media_type) { - DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(&base->IPin_iface); - - TRACE("(%p)->(%p)\n", This, media_type); - if (IsEqualGUID(&media_type->majortype, &MEDIATYPE_Video)) { if (IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_RGB1) || @@ -663,70 +625,233 @@ static HRESULT WINAPI DirectDrawMediaStreamInputPin_CheckMediaType(BasePin *base IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_RGB32)) { TRACE("Video sub-type %s matches\n", debugstr_guid(&media_type->subtype)); - return S_OK; + return TRUE; } }
- return S_FALSE; + return FALSE; }
-static HRESULT WINAPI DirectDrawMediaStreamInputPin_GetMediaType(BasePin *base, int index, AM_MEDIA_TYPE *media_type) +static HRESULT WINAPI ddraw_sink_ReceiveConnection(IPin *iface, IPin *peer, const AM_MEDIA_TYPE *mt) { - DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(&base->IPin_iface); + struct ddraw_stream *stream = impl_from_IPin(iface); + PIN_DIRECTION dir; + + TRACE("stream %p, peer %p, mt %p.\n", stream, peer, mt); + + EnterCriticalSection(&stream->cs); + + if (stream->peer) + { + LeaveCriticalSection(&stream->cs); + return VFW_E_ALREADY_CONNECTED; + }
- TRACE("(%p)->(%d,%p)\n", This, index, media_type); + if (!check_media_type(mt)) + { + LeaveCriticalSection(&stream->cs); + return VFW_E_TYPE_NOT_ACCEPTED; + } + + IPin_QueryDirection(peer, &dir); + if (dir != PINDIR_OUTPUT) + { + WARN("Rejecting connection from input pin.\n"); + LeaveCriticalSection(&stream->cs); + return VFW_E_INVALID_DIRECTION; + } + + CopyMediaType(&stream->mt, mt); + IPin_AddRef(stream->peer = peer); + + LeaveCriticalSection(&stream->cs); + + return S_OK; +} + +static HRESULT WINAPI ddraw_sink_Disconnect(IPin *iface) +{ + struct ddraw_stream *stream = impl_from_IPin(iface);
- /* FIXME: Reset structure as we only fill majortype and minortype for now */ - ZeroMemory(media_type, sizeof(*media_type)); + TRACE("stream %p.\n", stream);
- media_type->majortype = MEDIATYPE_Video; + EnterCriticalSection(&stream->cs);
- switch (index) + if (!stream->peer) { - case 0: - media_type->subtype = MEDIASUBTYPE_RGB1; - break; - case 1: - media_type->subtype = MEDIASUBTYPE_RGB4; - break; - case 2: - media_type->subtype = MEDIASUBTYPE_RGB8; - break; - case 3: - media_type->subtype = MEDIASUBTYPE_RGB565; - break; - case 4: - media_type->subtype = MEDIASUBTYPE_RGB555; - break; - case 5: - media_type->subtype = MEDIASUBTYPE_RGB24; - break; - case 6: - media_type->subtype = MEDIASUBTYPE_RGB32; - break; - default: - return S_FALSE; + LeaveCriticalSection(&stream->cs); + return S_FALSE; }
+ IPin_Release(stream->peer); + stream->peer = NULL; + FreeMediaType(&stream->mt); + memset(&stream->mt, 0, sizeof(AM_MEDIA_TYPE)); + + LeaveCriticalSection(&stream->cs); + return S_OK; }
-static HRESULT WINAPI DirectDrawMediaStreamInputPin_Receive(BaseInputPin *base, IMediaSample *sample) +static HRESULT WINAPI ddraw_sink_ConnectedTo(IPin *iface, IPin **peer) { - DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(&base->pin.IPin_iface); + struct ddraw_stream *stream = impl_from_IPin(iface); + HRESULT hr;
- FIXME("(%p)->(%p) stub!\n", This, sample); + TRACE("stream %p, peer %p.\n", stream, peer);
- return E_NOTIMPL; + EnterCriticalSection(&stream->cs); + + if (stream->peer) + { + IPin_AddRef(*peer = stream->peer); + hr = S_OK; + } + else + { + *peer = NULL; + hr = VFW_E_NOT_CONNECTED; + } + + LeaveCriticalSection(&stream->cs); + + return hr; }
-static const BaseInputPinFuncTable DirectDrawMediaStreamInputPin_FuncTable = +static HRESULT WINAPI ddraw_sink_ConnectionMediaType(IPin *iface, AM_MEDIA_TYPE *mt) { + struct ddraw_stream *stream = impl_from_IPin(iface); + HRESULT hr; + + TRACE("stream %p, mt %p.\n", stream, mt); + + EnterCriticalSection(&stream->cs); + + if (stream->peer) + { + CopyMediaType(mt, &stream->mt); + hr = S_OK; + } + else { - DirectDrawMediaStreamInputPin_CheckMediaType, - DirectDrawMediaStreamInputPin_GetMediaType, - }, - DirectDrawMediaStreamInputPin_Receive, + memset(mt, 0, sizeof(AM_MEDIA_TYPE)); + hr = VFW_E_NOT_CONNECTED; + } + + LeaveCriticalSection(&stream->cs); + + return hr; +} + +static HRESULT WINAPI ddraw_sink_QueryPinInfo(IPin *iface, PIN_INFO *info) +{ + struct ddraw_stream *stream = impl_from_IPin(iface); + + TRACE("stream %p, info %p.\n", stream, info); + + IBaseFilter_AddRef(info->pFilter = (IBaseFilter *)stream->filter); + info->dir = PINDIR_INPUT; + lstrcpyW(info->achName, sink_id); + + return S_OK; +} + +static HRESULT WINAPI ddraw_sink_QueryDirection(IPin *iface, PIN_DIRECTION *dir) +{ + TRACE("iface %p, dir %p.\n", iface, dir); + *dir = PINDIR_INPUT; + return S_OK; +} + +static HRESULT WINAPI ddraw_sink_QueryId(IPin *iface, WCHAR **id) +{ + TRACE("iface %p, id %p.\n", iface, id); + + if (!(*id = CoTaskMemAlloc(sizeof(sink_id)))) + return E_OUTOFMEMORY; + + lstrcpyW(*id, sink_id); + + return S_OK; +} + +static HRESULT WINAPI ddraw_sink_QueryAccept(IPin *iface, const AM_MEDIA_TYPE *mt) +{ + TRACE("iface %p, mt %p.\n", iface, mt); + return check_media_type(mt) ? S_OK : S_FALSE; +} + +static HRESULT WINAPI ddraw_sink_EnumMediaTypes(IPin *iface, IEnumMediaTypes **enum_media_types) +{ + struct enum_media_types *object; + + TRACE("iface %p, enum_media_types %p.\n", iface, enum_media_types); + + if (!enum_media_types) + return E_POINTER; + + if (!(object = heap_alloc(sizeof(*object)))) + return E_OUTOFMEMORY; + + object->IEnumMediaTypes_iface.lpVtbl = &enum_media_types_vtbl; + object->refcount = 1; + object->index = 0; + + *enum_media_types = &object->IEnumMediaTypes_iface; + return S_OK; +} + +static HRESULT WINAPI ddraw_sink_QueryInternalConnections(IPin *iface, IPin **pins, ULONG *count) +{ + TRACE("iface %p, pins %p, count %p.\n", iface, pins, count); + return E_NOTIMPL; +} + +static HRESULT WINAPI ddraw_sink_EndOfStream(IPin *iface) +{ + FIXME("iface %p, stub!\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI ddraw_sink_BeginFlush(IPin *iface) +{ + FIXME("iface %p, stub!\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI ddraw_sink_EndFlush(IPin *iface) +{ + FIXME("iface %p, stub!\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI ddraw_sink_NewSegment(IPin *iface, REFERENCE_TIME start, REFERENCE_TIME stop, double rate) +{ + FIXME("iface %p, start %s, stop %s, rate %0.16e, stub!\n", + iface, wine_dbgstr_longlong(start), wine_dbgstr_longlong(stop), rate); + return E_NOTIMPL; +} + +static const IPinVtbl ddraw_sink_vtbl = +{ + ddraw_sink_QueryInterface, + ddraw_sink_AddRef, + ddraw_sink_Release, + ddraw_sink_Connect, + ddraw_sink_ReceiveConnection, + ddraw_sink_Disconnect, + ddraw_sink_ConnectedTo, + ddraw_sink_ConnectionMediaType, + ddraw_sink_QueryPinInfo, + ddraw_sink_QueryDirection, + ddraw_sink_QueryId, + ddraw_sink_QueryAccept, + ddraw_sink_EnumMediaTypes, + ddraw_sink_QueryInternalConnections, + ddraw_sink_EndOfStream, + ddraw_sink_BeginFlush, + ddraw_sink_EndFlush, + ddraw_sink_NewSegment, };
static inline struct ddraw_stream *impl_from_IMemInputPin(IMemInputPin *iface) @@ -828,7 +953,6 @@ HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_ IUnknown *stream_object, STREAM_TYPE stream_type, IAMMediaStream **media_stream) { struct ddraw_stream *object; - PIN_INFO pin_info; HRESULT hr;
TRACE("(%p,%s,%p,%p)\n", parent, debugstr_guid(purpose_id), stream_object, media_stream); @@ -840,21 +964,10 @@ HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_ object->IAMMediaStream_iface.lpVtbl = &DirectDrawMediaStreamImpl_IAMMediaStream_Vtbl; object->IDirectDrawMediaStream_iface.lpVtbl = &DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Vtbl; object->IMemInputPin_iface.lpVtbl = &ddraw_meminput_vtbl; + object->IPin_iface.lpVtbl = &ddraw_sink_vtbl; object->ref = 1;
- InitializeCriticalSection(&object->critical_section); - - pin_info.pFilter = NULL; - pin_info.dir = PINDIR_INPUT; - pin_info.achName[0] = 'I'; - StringFromGUID2(purpose_id, pin_info.achName + 1, MAX_PIN_NAME - 1); - hr = BaseInputPin_Construct(&DirectDrawMediaStreamInputPin_IPin_Vtbl, - sizeof(DirectDrawMediaStreamInputPin), &pin_info, &DirectDrawMediaStreamInputPin_FuncTable, - &object->critical_section, NULL, (IPin **)&object->input_pin); - if (FAILED(hr)) - goto out_object; - - object->input_pin->parent = object; + InitializeCriticalSection(&object->cs);
object->parent = parent; object->purpose_id = *purpose_id; @@ -867,11 +980,6 @@ HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_ *media_stream = &object->IAMMediaStream_iface;
return S_OK; - -out_object: - HeapFree(GetProcessHeap(), 0, object); - - return hr; }
typedef struct {
From: Zebediah Figura zfigura@codeweavers.com
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/amstream/amstream_private.h | 4 +- dlls/amstream/ddrawstream.c | 128 +++++++++++++++---------------- dlls/amstream/multimedia.c | 2 +- 3 files changed, 67 insertions(+), 67 deletions(-)
diff --git a/dlls/amstream/amstream_private.h b/dlls/amstream/amstream_private.h index 105ddb13f5c..fb0f0d54bac 100644 --- a/dlls/amstream/amstream_private.h +++ b/dlls/amstream/amstream_private.h @@ -37,8 +37,8 @@ HRESULT multimedia_stream_create(IUnknown *outer, void **out) DECLSPEC_HIDDEN; HRESULT AMAudioData_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN; HRESULT filter_create(IUnknown *outer, void **out) DECLSPEC_HIDDEN; -HRESULT ddrawmediastream_create(IMultiMediaStream *Parent, const MSPID *pPurposeId, - IUnknown *stream_object, STREAM_TYPE StreamType, IAMMediaStream **ppMediaStream) DECLSPEC_HIDDEN; +HRESULT ddraw_stream_create(IMultiMediaStream *parent, const MSPID *purpose_id, + IUnknown *stream_object, STREAM_TYPE type, IAMMediaStream **stream) DECLSPEC_HIDDEN; HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id, IUnknown *stream_object, STREAM_TYPE stream_type, IAMMediaStream **media_stream) DECLSPEC_HIDDEN;
diff --git a/dlls/amstream/ddrawstream.c b/dlls/amstream/ddrawstream.c index 2012de923de..a35a4b1c29c 100644 --- a/dlls/amstream/ddrawstream.c +++ b/dlls/amstream/ddrawstream.c @@ -66,8 +66,8 @@ static inline struct ddraw_stream *impl_from_IAMMediaStream(IAMMediaStream *ifac }
/*** IUnknown methods ***/ -static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_QueryInterface(IAMMediaStream *iface, - REFIID riid, void **ret_iface) +static HRESULT WINAPI ddraw_IAMMediaStream_QueryInterface(IAMMediaStream *iface, + REFIID riid, void **ret_iface) { struct ddraw_stream *This = impl_from_IAMMediaStream(iface);
@@ -104,7 +104,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_QueryInterface(IA return E_NOINTERFACE; }
-static ULONG WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_AddRef(IAMMediaStream *iface) +static ULONG WINAPI ddraw_IAMMediaStream_AddRef(IAMMediaStream *iface) { struct ddraw_stream *This = impl_from_IAMMediaStream(iface); ULONG ref = InterlockedIncrement(&This->ref); @@ -114,7 +114,7 @@ static ULONG WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_AddRef(IAMMediaStre return ref; }
-static ULONG WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_Release(IAMMediaStream *iface) +static ULONG WINAPI ddraw_IAMMediaStream_Release(IAMMediaStream *iface) { struct ddraw_stream *This = impl_from_IAMMediaStream(iface); ULONG ref = InterlockedDecrement(&This->ref); @@ -133,7 +133,7 @@ static ULONG WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_Release(IAMMediaStr }
/*** IMediaStream methods ***/ -static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_GetMultiMediaStream(IAMMediaStream *iface, +static HRESULT WINAPI ddraw_IAMMediaStream_GetMultiMediaStream(IAMMediaStream *iface, IMultiMediaStream** multi_media_stream) { struct ddraw_stream *This = impl_from_IAMMediaStream(iface); @@ -149,7 +149,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_GetMultiMediaStre return S_OK; }
-static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_GetInformation(IAMMediaStream *iface, +static HRESULT WINAPI ddraw_IAMMediaStream_GetInformation(IAMMediaStream *iface, MSPID *purpose_id, STREAM_TYPE *type) { struct ddraw_stream *This = impl_from_IAMMediaStream(iface); @@ -164,7 +164,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_GetInformation(IA return S_OK; }
-static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_SetSameFormat(IAMMediaStream *iface, +static HRESULT WINAPI ddraw_IAMMediaStream_SetSameFormat(IAMMediaStream *iface, IMediaStream *pStreamThatHasDesiredFormat, DWORD flags) { struct ddraw_stream *This = impl_from_IAMMediaStream(iface); @@ -174,7 +174,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_SetSameFormat(IAM return S_FALSE; }
-static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_AllocateSample(IAMMediaStream *iface, +static HRESULT WINAPI ddraw_IAMMediaStream_AllocateSample(IAMMediaStream *iface, DWORD flags, IStreamSample **sample) { struct ddraw_stream *This = impl_from_IAMMediaStream(iface); @@ -184,7 +184,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_AllocateSample(IA return S_FALSE; }
-static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_CreateSharedSample(IAMMediaStream *iface, +static HRESULT WINAPI ddraw_IAMMediaStream_CreateSharedSample(IAMMediaStream *iface, IStreamSample *existing_sample, DWORD flags, IStreamSample **sample) { struct ddraw_stream *This = impl_from_IAMMediaStream(iface); @@ -194,7 +194,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_CreateSharedSampl return S_FALSE; }
-static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_SendEndOfStream(IAMMediaStream *iface, DWORD flags) +static HRESULT WINAPI ddraw_IAMMediaStream_SendEndOfStream(IAMMediaStream *iface, DWORD flags) { struct ddraw_stream *This = impl_from_IAMMediaStream(iface);
@@ -204,7 +204,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_SendEndOfStream(I }
/*** IAMMediaStream methods ***/ -static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_Initialize(IAMMediaStream *iface, IUnknown *source_object, DWORD flags, +static HRESULT WINAPI ddraw_IAMMediaStream_Initialize(IAMMediaStream *iface, IUnknown *source_object, DWORD flags, REFMSPID purpose_id, const STREAM_TYPE stream_type) { struct ddraw_stream *This = impl_from_IAMMediaStream(iface); @@ -214,7 +214,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_Initialize(IAMMed return S_FALSE; }
-static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_SetState(IAMMediaStream *iface, FILTER_STATE state) +static HRESULT WINAPI ddraw_IAMMediaStream_SetState(IAMMediaStream *iface, FILTER_STATE state) { struct ddraw_stream *This = impl_from_IAMMediaStream(iface);
@@ -223,7 +223,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_SetState(IAMMedia return S_FALSE; }
-static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinAMMultiMediaStream(IAMMediaStream *iface, IAMMultiMediaStream *am_multi_media_stream) +static HRESULT WINAPI ddraw_IAMMediaStream_JoinAMMultiMediaStream(IAMMediaStream *iface, IAMMultiMediaStream *am_multi_media_stream) { struct ddraw_stream *This = impl_from_IAMMediaStream(iface);
@@ -232,7 +232,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinAMMultiMediaS return S_FALSE; }
-static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilter(IAMMediaStream *iface, IMediaStreamFilter *filter) +static HRESULT WINAPI ddraw_IAMMediaStream_JoinFilter(IAMMediaStream *iface, IMediaStreamFilter *filter) { struct ddraw_stream *stream = impl_from_IAMMediaStream(iface);
@@ -243,7 +243,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilter(IAMMed return S_OK; }
-static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilterGraph(IAMMediaStream *iface, IFilterGraph *filtergraph) +static HRESULT WINAPI ddraw_IAMMediaStream_JoinFilterGraph(IAMMediaStream *iface, IFilterGraph *filtergraph) { struct ddraw_stream *This = impl_from_IAMMediaStream(iface);
@@ -252,25 +252,25 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilterGraph(I return S_FALSE; }
-static const struct IAMMediaStreamVtbl DirectDrawMediaStreamImpl_IAMMediaStream_Vtbl = +static const struct IAMMediaStreamVtbl ddraw_IAMMediaStream_vtbl = { /*** IUnknown methods ***/ - DirectDrawMediaStreamImpl_IAMMediaStream_QueryInterface, - DirectDrawMediaStreamImpl_IAMMediaStream_AddRef, - DirectDrawMediaStreamImpl_IAMMediaStream_Release, + ddraw_IAMMediaStream_QueryInterface, + ddraw_IAMMediaStream_AddRef, + ddraw_IAMMediaStream_Release, /*** IMediaStream methods ***/ - DirectDrawMediaStreamImpl_IAMMediaStream_GetMultiMediaStream, - DirectDrawMediaStreamImpl_IAMMediaStream_GetInformation, - DirectDrawMediaStreamImpl_IAMMediaStream_SetSameFormat, - DirectDrawMediaStreamImpl_IAMMediaStream_AllocateSample, - DirectDrawMediaStreamImpl_IAMMediaStream_CreateSharedSample, - DirectDrawMediaStreamImpl_IAMMediaStream_SendEndOfStream, + ddraw_IAMMediaStream_GetMultiMediaStream, + ddraw_IAMMediaStream_GetInformation, + ddraw_IAMMediaStream_SetSameFormat, + ddraw_IAMMediaStream_AllocateSample, + ddraw_IAMMediaStream_CreateSharedSample, + ddraw_IAMMediaStream_SendEndOfStream, /*** IAMMediaStream methods ***/ - DirectDrawMediaStreamImpl_IAMMediaStream_Initialize, - DirectDrawMediaStreamImpl_IAMMediaStream_SetState, - DirectDrawMediaStreamImpl_IAMMediaStream_JoinAMMultiMediaStream, - DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilter, - DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilterGraph + ddraw_IAMMediaStream_Initialize, + ddraw_IAMMediaStream_SetState, + ddraw_IAMMediaStream_JoinAMMultiMediaStream, + ddraw_IAMMediaStream_JoinFilter, + ddraw_IAMMediaStream_JoinFilterGraph };
static inline struct ddraw_stream *impl_from_IDirectDrawMediaStream(IDirectDrawMediaStream *iface) @@ -279,7 +279,7 @@ static inline struct ddraw_stream *impl_from_IDirectDrawMediaStream(IDirectDrawM }
/*** IUnknown methods ***/ -static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_QueryInterface(IDirectDrawMediaStream *iface, +static HRESULT WINAPI ddraw_IDirectDrawMediaStream_QueryInterface(IDirectDrawMediaStream *iface, REFIID riid, void **ret_iface) { struct ddraw_stream *This = impl_from_IDirectDrawMediaStream(iface); @@ -287,14 +287,14 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_QueryInte return IAMMediaStream_QueryInterface(&This->IAMMediaStream_iface, riid, ret_iface); }
-static ULONG WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_AddRef(IDirectDrawMediaStream *iface) +static ULONG WINAPI ddraw_IDirectDrawMediaStream_AddRef(IDirectDrawMediaStream *iface) { struct ddraw_stream *This = impl_from_IDirectDrawMediaStream(iface); TRACE("(%p/%p)\n", iface, This); return IAMMediaStream_AddRef(&This->IAMMediaStream_iface); }
-static ULONG WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Release(IDirectDrawMediaStream *iface) +static ULONG WINAPI ddraw_IDirectDrawMediaStream_Release(IDirectDrawMediaStream *iface) { struct ddraw_stream *This = impl_from_IDirectDrawMediaStream(iface); TRACE("(%p/%p)\n", iface, This); @@ -302,7 +302,7 @@ static ULONG WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Release(IDi }
/*** IMediaStream methods ***/ -static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetMultiMediaStream(IDirectDrawMediaStream *iface, +static HRESULT WINAPI ddraw_IDirectDrawMediaStream_GetMultiMediaStream(IDirectDrawMediaStream *iface, IMultiMediaStream **multi_media_stream) { struct ddraw_stream *This = impl_from_IDirectDrawMediaStream(iface); @@ -318,7 +318,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetMultiM return S_OK; }
-static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetInformation(IDirectDrawMediaStream *iface, +static HRESULT WINAPI ddraw_IDirectDrawMediaStream_GetInformation(IDirectDrawMediaStream *iface, MSPID *purpose_id, STREAM_TYPE *type) { struct ddraw_stream *This = impl_from_IDirectDrawMediaStream(iface); @@ -333,7 +333,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetInform return S_OK; }
-static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetSameFormat(IDirectDrawMediaStream *iface, +static HRESULT WINAPI ddraw_IDirectDrawMediaStream_SetSameFormat(IDirectDrawMediaStream *iface, IMediaStream *pStreamThatHasDesiredFormat, DWORD dwFlags) { struct ddraw_stream *This = impl_from_IDirectDrawMediaStream(iface); @@ -343,7 +343,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetSameFo return S_FALSE; }
-static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_AllocateSample(IDirectDrawMediaStream *iface, +static HRESULT WINAPI ddraw_IDirectDrawMediaStream_AllocateSample(IDirectDrawMediaStream *iface, DWORD dwFlags, IStreamSample **ppSample) { struct ddraw_stream *This = impl_from_IDirectDrawMediaStream(iface); @@ -353,7 +353,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_AllocateS return S_FALSE; }
-static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_CreateSharedSample(IDirectDrawMediaStream *iface, +static HRESULT WINAPI ddraw_IDirectDrawMediaStream_CreateSharedSample(IDirectDrawMediaStream *iface, IStreamSample *pExistingSample, DWORD dwFlags, IStreamSample **ppSample) { struct ddraw_stream *This = impl_from_IDirectDrawMediaStream(iface); @@ -363,7 +363,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_CreateSha return S_FALSE; }
-static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SendEndOfStream(IDirectDrawMediaStream *iface, +static HRESULT WINAPI ddraw_IDirectDrawMediaStream_SendEndOfStream(IDirectDrawMediaStream *iface, DWORD dwFlags) { struct ddraw_stream *This = impl_from_IDirectDrawMediaStream(iface); @@ -374,7 +374,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SendEndOf }
/*** IDirectDrawMediaStream methods ***/ -static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetFormat(IDirectDrawMediaStream *iface, +static HRESULT WINAPI ddraw_IDirectDrawMediaStream_GetFormat(IDirectDrawMediaStream *iface, DDSURFACEDESC *current_format, IDirectDrawPalette **palette, DDSURFACEDESC *desired_format, DWORD *flags) { @@ -385,7 +385,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetFormat
}
-static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetFormat(IDirectDrawMediaStream *iface, +static HRESULT WINAPI ddraw_IDirectDrawMediaStream_SetFormat(IDirectDrawMediaStream *iface, const DDSURFACEDESC *pDDSurfaceDesc, IDirectDrawPalette *pDirectDrawPalette) { FIXME("(%p)->(%p,%p) stub!\n", iface, pDDSurfaceDesc, pDirectDrawPalette); @@ -393,7 +393,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetFormat return E_NOTIMPL; }
-static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetDirectDraw(IDirectDrawMediaStream *iface, +static HRESULT WINAPI ddraw_IDirectDrawMediaStream_GetDirectDraw(IDirectDrawMediaStream *iface, IDirectDraw **ddraw) { struct ddraw_stream *This = impl_from_IDirectDrawMediaStream(iface); @@ -412,7 +412,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetDirect return IDirectDraw7_QueryInterface(This->ddraw, &IID_IDirectDraw, (void**)ddraw); }
-static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetDirectDraw(IDirectDrawMediaStream *iface, +static HRESULT WINAPI ddraw_IDirectDrawMediaStream_SetDirectDraw(IDirectDrawMediaStream *iface, IDirectDraw *pDirectDraw) { FIXME("(%p)->(%p) stub!\n", iface, pDirectDraw); @@ -420,7 +420,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetDirect return E_NOTIMPL; }
-static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_CreateSample(IDirectDrawMediaStream *iface, +static HRESULT WINAPI ddraw_IDirectDrawMediaStream_CreateSample(IDirectDrawMediaStream *iface, IDirectDrawSurface *surface, const RECT *rect, DWORD dwFlags, IDirectDrawStreamSample **ppSample) { @@ -429,7 +429,7 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_CreateSam return ddrawstreamsample_create(iface, surface, rect, ppSample); }
-static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetTimePerFrame(IDirectDrawMediaStream *iface, +static HRESULT WINAPI ddraw_IDirectDrawMediaStream_GetTimePerFrame(IDirectDrawMediaStream *iface, STREAM_TIME *pFrameTime) { FIXME("(%p)->(%p) stub!\n", iface, pFrameTime); @@ -437,26 +437,26 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetTimePe return E_NOTIMPL; }
-static const struct IDirectDrawMediaStreamVtbl DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Vtbl = +static const struct IDirectDrawMediaStreamVtbl ddraw_IDirectDrawMediaStream_Vtbl = { /*** IUnknown methods ***/ - DirectDrawMediaStreamImpl_IDirectDrawMediaStream_QueryInterface, - DirectDrawMediaStreamImpl_IDirectDrawMediaStream_AddRef, - DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Release, + ddraw_IDirectDrawMediaStream_QueryInterface, + ddraw_IDirectDrawMediaStream_AddRef, + ddraw_IDirectDrawMediaStream_Release, /*** IMediaStream methods ***/ - DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetMultiMediaStream, - DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetInformation, - DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetSameFormat, - DirectDrawMediaStreamImpl_IDirectDrawMediaStream_AllocateSample, - DirectDrawMediaStreamImpl_IDirectDrawMediaStream_CreateSharedSample, - DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SendEndOfStream, + ddraw_IDirectDrawMediaStream_GetMultiMediaStream, + ddraw_IDirectDrawMediaStream_GetInformation, + ddraw_IDirectDrawMediaStream_SetSameFormat, + ddraw_IDirectDrawMediaStream_AllocateSample, + ddraw_IDirectDrawMediaStream_CreateSharedSample, + ddraw_IDirectDrawMediaStream_SendEndOfStream, /*** IDirectDrawMediaStream methods ***/ - DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetFormat, - DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetFormat, - DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetDirectDraw, - DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetDirectDraw, - DirectDrawMediaStreamImpl_IDirectDrawMediaStream_CreateSample, - DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetTimePerFrame + ddraw_IDirectDrawMediaStream_GetFormat, + ddraw_IDirectDrawMediaStream_SetFormat, + ddraw_IDirectDrawMediaStream_GetDirectDraw, + ddraw_IDirectDrawMediaStream_SetDirectDraw, + ddraw_IDirectDrawMediaStream_CreateSample, + ddraw_IDirectDrawMediaStream_GetTimePerFrame };
struct enum_media_types @@ -949,7 +949,7 @@ static const IMemInputPinVtbl ddraw_meminput_vtbl = ddraw_meminput_ReceiveCanBlock, };
-HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id, +HRESULT ddraw_stream_create(IMultiMediaStream *parent, const MSPID *purpose_id, IUnknown *stream_object, STREAM_TYPE stream_type, IAMMediaStream **media_stream) { struct ddraw_stream *object; @@ -961,8 +961,8 @@ HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_ if (!object) return E_OUTOFMEMORY;
- object->IAMMediaStream_iface.lpVtbl = &DirectDrawMediaStreamImpl_IAMMediaStream_Vtbl; - object->IDirectDrawMediaStream_iface.lpVtbl = &DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Vtbl; + object->IAMMediaStream_iface.lpVtbl = &ddraw_IAMMediaStream_vtbl; + object->IDirectDrawMediaStream_iface.lpVtbl = &ddraw_IDirectDrawMediaStream_Vtbl; object->IMemInputPin_iface.lpVtbl = &ddraw_meminput_vtbl; object->IPin_iface.lpVtbl = &ddraw_sink_vtbl; object->ref = 1; diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c index 55c13286eee..0f3fa05b18b 100644 --- a/dlls/amstream/multimedia.c +++ b/dlls/amstream/multimedia.c @@ -322,7 +322,7 @@ static HRESULT WINAPI multimedia_stream_AddMediaStream(IAMMultiMediaStream *ifac }
if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo)) - hr = ddrawmediastream_create((IMultiMediaStream*)iface, PurposeId, stream_object, This->StreamType, &pStream); + hr = ddraw_stream_create((IMultiMediaStream*)iface, PurposeId, stream_object, This->StreamType, &pStream); else hr = audiomediastream_create((IMultiMediaStream*)iface, PurposeId, stream_object, This->StreamType, &pStream);
From: Zebediah Figura zfigura@codeweavers.com
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/amstream/tests/amstream.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 9176622ab04..e494ca8632f 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -31,6 +31,9 @@ static const WCHAR primary_video_sink_id[] = {'I','{','A','3','5','F','F','5','6','A', '-','9','F','D','A','-','1','1','D','0','-','8','F','D','F', '-','0','0','C','0','4','F','D','9','1','8','9','D','}',0}; +static const WCHAR primary_audio_sink_id[] = {'I','{','A','3','5','F','F','5','6','B', + '-','9','F','D','A','-','1','1','D','0','-','8','F','D','F', + '-','0','0','C','0','4','F','D','9','1','8','9','D','}',0};
#define EXPECT_REF(obj,ref) _expect_ref((IUnknown*)obj, ref, __LINE__) static void _expect_ref(IUnknown* obj, ULONG ref, int line) @@ -1268,6 +1271,35 @@ static void test_pin_info(void) ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
IPin_Release(pin); + IMediaStream_Release(stream); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryAudio, 0, &stream); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaStream_QueryInterface(stream, &IID_IPin, (void **)&pin); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IPin_QueryPinInfo(pin, &info); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(info.pFilter == (IBaseFilter *)filter, "Expected filter %p, got %p.\n", filter, info.pFilter); + ok(info.dir == PINDIR_INPUT, "Got direction %d.\n", info.dir); + ok(!lstrcmpW(info.achName, primary_audio_sink_id), "Got name %s.\n", wine_dbgstr_w(info.achName)); + IBaseFilter_Release(info.pFilter); + + hr = IPin_QueryDirection(pin, &dir); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir); + + hr = IPin_QueryId(pin, &id); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!lstrcmpW(id, primary_audio_sink_id), "Got id %s.\n", wine_dbgstr_w(id)); + CoTaskMemFree(id); + + hr = IPin_QueryInternalConnections(pin, NULL, &count); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + + IPin_Release(pin); + IMediaStream_Release(stream); + IMediaStreamFilter_Release(filter); ref = IAMMultiMediaStream_Release(mmstream); ok(!ref, "Got outstanding refcount %d.\n", ref);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/amstream/audiostream.c | 143 ++++++++++++++++++++++++++++++++- dlls/amstream/tests/amstream.c | 49 ++++++----- 2 files changed, 165 insertions(+), 27 deletions(-)
diff --git a/dlls/amstream/audiostream.c b/dlls/amstream/audiostream.c index 6888137f8cf..bae4d5fae2b 100644 --- a/dlls/amstream/audiostream.c +++ b/dlls/amstream/audiostream.c @@ -549,6 +549,127 @@ static const struct IAudioMediaStreamVtbl AudioMediaStreamImpl_IAudioMediaStream AudioMediaStreamImpl_IAudioMediaStream_CreateSample };
+struct enum_media_types +{ + IEnumMediaTypes IEnumMediaTypes_iface; + LONG refcount; + unsigned int index; +}; + +static const IEnumMediaTypesVtbl enum_media_types_vtbl; + +static struct enum_media_types *impl_from_IEnumMediaTypes(IEnumMediaTypes *iface) +{ + return CONTAINING_RECORD(iface, struct enum_media_types, IEnumMediaTypes_iface); +} + +static HRESULT WINAPI enum_media_types_QueryInterface(IEnumMediaTypes *iface, REFIID iid, void **out) +{ + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IEnumMediaTypes)) + { + IEnumMediaTypes_AddRef(iface); + *out = iface; + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI enum_media_types_AddRef(IEnumMediaTypes *iface) +{ + struct enum_media_types *enum_media_types = impl_from_IEnumMediaTypes(iface); + ULONG refcount = InterlockedIncrement(&enum_media_types->refcount); + TRACE("%p increasing refcount to %u.\n", enum_media_types, refcount); + return refcount; +} + +static ULONG WINAPI enum_media_types_Release(IEnumMediaTypes *iface) +{ + struct enum_media_types *enum_media_types = impl_from_IEnumMediaTypes(iface); + ULONG refcount = InterlockedDecrement(&enum_media_types->refcount); + TRACE("%p decreasing refcount to %u.\n", enum_media_types, refcount); + if (!refcount) + heap_free(enum_media_types); + return refcount; +} + +static HRESULT WINAPI enum_media_types_Next(IEnumMediaTypes *iface, ULONG count, AM_MEDIA_TYPE **mts, ULONG *ret_count) +{ + struct enum_media_types *enum_media_types = impl_from_IEnumMediaTypes(iface); + + TRACE("iface %p, count %u, mts %p, ret_count %p.\n", iface, count, mts, ret_count); + + if (!ret_count) + return E_POINTER; + + if (count && !enum_media_types->index) + { + mts[0] = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); + memset(mts[0], 0, sizeof(AM_MEDIA_TYPE)); + mts[0]->majortype = MEDIATYPE_Audio; + mts[0]->subtype = MEDIASUBTYPE_PCM; + ++enum_media_types->index; + *ret_count = 1; + return count == 1 ? S_OK : S_FALSE; + } + + *ret_count = 0; + return count ? S_FALSE : S_OK; +} + +static HRESULT WINAPI enum_media_types_Skip(IEnumMediaTypes *iface, ULONG count) +{ + struct enum_media_types *enum_media_types = impl_from_IEnumMediaTypes(iface); + + TRACE("iface %p, count %u.\n", iface, count); + + enum_media_types->index += count; + return S_OK; +} + +static HRESULT WINAPI enum_media_types_Reset(IEnumMediaTypes *iface) +{ + struct enum_media_types *enum_media_types = impl_from_IEnumMediaTypes(iface); + + TRACE("iface %p.\n", iface); + + enum_media_types->index = 0; + return S_OK; +} + +static HRESULT WINAPI enum_media_types_Clone(IEnumMediaTypes *iface, IEnumMediaTypes **out) +{ + struct enum_media_types *enum_media_types = impl_from_IEnumMediaTypes(iface); + struct enum_media_types *object; + + TRACE("iface %p, out %p.\n", iface, out); + + if (!(object = heap_alloc(sizeof(*object)))) + return E_OUTOFMEMORY; + + object->IEnumMediaTypes_iface.lpVtbl = &enum_media_types_vtbl; + object->refcount = 1; + object->index = enum_media_types->index; + + *out = &object->IEnumMediaTypes_iface; + return S_OK; +} + +static const IEnumMediaTypesVtbl enum_media_types_vtbl = +{ + enum_media_types_QueryInterface, + enum_media_types_AddRef, + enum_media_types_Release, + enum_media_types_Next, + enum_media_types_Skip, + enum_media_types_Reset, + enum_media_types_Clone, +}; + static inline AudioMediaStreamInputPin *impl_from_AudioMediaStreamInputPin_IPin(IPin *iface) { return CONTAINING_RECORD(iface, AudioMediaStreamInputPin, pin.pin.IPin_iface); @@ -576,6 +697,26 @@ static ULONG WINAPI AudioMediaStreamInputPin_IPin_Release(IPin *iface) return IAMMediaStream_Release(&This->parent->IAMMediaStream_iface); }
+static HRESULT WINAPI audio_sink_EnumMediaTypes(IPin *iface, IEnumMediaTypes **enum_media_types) +{ + struct enum_media_types *object; + + TRACE("iface %p, enum_media_types %p.\n", iface, enum_media_types); + + if (!enum_media_types) + return E_POINTER; + + if (!(object = heap_alloc(sizeof(*object)))) + return E_OUTOFMEMORY; + + object->IEnumMediaTypes_iface.lpVtbl = &enum_media_types_vtbl; + object->refcount = 1; + object->index = 0; + + *enum_media_types = &object->IEnumMediaTypes_iface; + return S_OK; +} + static const IPinVtbl AudioMediaStreamInputPin_IPin_Vtbl = { AudioMediaStreamInputPin_IPin_QueryInterface, @@ -590,7 +731,7 @@ static const IPinVtbl AudioMediaStreamInputPin_IPin_Vtbl = BasePinImpl_QueryDirection, BasePinImpl_QueryId, BasePinImpl_QueryAccept, - BasePinImpl_EnumMediaTypes, + audio_sink_EnumMediaTypes, BasePinImpl_QueryInternalConnections, BaseInputPinImpl_EndOfStream, BaseInputPinImpl_BeginFlush, diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index e494ca8632f..fd192cebbb4 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -1736,17 +1736,17 @@ static void test_enum_media_types(void) ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); - todo_wine ok(hr == E_POINTER, "Got hr %#x.\n", hr); + ok(hr == E_POINTER, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Next(enum1, 0, mts, &count); ok(hr == S_OK, "Got hr %#x.\n", hr); ok(!count, "Got count %u.\n", count);
hr = IEnumMediaTypes_Next(enum1, 1, mts, &count); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); - todo_wine ok(count == 1, "Got count %u.\n", count); - if (hr == S_OK) CoTaskMemFree(mts[0]->pbFormat); - if (hr == S_OK) CoTaskMemFree(mts[0]); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(count == 1, "Got count %u.\n", count); + CoTaskMemFree(mts[0]->pbFormat); + CoTaskMemFree(mts[0]);
hr = IEnumMediaTypes_Next(enum1, 1, mts, &count); ok(hr == S_FALSE, "Got hr %#x.\n", hr); @@ -1768,7 +1768,7 @@ static void test_enum_media_types(void) ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Skip(enum1, 2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Next(enum1, 1, mts, &count); ok(hr == S_FALSE, "Got hr %#x.\n", hr); @@ -1902,29 +1902,26 @@ static void test_media_types(void) ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL); - todo_wine ok(hr == E_POINTER, "Got hr %#x.\n", hr); + ok(hr == E_POINTER, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Next(enummt, 1, &pmt, &count); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); - if (hr == S_OK) - { - ok(count == 1, "Got count %u.\n", count); - ok(IsEqualGUID(&pmt->majortype, &MEDIATYPE_Audio), "Got major type %s\n", - wine_dbgstr_guid(&pmt->majortype)); - todo_wine ok(IsEqualGUID(&pmt->subtype, &GUID_NULL), "Got subtype %s\n", - wine_dbgstr_guid(&pmt->subtype)); - todo_wine ok(pmt->bFixedSizeSamples == TRUE, "Got fixed size %d.\n", pmt->bFixedSizeSamples); - ok(!pmt->bTemporalCompression, "Got temporal compression %d.\n", pmt->bTemporalCompression); - todo_wine ok(pmt->lSampleSize == 2, "Got sample size %u.\n", pmt->lSampleSize); - ok(IsEqualGUID(&pmt->formattype, &FORMAT_WaveFormatEx), "Got format type %s.\n", - wine_dbgstr_guid(&pmt->formattype)); - ok(!pmt->pUnk, "Got pUnk %p.\n", pmt->pUnk); - ok(pmt->cbFormat == sizeof(WAVEFORMATEX), "Got format size %u.\n", pmt->cbFormat); - ok(!memcmp(pmt->pbFormat, &expect_wfx, sizeof(WAVEFORMATEX)), "Format blocks didn't match.\n"); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(count == 1, "Got count %u.\n", count); + ok(IsEqualGUID(&pmt->majortype, &MEDIATYPE_Audio), "Got major type %s\n", + wine_dbgstr_guid(&pmt->majortype)); + todo_wine ok(IsEqualGUID(&pmt->subtype, &GUID_NULL), "Got subtype %s\n", + wine_dbgstr_guid(&pmt->subtype)); + todo_wine ok(pmt->bFixedSizeSamples == TRUE, "Got fixed size %d.\n", pmt->bFixedSizeSamples); + ok(!pmt->bTemporalCompression, "Got temporal compression %d.\n", pmt->bTemporalCompression); + todo_wine ok(pmt->lSampleSize == 2, "Got sample size %u.\n", pmt->lSampleSize); + todo_wine ok(IsEqualGUID(&pmt->formattype, &FORMAT_WaveFormatEx), "Got format type %s.\n", + wine_dbgstr_guid(&pmt->formattype)); + ok(!pmt->pUnk, "Got pUnk %p.\n", pmt->pUnk); + todo_wine ok(pmt->cbFormat == sizeof(WAVEFORMATEX), "Got format size %u.\n", pmt->cbFormat); + ok(!memcmp(pmt->pbFormat, &expect_wfx, pmt->cbFormat), "Format blocks didn't match.\n");
- hr = IPin_QueryAccept(pin, pmt); - ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); - } + hr = IPin_QueryAccept(pin, pmt); + todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
CoTaskMemFree(pmt);