From: Zebediah Figura zfigura@codeweavers.com
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/amstream/tests/amstream.c | 623 ++++++++++++++++++++++++++++----- 1 file changed, 544 insertions(+), 79 deletions(-)
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 1089de5e90f..289e936e18d 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -305,13 +305,555 @@ error: IAMMultiMediaStream_Release(pams); }
+static const GUID test_mspid = {0x88888888}; +static IAMMediaStream teststream; +static LONG teststream_refcount = 1; +static IAMMultiMediaStream *teststream_mmstream; +static IMediaStreamFilter *teststream_filter; +static IFilterGraph *teststream_graph; + +static HRESULT WINAPI pin_QueryInterface(IPin *iface, REFIID iid, void **out) +{ + return IAMMediaStream_QueryInterface(&teststream, iid, out); +} + +static ULONG WINAPI pin_AddRef(IPin *iface) +{ + return IAMMediaStream_AddRef(&teststream); +} + +static ULONG WINAPI pin_Release(IPin *iface) +{ + return IAMMediaStream_Release(&teststream); +} + +static HRESULT WINAPI pin_Connect(IPin *iface, IPin *peer, const AM_MEDIA_TYPE *mt) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI pin_ReceiveConnection(IPin *iface, IPin *peer, const AM_MEDIA_TYPE *mt) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI pin_Disconnect(IPin *iface) +{ + if (winetest_debug > 1) trace("Disconnect\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI pin_ConnectedTo(IPin *iface, IPin **peer) +{ + if (winetest_debug > 1) trace("ConnectedTo\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI pin_ConnectionMediaType(IPin *iface, AM_MEDIA_TYPE *mt) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI pin_QueryPinInfo(IPin *iface, PIN_INFO *info) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI pin_QueryDirection(IPin *iface, PIN_DIRECTION *dir) +{ + if (winetest_debug > 1) trace("QueryDirection\n"); + *dir = PINDIR_INPUT; + return S_OK; +} + +static HRESULT WINAPI pin_QueryId(IPin *iface, WCHAR **id) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI pin_QueryAccept(IPin *iface, const AM_MEDIA_TYPE *mt) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI pin_EnumMediaTypes(IPin *iface, IEnumMediaTypes **out) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI pin_QueryInternalConnections(IPin *iface, IPin **pins, ULONG *count) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI pin_EndOfStream(IPin *iface) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI pin_BeginFlush(IPin *iface) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI pin_EndFlush(IPin *iface) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI pin_NewSegment(IPin *iface, REFERENCE_TIME start, REFERENCE_TIME stop, double rate) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static const IPinVtbl pin_vtbl = +{ + pin_QueryInterface, + pin_AddRef, + pin_Release, + pin_Connect, + pin_ReceiveConnection, + pin_Disconnect, + pin_ConnectedTo, + pin_ConnectionMediaType, + pin_QueryPinInfo, + pin_QueryDirection, + pin_QueryId, + pin_QueryAccept, + pin_EnumMediaTypes, + pin_QueryInternalConnections, + pin_EndOfStream, + pin_BeginFlush, + pin_EndFlush, + pin_NewSegment +}; + +static IPin testpin = {&pin_vtbl}; + +static HRESULT WINAPI stream_QueryInterface(IAMMediaStream *iface, REFIID iid, void **out) +{ + if (winetest_debug > 1) trace("QueryInterface(%s)\n", wine_dbgstr_guid(iid)); + + if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IMediaStream) || IsEqualGUID(iid, &IID_IAMMediaStream)) + { + IAMMediaStream_AddRef(iface); + *out = iface; + return S_OK; + } + else if (IsEqualGUID(iid, &IID_IPin)) + { + IAMMediaStream_AddRef(iface); + *out = &testpin; + return S_OK; + } + + ok(0, "Unexpected interface %s.\n", wine_dbgstr_guid(iid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI stream_AddRef(IAMMediaStream *iface) +{ + return InterlockedIncrement(&teststream_refcount); +} + +static ULONG WINAPI stream_Release(IAMMediaStream *iface) +{ + return InterlockedDecrement(&teststream_refcount); +} + +static HRESULT WINAPI stream_GetMultiMediaStream(IAMMediaStream *iface, IMultiMediaStream **mmstream) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI stream_GetInformation(IAMMediaStream *iface, MSPID *id, STREAM_TYPE *type) +{ + if (winetest_debug > 1) trace("GetInformation(%p, %p)\n", id, type); + *id = test_mspid; + ok(!type, "Got unexpected type %p.\n", type); + return S_OK; +} + +static HRESULT WINAPI stream_SetSameFormat(IAMMediaStream *iface, IMediaStream *ref, DWORD flags) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI stream_AllocateSample(IAMMediaStream *iface, DWORD flags, IStreamSample **sample) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI stream_CreateSharedSample(IAMMediaStream *iface, + IStreamSample *existing, DWORD flags, IStreamSample **out) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI stream_SendEndOfStream(IAMMediaStream *iface, DWORD flags) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI stream_Initialize(IAMMediaStream *iface, IUnknown *source, + DWORD flags, REFMSPID id, const STREAM_TYPE type) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI stream_SetState(IAMMediaStream *iface, FILTER_STATE state) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI stream_JoinAMMultiMediaStream(IAMMediaStream *iface, IAMMultiMediaStream *mmstream) +{ + if (winetest_debug > 1) trace("JoinAMMultiMediaStream(%p)\n", mmstream); + teststream_mmstream = mmstream; + return S_OK; +} + +static HRESULT WINAPI stream_JoinFilter(IAMMediaStream *iface, IMediaStreamFilter *filter) +{ + if (winetest_debug > 1) trace("JoinFilter(%p)\n", filter); + teststream_filter = filter; + return S_OK; +} + +static HRESULT WINAPI stream_JoinFilterGraph(IAMMediaStream *iface, IFilterGraph *graph) +{ + if (winetest_debug > 1) trace("JoinFilterGraph(%p)\n", graph); + teststream_graph = graph; + return S_OK; +} + +static const IAMMediaStreamVtbl stream_vtbl = +{ + stream_QueryInterface, + stream_AddRef, + stream_Release, + stream_GetMultiMediaStream, + stream_GetInformation, + stream_SetSameFormat, + stream_AllocateSample, + stream_CreateSharedSample, + stream_SendEndOfStream, + stream_Initialize, + stream_SetState, + stream_JoinAMMultiMediaStream, + stream_JoinFilter, + stream_JoinFilterGraph, +}; + +static IAMMediaStream teststream = {&stream_vtbl}; + +#define check_enum_stream(a,b,c,d) check_enum_stream_(__LINE__,a,b,c,d) +static void check_enum_stream_(int line, IAMMultiMediaStream *mmstream, + IMediaStreamFilter *filter, LONG index, IMediaStream *expect) +{ + IMediaStream *stream = NULL, *stream2 = NULL; + HRESULT hr; + + hr = IAMMultiMediaStream_EnumMediaStreams(mmstream, index, &stream); + todo_wine ok_(__FILE__, line)(hr == (expect ? S_OK : S_FALSE), + "IAMMultiMediaStream::EnumMediaStreams() returned %#x.\n", hr); + hr = IMediaStreamFilter_EnumMediaStreams(filter, index, &stream2); + todo_wine ok_(__FILE__, line)(hr == (expect ? S_OK : S_FALSE), + "IMediaStreamFilter::EnumMediaStreams() returned %#x.\n", hr); + if (hr == S_OK) + { + ok_(__FILE__, line)(stream == expect, "Expected stream %p, got %p.\n", expect, stream); + ok_(__FILE__, line)(stream2 == expect, "Expected stream %p, got %p.\n", expect, stream2); + } + + if (stream) IMediaStream_Release(stream); + if (stream2) IMediaStream_Release(stream2); +} + +#define check_get_stream(a,b,c,d) check_get_stream_(__LINE__,a,b,c,d) +static void check_get_stream_(int line, IAMMultiMediaStream *mmstream, + IMediaStreamFilter *filter, const GUID *mspid, IMediaStream *expect) +{ + IMediaStream *stream = NULL, *stream2 = NULL; + HRESULT hr; + + hr = IAMMultiMediaStream_GetMediaStream(mmstream, mspid, &stream); + ok_(__FILE__, line)(hr == (expect ? S_OK : MS_E_NOSTREAM), + "IAMMultiMediaStream::GetMediaStream() returned %#x.\n", hr); + hr = IMediaStreamFilter_GetMediaStream(filter, mspid, &stream2); + ok_(__FILE__, line)(hr == (expect ? S_OK : MS_E_NOSTREAM), + "IMediaStreamFilter::GetMediaStream() returned %#x.\n", hr); + if (hr == S_OK) + { + ok_(__FILE__, line)(stream == expect, "Expected stream %p, got %p.\n", expect, stream); + ok_(__FILE__, line)(stream2 == expect, "Expected stream %p, got %p.\n", expect, stream2); + } + + if (stream) IMediaStream_Release(stream); + if (stream2) IMediaStream_Release(stream2); +} + +static void test_add_stream(void) +{ + IAMMultiMediaStream *mmstream = create_ammultimediastream(); + IMediaStream *video_stream, *audio_stream, *stream; + IDirectDrawMediaStream *ddraw_stream; + IMediaStreamFilter *stream_filter; + IDirectDraw *ddraw, *ddraw2; + IEnumFilters *enum_filters; + IBaseFilter *filters[3]; + IGraphBuilder *graph; + ULONG ref, count; + CLSID clsid; + HRESULT hr; + + hr = IAMMultiMediaStream_GetFilter(mmstream, &stream_filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IAMMultiMediaStream_EnumMediaStreams(mmstream, 0, NULL); + todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + hr = IMediaStreamFilter_EnumMediaStreams(stream_filter, 0, NULL); + todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IAMMultiMediaStream_GetMediaStream(mmstream, &MSPID_PrimaryAudio, NULL); + todo_wine ok(hr == E_POINTER, "Got hr %#x.\n", hr); + hr = IMediaStreamFilter_GetMediaStream(stream_filter, &MSPID_PrimaryAudio, NULL); + todo_wine ok(hr == E_POINTER, "Got hr %#x.\n", hr); + + check_enum_stream(mmstream, stream_filter, 0, NULL); + + check_get_stream(mmstream, stream_filter, NULL, NULL); + check_get_stream(mmstream, stream_filter, &MSPID_PrimaryAudio, NULL); + check_get_stream(mmstream, stream_filter, &MSPID_PrimaryVideo, NULL); + check_get_stream(mmstream, stream_filter, &test_mspid, NULL); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &test_mspid, 0, &stream); + ok(hr == MS_E_PURPOSEID, "Got hr %#x.\n", hr); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, 0, &video_stream); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, 0, &stream); + todo_wine ok(hr == MS_E_PURPOSEID, "Got hr %#x.\n", hr); + + hr = IAMMultiMediaStream_EnumMediaStreams(mmstream, 0, NULL); + todo_wine ok(hr == E_POINTER, "Got hr %#x.\n", hr); + hr = IMediaStreamFilter_EnumMediaStreams(stream_filter, 0, NULL); + todo_wine ok(hr == E_POINTER, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_EnumMediaStreams(mmstream, 1, NULL); + todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + hr = IMediaStreamFilter_EnumMediaStreams(stream_filter, 1, NULL); + todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + check_enum_stream(mmstream, stream_filter, 0, video_stream); + check_enum_stream(mmstream, stream_filter, 1, NULL); + + check_get_stream(mmstream, stream_filter, &MSPID_PrimaryVideo, video_stream); + check_get_stream(mmstream, stream_filter, &MSPID_PrimaryAudio, NULL); + check_get_stream(mmstream, stream_filter, &test_mspid, NULL); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryAudio, 0, &audio_stream); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + check_enum_stream(mmstream, stream_filter, 0, video_stream); + check_enum_stream(mmstream, stream_filter, 1, audio_stream); + check_enum_stream(mmstream, stream_filter, 2, NULL); + + check_get_stream(mmstream, stream_filter, &MSPID_PrimaryVideo, video_stream); + check_get_stream(mmstream, stream_filter, &MSPID_PrimaryAudio, audio_stream); + check_get_stream(mmstream, stream_filter, &test_mspid, NULL); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, (IUnknown *)&teststream, &IID_IUnknown, 0, &stream); + ok(hr == MS_E_PURPOSEID, "Got hr %#x.\n", hr); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, (IUnknown *)&teststream, &test_mspid, 0, &stream); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(stream == (IMediaStream *)&teststream, "Streams didn't match.\n"); + if (hr == S_OK) IMediaStream_Release(stream); + todo_wine ok(teststream_mmstream == mmstream, "IAMMultiMediaStream objects didn't match.\n"); + todo_wine ok(teststream_filter == stream_filter, "IMediaStreamFilter objects didn't match.\n"); + todo_wine ok(!!teststream_graph, "Expected a non-NULL graph.\n"); + + check_enum_stream(mmstream, stream_filter, 0, video_stream); + check_enum_stream(mmstream, stream_filter, 1, audio_stream); + check_enum_stream(mmstream, stream_filter, 2, (IMediaStream *)&teststream); + check_enum_stream(mmstream, stream_filter, 3, NULL); + + check_get_stream(mmstream, stream_filter, &MSPID_PrimaryVideo, video_stream); + check_get_stream(mmstream, stream_filter, &MSPID_PrimaryAudio, audio_stream); + todo_wine check_get_stream(mmstream, stream_filter, &test_mspid, (IMediaStream *)&teststream); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, 0, &stream); + todo_wine ok(hr == MS_E_PURPOSEID, "Got hr %#x.\n", hr); + + hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &graph); + ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(!!graph, "Expected a non-NULL graph.\n"); + if (graph) + { + hr = IGraphBuilder_EnumFilters(graph, &enum_filters); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IEnumFilters_Next(enum_filters, 3, filters, &count); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(count == 1, "Got count %u.\n", count); + ok(filters[0] == (IBaseFilter *)stream_filter, + "Expected filter %p, got %p.\n", stream_filter, filters[0]); + IBaseFilter_Release(filters[0]); + IEnumFilters_Release(enum_filters); + IGraphBuilder_Release(graph); + } + + IMediaStreamFilter_Release(stream_filter); + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ref = IMediaStream_Release(video_stream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ref = IMediaStream_Release(audio_stream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ok(teststream_refcount == 1, "Got outstanding refcount %d.\n", ref); + + /* The return parameter is optional. */ + + mmstream = create_ammultimediastream(); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IAMMultiMediaStream_GetMediaStream(mmstream, &MSPID_PrimaryVideo, &stream); + ok(hr == S_OK, "Got hr %#x.\n", hr); + IMediaStream_Release(stream); + + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + + /* Test supplying a DirectDraw object with the primary video stream. */ + + hr = DirectDrawCreate(NULL, &ddraw, NULL); + ok(hr == DD_OK, "Got hr %#x.\n", hr); + mmstream = create_ammultimediastream(); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, (IUnknown *)ddraw, &MSPID_PrimaryVideo, 0, &video_stream); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaStream_QueryInterface(video_stream, &IID_IDirectDrawMediaStream, (void **)&ddraw_stream); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IDirectDrawMediaStream_GetDirectDraw(ddraw_stream, &ddraw2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(ddraw2 == ddraw, "Expected IDirectDraw %p, got %p.\n", ddraw, ddraw2); + IDirectDraw_Release(ddraw2); + IDirectDrawMediaStream_Release(ddraw_stream); + + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ref = IMediaStream_Release(video_stream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ref = IDirectDraw_Release(ddraw); + ok(!ref, "Got outstanding refcount %d.\n", ref); + + mmstream = create_ammultimediastream(); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, 0, &video_stream); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaStream_QueryInterface(video_stream, &IID_IDirectDrawMediaStream, (void **)&ddraw_stream); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IDirectDrawMediaStream_GetDirectDraw(ddraw_stream, &ddraw); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!!ddraw, "Expected a non-NULL IDirectDraw.\n"); + IDirectDraw_Release(ddraw); + IDirectDrawMediaStream_Release(ddraw_stream); + + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ref = IMediaStream_Release(video_stream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + + /* Test the AMMSF_ADDDEFAULTRENDERER flag. No stream is added; however, a + * new filter will be added to the graph. */ + + mmstream = create_ammultimediastream(); + hr = IAMMultiMediaStream_GetFilter(mmstream, &stream_filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + /* FIXME: This call should not be necessary. */ + hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_READ, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, + AMMSF_ADDDEFAULTRENDERER, &video_stream); + todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, + AMMSF_ADDDEFAULTRENDERER, NULL); + ok(hr == MS_E_PURPOSEID, "Got hr %#x.\n", hr); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryAudio, + AMMSF_ADDDEFAULTRENDERER, &audio_stream); + todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryAudio, + AMMSF_ADDDEFAULTRENDERER, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + check_enum_stream(mmstream, stream_filter, 0, NULL); + + check_get_stream(mmstream, stream_filter, &MSPID_PrimaryAudio, NULL); + check_get_stream(mmstream, stream_filter, &MSPID_PrimaryVideo, NULL); + + hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &graph); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!!graph, "Got graph %p.\n", graph); + hr = IAMMultiMediaStream_GetFilter(mmstream, &stream_filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IGraphBuilder_EnumFilters(graph, &enum_filters); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IEnumFilters_Next(enum_filters, 3, filters, &count); + todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + todo_wine ok(count == 2, "Got count %u.\n", count); + todo_wine ok(filters[1] == (IBaseFilter *)stream_filter, + "Expected filter %p, got %p.\n", stream_filter, filters[1]); + hr = IBaseFilter_GetClassID(filters[0], &clsid); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(IsEqualGUID(&clsid, &CLSID_DSoundRender), "Got unexpected filter %s.\n", wine_dbgstr_guid(&clsid)); + IBaseFilter_Release(filters[0]); + IMediaStreamFilter_Release(stream_filter); + IEnumFilters_Release(enum_filters); + IGraphBuilder_Release(graph); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &test_mspid, + AMMSF_ADDDEFAULTRENDERER, &audio_stream); + todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + + IMediaStreamFilter_Release(stream_filter); + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + static void test_media_streams(void) { IAMMultiMediaStream *pams; HRESULT hr; IMediaStream *video_stream = NULL; IMediaStream *audio_stream = NULL; - IMediaStream *dummy_stream; IMediaStreamFilter* media_stream_filter = NULL;
if (!(pams = create_ammultimediastream())) @@ -331,42 +873,11 @@ static void test_media_streams(void) hr = IAMMultiMediaStream_GetFilter(pams, &media_stream_filter); ok(hr == S_OK, "IAMMultiMediaStream_GetFilter returned: %x\n", hr);
- /* Verify behaviour with invalid purpose id */ - hr = IAMMultiMediaStream_GetMediaStream(pams, &IID_IUnknown, &dummy_stream); - ok(hr == MS_E_NOSTREAM, "IAMMultiMediaStream_GetMediaStream returned: %x\n", hr); - hr = IAMMultiMediaStream_AddMediaStream(pams, NULL, &IID_IUnknown, 0, NULL); - ok(hr == MS_E_PURPOSEID, "IAMMultiMediaStream_AddMediaStream returned: %x\n", hr); - - /* Verify there is no video media stream */ - hr = IAMMultiMediaStream_GetMediaStream(pams, &MSPID_PrimaryVideo, &video_stream); - ok(hr == MS_E_NOSTREAM, "IAMMultiMediaStream_GetMediaStream returned: %x\n", hr); - - /* Verify there is no default renderer for video stream */ - hr = IAMMultiMediaStream_AddMediaStream(pams, (IUnknown*)pdd7, &MSPID_PrimaryVideo, AMMSF_ADDDEFAULTRENDERER, NULL); - ok(hr == MS_E_PURPOSEID, "IAMMultiMediaStream_AddMediaStream returned: %x\n", hr); - hr = IAMMultiMediaStream_GetMediaStream(pams, &MSPID_PrimaryVideo, &video_stream); - ok(hr == MS_E_NOSTREAM, "IAMMultiMediaStream_GetMediaStream returned: %x\n", hr); - hr = IAMMultiMediaStream_AddMediaStream(pams, NULL, &MSPID_PrimaryVideo, AMMSF_ADDDEFAULTRENDERER, NULL); - ok(hr == MS_E_PURPOSEID, "IAMMultiMediaStream_AddMediaStream returned: %x\n", hr); - hr = IAMMultiMediaStream_GetMediaStream(pams, &MSPID_PrimaryVideo, &video_stream); - ok(hr == MS_E_NOSTREAM, "IAMMultiMediaStream_GetMediaStream returned: %x\n", hr); - - /* Verify normal case for video stream */ hr = IAMMultiMediaStream_AddMediaStream(pams, NULL, &MSPID_PrimaryVideo, 0, NULL); ok(hr == S_OK, "IAMMultiMediaStream_AddMediaStream returned: %x\n", hr); hr = IAMMultiMediaStream_GetMediaStream(pams, &MSPID_PrimaryVideo, &video_stream); ok(hr == S_OK, "IAMMultiMediaStream_GetMediaStream returned: %x\n", hr);
- /* Verify the video stream has been added to the media stream filter */ - if (media_stream_filter) - { - hr = IMediaStreamFilter_GetMediaStream(media_stream_filter, &MSPID_PrimaryVideo, &dummy_stream); - ok(hr == S_OK, "IMediaStreamFilter_GetMediaStream returned: %x\n", hr); - ok(dummy_stream == video_stream, "Got wrong returned pointer %p, expected %p\n", dummy_stream, video_stream); - if (SUCCEEDED(hr)) - IMediaStream_Release(dummy_stream); - } - /* Check interfaces and samples for video */ if (video_stream) { @@ -431,58 +942,11 @@ static void test_media_streams(void) IDirectDrawMediaStream_Release(ddraw_stream); }
- /* Verify there is no audio media stream */ - hr = IAMMultiMediaStream_GetMediaStream(pams, &MSPID_PrimaryAudio, &audio_stream); - ok(hr == MS_E_NOSTREAM, "IAMMultiMediaStream_GetMediaStream returned: %x\n", hr); - - /* Verify no stream is created when using the default renderer for audio stream */ - hr = IAMMultiMediaStream_AddMediaStream(pams, NULL, &MSPID_PrimaryAudio, AMMSF_ADDDEFAULTRENDERER, NULL); - ok((hr == S_OK) || (hr == VFW_E_NO_AUDIO_HARDWARE), "IAMMultiMediaStream_AddMediaStream returned: %x\n", hr); - if (hr == S_OK) - { - IGraphBuilder* filtergraph = NULL; - IBaseFilter* filter = NULL; - const WCHAR name[] = {'0','0','0','1',0}; - CLSID clsid; - - hr = IAMMultiMediaStream_GetFilterGraph(pams, &filtergraph); - ok(hr == S_OK, "IAMMultiMediaStream_GetFilterGraph returned: %x\n", hr); - if (hr == S_OK) - { - hr = IGraphBuilder_FindFilterByName(filtergraph, name, &filter); - ok(hr == S_OK, "IGraphBuilder_FindFilterByName returned: %x\n", hr); - } - if (hr == S_OK) - { - hr = IBaseFilter_GetClassID(filter, &clsid); - ok(hr == S_OK, "IGraphBuilder_FindFilterByName returned: %x\n", hr); - } - if (hr == S_OK) - ok(IsEqualGUID(&clsid, &CLSID_DSoundRender), "Got wrong CLSID\n"); - if (filter) - IBaseFilter_Release(filter); - if (filtergraph) - IGraphBuilder_Release(filtergraph); - } - hr = IAMMultiMediaStream_GetMediaStream(pams, &MSPID_PrimaryAudio, &audio_stream); - ok(hr == MS_E_NOSTREAM, "IAMMultiMediaStream_GetMediaStream returned: %x\n", hr); - - /* Verify a stream is created when no default renderer is used */ hr = IAMMultiMediaStream_AddMediaStream(pams, NULL, &MSPID_PrimaryAudio, 0, NULL); ok(hr == S_OK, "IAMMultiMediaStream_AddMediaStream returned: %x\n", hr); hr = IAMMultiMediaStream_GetMediaStream(pams, &MSPID_PrimaryAudio, &audio_stream); ok(hr == S_OK, "IAMMultiMediaStream_GetMediaStream returned: %x\n", hr);
- /* verify the audio stream has been added to the media stream filter */ - if (media_stream_filter) - { - hr = IMediaStreamFilter_GetMediaStream(media_stream_filter, &MSPID_PrimaryAudio, &dummy_stream); - ok(hr == S_OK, "IAMMultiMediaStream_GetMediaStream returned: %x\n", hr); - ok(dummy_stream == audio_stream, "Got wrong returned pointer %p, expected %p\n", dummy_stream, audio_stream); - if (SUCCEEDED(hr)) - IMediaStream_Release(dummy_stream); - } - /* Check interfaces and samples for audio */ if (audio_stream) { @@ -1201,6 +1665,7 @@ START_TEST(amstream) CoInitializeEx(NULL, COINIT_MULTITHREADED);
test_interfaces(); + test_add_stream(); test_media_streams(); test_enum_pins(); test_find_pin();
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/amstream/tests/amstream.c | 356 ++++++++++++++++++++++++++++++++- 1 file changed, 355 insertions(+), 1 deletion(-)
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 289e936e18d..02f11bc84af 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -22,7 +22,7 @@
#include "wine/test.h" #include "initguid.h" -#include "uuids.h" +#include "dshow.h" #include "amstream.h" #include "vfwmsgs.h" #include "mmreg.h" @@ -1294,6 +1294,359 @@ static void test_pin_info(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static IUnknown *graph_inner_unk; +static IFilterGraph2 *graph_inner; +static LONG graph_refcount = 1; +static unsigned int got_add_filter; +static IBaseFilter *graph_filter; +static WCHAR graph_filter_name[128]; + +static HRESULT WINAPI graph_QueryInterface(IFilterGraph2 *iface, REFIID iid, void **out) +{ + if (winetest_debug > 1) trace("QueryInterface(%s)\n", wine_dbgstr_guid(iid)); + if (IsEqualGUID(iid, &IID_IFilterGraph2) + || IsEqualGUID(iid, &IID_IGraphBuilder) + || IsEqualGUID(iid, &IID_IFilterGraph) + || IsEqualGUID(iid, &IID_IUnknown)) + { + *out = iface; + IFilterGraph2_AddRef(iface); + return S_OK; + } + else if (IsEqualGUID(iid, &IID_IMediaSeeking) + || IsEqualGUID(iid, &IID_IMediaControl) + || IsEqualGUID(iid, &IID_IMediaEventEx)) + { + return IUnknown_QueryInterface(graph_inner_unk, iid, out); + } + return E_NOINTERFACE; +} + +static ULONG WINAPI graph_AddRef(IFilterGraph2 *iface) +{ + return InterlockedIncrement(&graph_refcount); +} + +static ULONG WINAPI graph_Release(IFilterGraph2 *iface) +{ + return InterlockedDecrement(&graph_refcount); +} + +static HRESULT WINAPI graph_AddFilter(IFilterGraph2 *iface, IBaseFilter *filter, const WCHAR *name) +{ + if (winetest_debug > 1) trace("AddFilter(%p, %s)\n", filter, wine_dbgstr_w(name)); + ++got_add_filter; + graph_filter = filter; + if (name) + wcscpy(graph_filter_name, name); + else + graph_filter_name[0] = 0; + return IFilterGraph2_AddFilter(graph_inner, filter, name); +} + +static HRESULT WINAPI graph_RemoveFilter(IFilterGraph2 *iface, IBaseFilter *filter) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI graph_EnumFilters(IFilterGraph2 *iface, IEnumFilters **enumfilters) +{ + if (winetest_debug > 1) trace("EnumFilters()\n"); + return IFilterGraph2_EnumFilters(graph_inner, enumfilters); +} + +static HRESULT WINAPI graph_FindFilterByName(IFilterGraph2 *iface, const WCHAR *name, IBaseFilter **filter) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI graph_ConnectDirect(IFilterGraph2 *iface, IPin *source, IPin *sink, const AM_MEDIA_TYPE *mt) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI graph_Reconnect(IFilterGraph2 *iface, IPin *pin) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI graph_Disconnect(IFilterGraph2 *iface, IPin *pin) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI graph_SetDefaultSyncSource(IFilterGraph2 *iface) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI graph_Connect(IFilterGraph2 *iface, IPin *source, IPin *sink) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI graph_Render(IFilterGraph2 *iface, IPin *source) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI graph_RenderFile(IFilterGraph2 *iface, const WCHAR *filename, const WCHAR *playlist) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI graph_AddSourceFilter(IFilterGraph2 *iface, + const WCHAR *filename, const WCHAR *filter_name, IBaseFilter **filter) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI graph_SetLogFile(IFilterGraph2 *iface, DWORD_PTR file) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI graph_Abort(IFilterGraph2 *iface) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI graph_ShouldOperationContinue(IFilterGraph2 *iface) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI graph_AddSourceFilterForMoniker(IFilterGraph2 *iface, + IMoniker *moniker, IBindCtx *bind_ctx, const WCHAR *filter_name, IBaseFilter **filter) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI graph_ReconnectEx(IFilterGraph2 *iface, IPin *pin, const AM_MEDIA_TYPE *mt) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI graph_RenderEx(IFilterGraph2 *iface, IPin *pin, DWORD flags, DWORD *context) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static const IFilterGraph2Vtbl graph_vtbl = +{ + graph_QueryInterface, + graph_AddRef, + graph_Release, + graph_AddFilter, + graph_RemoveFilter, + graph_EnumFilters, + graph_FindFilterByName, + graph_ConnectDirect, + graph_Reconnect, + graph_Disconnect, + graph_SetDefaultSyncSource, + graph_Connect, + graph_Render, + graph_RenderFile, + graph_AddSourceFilter, + graph_SetLogFile, + graph_Abort, + graph_ShouldOperationContinue, + graph_AddSourceFilterForMoniker, + graph_ReconnectEx, + graph_RenderEx, +}; + +static void test_initialize(void) +{ + static const WCHAR expectW[] = {'M','e','d','i','a','S','t','r','e','a','m','F','i','l','t','e','r',0}; + + IAMMultiMediaStream *mmstream = create_ammultimediastream(); + IFilterGraph2 graph = {&graph_vtbl}; + IMediaStreamFilter *filter; + IGraphBuilder *ret_graph; + IMediaStream *stream; + STREAM_TYPE type; + HRESULT hr; + ULONG ref; + + ret_graph = (IGraphBuilder *)0xdeadbeef; + hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &ret_graph); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!ret_graph, "Got unexpected graph %p.\n", ret_graph); + + hr = IAMMultiMediaStream_GetFilter(mmstream, &filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!!filter, "Expected a non-NULL filter."); + IMediaStreamFilter_Release(filter); + + hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_READ, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_READ, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_WRITE, 0, NULL); + todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_TRANSFORM, 0, NULL); + todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + + ret_graph = (IGraphBuilder *)0xdeadbeef; + hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &ret_graph); + ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(!ret_graph, "Got unexpected graph %p.\n", ret_graph); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, 0, &stream); + ok(hr == S_OK, "Got hr %#x.\n", hr); + type = 0xdeadbeef; + hr = IMediaStream_GetInformation(stream, NULL, &type); + ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(type == STREAMTYPE_READ, "Got type %u.\n", type); + IMediaStream_Release(stream); + + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + + mmstream = create_ammultimediastream(); + + hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_WRITE, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_WRITE, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_READ, 0, NULL); + todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_TRANSFORM, 0, NULL); + todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + + ret_graph = (IGraphBuilder *)0xdeadbeef; + hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &ret_graph); + ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(!ret_graph, "Got unexpected graph %p.\n", ret_graph); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, 0, &stream); + ok(hr == S_OK, "Got hr %#x.\n", hr); + type = 0xdeadbeef; + hr = IMediaStream_GetInformation(stream, NULL, &type); + ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(type == STREAMTYPE_WRITE, "Got type %u.\n", type); + IMediaStream_Release(stream); + + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + + mmstream = create_ammultimediastream(); + + hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_TRANSFORM, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_TRANSFORM, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_READ, 0, NULL); + todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_WRITE, 0, NULL); + todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + + ret_graph = (IGraphBuilder *)0xdeadbeef; + hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &ret_graph); + ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(!ret_graph, "Got unexpected graph %p.\n", ret_graph); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, 0, &stream); + ok(hr == S_OK, "Got hr %#x.\n", hr); + type = 0xdeadbeef; + hr = IMediaStream_GetInformation(stream, NULL, &type); + ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(type == STREAMTYPE_TRANSFORM, "Got type %u.\n", type); + IMediaStream_Release(stream); + + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + + mmstream = create_ammultimediastream(); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, 0, &stream); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + type = 0xdeadbeef; + hr = IMediaStream_GetInformation(stream, NULL, &type); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(type == STREAMTYPE_READ, "Got type %u.\n", type); + + hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_TRANSFORM, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + type = 0xdeadbeef; + hr = IMediaStream_GetInformation(stream, NULL, &type); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(type == STREAMTYPE_READ, "Got type %u.\n", type); + + IMediaStream_Release(stream); + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + + /* Test with a custom filter graph. */ + + mmstream = create_ammultimediastream(); + + CoCreateInstance(&CLSID_FilterGraph, (IUnknown *)&graph, CLSCTX_INPROC_SERVER, + &IID_IUnknown, (void **)&graph_inner_unk); + IUnknown_QueryInterface(graph_inner_unk, &IID_IFilterGraph2, (void **)&graph_inner); + + ret_graph = (IGraphBuilder *)0xdeadbeef; + hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &ret_graph); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!ret_graph, "Got unexpected graph %p.\n", ret_graph); + + hr = IAMMultiMediaStream_GetFilter(mmstream, &filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!!filter, "Expected a non-NULL filter."); + + got_add_filter = 0; + hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_READ, 0, (IGraphBuilder *)&graph); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(got_add_filter == 1, "Got %d calls to IGraphBuilder::AddFilter().\n", got_add_filter); + ok(graph_filter == (IBaseFilter *)filter, "Got filter %p.\n", filter); + ok(!wcscmp(graph_filter_name, expectW), "Got unexpected name %s.\n", wine_dbgstr_w(graph_filter_name)); + + hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &ret_graph); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(ret_graph == (IGraphBuilder *)&graph, "Got unexpected graph %p.\n", ret_graph); + IGraphBuilder_Release(ret_graph); + + got_add_filter = 0; + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryAudio, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!got_add_filter, "Got %d calls to IGraphBuilder::AddFilter().\n", got_add_filter); + + got_add_filter = 0; + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!got_add_filter, "Got %d calls to IGraphBuilder::AddFilter().\n", got_add_filter); + + IMediaStreamFilter_Release(filter); + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + IFilterGraph2_Release(graph_inner); + ok(graph_refcount == 1, "Got outstanding refcount %d.\n", graph_refcount); + IUnknown_Release(graph_inner_unk); +} + static void test_IDirectDrawStreamSample(void) { DDSURFACEDESC desc = { sizeof(desc) }; @@ -1670,6 +2023,7 @@ START_TEST(amstream) test_enum_pins(); test_find_pin(); test_pin_info(); + test_initialize(); test_IDirectDrawStreamSample();
file = CreateFileW(filenameW, 0, 0, NULL, OPEN_EXISTING, 0, NULL);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/amstream/tests/Makefile.in | 2 +- dlls/amstream/tests/amstream.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/dlls/amstream/tests/Makefile.in b/dlls/amstream/tests/Makefile.in index 915ea0f4dd5..9205f904a93 100644 --- a/dlls/amstream/tests/Makefile.in +++ b/dlls/amstream/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = amstream.dll -IMPORTS = quartz ddraw oleaut32 ole32 user32 +IMPORTS = ddraw ole32 strmiids uuid
C_SRCS = \ amstream.c diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 02f11bc84af..32e0f52d576 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -21,12 +21,11 @@ #define COBJMACROS
#include "wine/test.h" -#include "initguid.h" #include "dshow.h" #include "amstream.h" -#include "vfwmsgs.h" #include "mmreg.h" #include "ks.h" +#include "initguid.h" #include "ksmedia.h"
static const WCHAR primary_video_sink_id[] = {'I','{','A','3','5','F','F','5','6','A',
From: Zebediah Figura zfigura@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/amstream/Makefile.in | 4 ++-- dlls/amstream/{amstream.c => multimedia.c} | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename dlls/amstream/{amstream.c => multimedia.c} (99%)
diff --git a/dlls/amstream/Makefile.in b/dlls/amstream/Makefile.in index d2dfa68b726..0b278f47a69 100644 --- a/dlls/amstream/Makefile.in +++ b/dlls/amstream/Makefile.in @@ -4,11 +4,11 @@ IMPORTS = strmiids strmbase uuid ole32 advapi32 ddraw EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \ - amstream.c \ audiodata.c \ filter.c \ main.c \ - mediastream.c + mediastream.c \ + multimedia.c
IDL_SRCS = amstream_classes.idl
diff --git a/dlls/amstream/amstream.c b/dlls/amstream/multimedia.c similarity index 99% rename from dlls/amstream/amstream.c rename to dlls/amstream/multimedia.c index 06fa564fb96..003d2b47a64 100644 --- a/dlls/amstream/amstream.c +++ b/dlls/amstream/multimedia.c @@ -1,5 +1,5 @@ /* - * Implementation of IAMMultiMediaStream Interface + * Multimedia stream object * * Copyright 2004, 2012 Christian Costa * Copyright 2006 Ivan Leo Puoti
From: Zebediah Figura zfigura@codeweavers.com
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/amstream/multimedia.c | 52 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-)
diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c index 003d2b47a64..47753512810 100644 --- a/dlls/amstream/multimedia.c +++ b/dlls/amstream/multimedia.c @@ -30,7 +30,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
-typedef struct { +struct multimedia_stream +{ IAMMultiMediaStream IAMMultiMediaStream_iface; LONG ref; IGraphBuilder* pFilterGraph; @@ -42,18 +43,18 @@ typedef struct { IAMMediaStream **pStreams; STREAM_TYPE StreamType; OAEVENT event; -} IAMMultiMediaStreamImpl; +};
-static inline IAMMultiMediaStreamImpl *impl_from_IAMMultiMediaStream(IAMMultiMediaStream *iface) +static inline struct multimedia_stream *impl_from_IAMMultiMediaStream(IAMMultiMediaStream *iface) { - return CONTAINING_RECORD(iface, IAMMultiMediaStreamImpl, IAMMultiMediaStream_iface); + return CONTAINING_RECORD(iface, struct multimedia_stream, IAMMultiMediaStream_iface); }
static const struct IAMMultiMediaStreamVtbl AM_Vtbl;
HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj) { - IAMMultiMediaStreamImpl *object; + struct multimedia_stream *object; HRESULT hr;
TRACE("(%p,%p)\n", pUnkOuter, ppObj); @@ -61,8 +62,7 @@ HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj) if( pUnkOuter ) return CLASS_E_NOAGGREGATION;
- object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAMMultiMediaStreamImpl)); - if (!object) + if (!(object = heap_alloc_zero(sizeof(*object)))) return E_OUTOFMEMORY;
object->IAMMultiMediaStream_iface.lpVtbl = &AM_Vtbl; @@ -84,7 +84,7 @@ HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj) /*** IUnknown methods ***/ static HRESULT WINAPI IAMMultiMediaStreamImpl_QueryInterface(IAMMultiMediaStream* iface, REFIID riid, void** ppvObject) { - IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface); + struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface);
TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
@@ -104,7 +104,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_QueryInterface(IAMMultiMediaStream
static ULONG WINAPI IAMMultiMediaStreamImpl_AddRef(IAMMultiMediaStream* iface) { - IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface); + struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface);
TRACE("(%p/%p)\n", iface, This);
@@ -113,7 +113,7 @@ static ULONG WINAPI IAMMultiMediaStreamImpl_AddRef(IAMMultiMediaStream* iface)
static ULONG WINAPI IAMMultiMediaStreamImpl_Release(IAMMultiMediaStream* iface) { - IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface); + struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface); ULONG ref = InterlockedDecrement(&This->ref); ULONG i;
@@ -142,7 +142,7 @@ static ULONG WINAPI IAMMultiMediaStreamImpl_Release(IAMMultiMediaStream* iface) /*** IMultiMediaStream methods ***/ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetInformation(IAMMultiMediaStream* iface, DWORD* pdwFlags, STREAM_TYPE* pStreamType) { - IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface); + struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface);
FIXME("(%p/%p)->(%p,%p) stub!\n", This, iface, pdwFlags, pStreamType);
@@ -151,7 +151,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetInformation(IAMMultiMediaStream
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetMediaStream(IAMMultiMediaStream* iface, REFMSPID idPurpose, IMediaStream** ppMediaStream) { - IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface); + struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface); MSPID PurposeId; unsigned int i;
@@ -173,7 +173,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetMediaStream(IAMMultiMediaStream
static HRESULT WINAPI IAMMultiMediaStreamImpl_EnumMediaStreams(IAMMultiMediaStream* iface, LONG Index, IMediaStream** ppMediaStream) { - IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface); + struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface);
FIXME("(%p/%p)->(%d,%p) stub!\n", This, iface, Index, ppMediaStream);
@@ -182,7 +182,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_EnumMediaStreams(IAMMultiMediaStre
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetState(IAMMultiMediaStream* iface, STREAM_STATE* pCurrentState) { - IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface); + struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface);
FIXME("(%p/%p)->(%p) stub!\n", This, iface, pCurrentState);
@@ -191,7 +191,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetState(IAMMultiMediaStream* ifac
static HRESULT WINAPI IAMMultiMediaStreamImpl_SetState(IAMMultiMediaStream* iface, STREAM_STATE new_state) { - IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface); + struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface); HRESULT hr = E_INVALIDARG;
TRACE("(%p/%p)->(%u)\n", This, iface, new_state); @@ -206,7 +206,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_SetState(IAMMultiMediaStream* ifac
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetTime(IAMMultiMediaStream* iface, STREAM_TIME* pCurrentTime) { - IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface); + struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface);
FIXME("(%p/%p)->(%p) stub!\n", This, iface, pCurrentTime);
@@ -215,7 +215,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetTime(IAMMultiMediaStream* iface
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetDuration(IAMMultiMediaStream* iface, STREAM_TIME* pDuration) { - IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface); + struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface);
FIXME("(%p/%p)->(%p) stub!\n", This, iface, pDuration);
@@ -224,7 +224,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetDuration(IAMMultiMediaStream* i
static HRESULT WINAPI IAMMultiMediaStreamImpl_Seek(IAMMultiMediaStream* iface, STREAM_TIME seek_time) { - IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface); + struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface);
TRACE("(%p/%p)->(%s)\n", This, iface, wine_dbgstr_longlong(seek_time));
@@ -233,7 +233,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_Seek(IAMMultiMediaStream* iface, S
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetEndOfStream(IAMMultiMediaStream* iface, HANDLE* phEOS) { - IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface); + struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface);
FIXME("(%p/%p)->(%p) stub!\n", This, iface, phEOS);
@@ -244,7 +244,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetEndOfStream(IAMMultiMediaStream static HRESULT WINAPI IAMMultiMediaStreamImpl_Initialize(IAMMultiMediaStream* iface, STREAM_TYPE StreamType, DWORD dwFlags, IGraphBuilder* pFilterGraph) { static const WCHAR filternameW[] = {'M','e','d','i','a','S','t','r','e','a','m','F','i','l','t','e','r',0}; - IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface); + struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface); HRESULT hr = S_OK;
TRACE("(%p/%p)->(%x,%x,%p)\n", This, iface, (DWORD)StreamType, dwFlags, pFilterGraph); @@ -298,7 +298,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_Initialize(IAMMultiMediaStream* if
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilterGraph(IAMMultiMediaStream* iface, IGraphBuilder** ppGraphBuilder) { - IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface); + struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, ppGraphBuilder);
@@ -315,7 +315,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilterGraph(IAMMultiMediaStream
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilter(IAMMultiMediaStream *iface, IMediaStreamFilter **filter) { - IAMMultiMediaStreamImpl *mmstream = impl_from_IAMMultiMediaStream(iface); + struct multimedia_stream *mmstream = impl_from_IAMMultiMediaStream(iface);
TRACE("mmstream %p, filter %p.\n", mmstream, filter);
@@ -330,7 +330,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilter(IAMMultiMediaStream *ifa static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream* iface, IUnknown* stream_object, const MSPID* PurposeId, DWORD dwFlags, IMediaStream** ppNewStream) { - IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface); + struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface); HRESULT hr; IAMMediaStream* pStream; IAMMediaStream** pNewStreams; @@ -398,7 +398,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenFile(IAMMultiMediaStream* iface, LPCWSTR filename, DWORD flags) { static const WCHAR sourceW[] = {'S','o','u','r','c','e',0}; - IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface); + struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface); HRESULT ret = S_OK; IBaseFilter *BaseFilter = NULL; IEnumPins *EnumPins = NULL; @@ -442,7 +442,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenFile(IAMMultiMediaStream* ifac
static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenMoniker(IAMMultiMediaStream* iface, IBindCtx* pCtx, IMoniker* pMoniker, DWORD dwFlags) { - IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface); + struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface);
FIXME("(%p/%p)->(%p,%p,%x) stub!\n", This, iface, pCtx, pMoniker, dwFlags);
@@ -451,7 +451,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenMoniker(IAMMultiMediaStream* i
static HRESULT WINAPI IAMMultiMediaStreamImpl_Render(IAMMultiMediaStream* iface, DWORD dwFlags) { - IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface); + struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface);
FIXME("(%p/%p)->(%x) partial stub!\n", This, iface, dwFlags);