mf: Implement MFShutdownObject().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2019-03-04 13:33:42 +03:00 committed by Alexandre Julliard
parent b22b28e231
commit 2f1666903e
4 changed files with 97 additions and 1 deletions

View File

@ -74,3 +74,21 @@ HRESULT WINAPI MFGetService(IUnknown *object, REFGUID service, REFIID riid, void
IMFGetService_Release(gs);
return hr;
}
/***********************************************************************
* MFShutdownObject (mf.@)
*/
HRESULT WINAPI MFShutdownObject(IUnknown *object)
{
IMFShutdown *shutdown;
TRACE("%p.\n", object);
if (object && SUCCEEDED(IUnknown_QueryInterface(object, &IID_IMFShutdown, (void **)&shutdown)))
{
IMFShutdown_Shutdown(shutdown);
IMFShutdown_Release(shutdown);
}
return S_OK;
}

View File

@ -78,6 +78,6 @@
@ stub MFGetTopoNodeCurrentType
@ stub MFReadSequencerSegmentOffset
@ stub MFRequireProtectedEnvironment
@ stub MFShutdownObject
@ stdcall MFShutdownObject(ptr)
@ stub MFTranscodeGetAudioOutputAvailableTypes
@ stub MergePropertyStore

View File

@ -502,6 +502,66 @@ static void test_topology_loader(void)
IMFTopoLoader_Release(loader);
}
static HRESULT WINAPI testshutdown_QueryInterface(IMFShutdown *iface, REFIID riid, void **obj)
{
if (IsEqualIID(riid, &IID_IMFShutdown) ||
IsEqualIID(riid, &IID_IUnknown))
{
*obj = iface;
IMFShutdown_AddRef(iface);
return S_OK;
}
*obj = NULL;
return E_NOINTERFACE;
}
static ULONG WINAPI testshutdown_AddRef(IMFShutdown *iface)
{
return 2;
}
static ULONG WINAPI testshutdown_Release(IMFShutdown *iface)
{
return 1;
}
static HRESULT WINAPI testshutdown_Shutdown(IMFShutdown *iface)
{
return 0xdead;
}
static HRESULT WINAPI testshutdown_GetShutdownStatus(IMFShutdown *iface, MFSHUTDOWN_STATUS *status)
{
ok(0, "Unexpected call.\n");
return E_NOTIMPL;
}
static const IMFShutdownVtbl testshutdownvtbl =
{
testshutdown_QueryInterface,
testshutdown_AddRef,
testshutdown_Release,
testshutdown_Shutdown,
testshutdown_GetShutdownStatus,
};
static void test_MFShutdownObject(void)
{
IMFShutdown testshutdown = { &testshutdownvtbl };
IUnknown testshutdown2 = { &testservicevtbl };
HRESULT hr;
hr = MFShutdownObject(NULL);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = MFShutdownObject((IUnknown *)&testshutdown);
ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
hr = MFShutdownObject(&testshutdown2);
ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
}
START_TEST(mf)
{
test_topology();
@ -509,4 +569,5 @@ START_TEST(mf)
test_MFGetService();
test_MFCreateSequencerSource();
test_media_session();
test_MFShutdownObject();
}

View File

@ -329,6 +329,7 @@ cpp_quote("HRESULT WINAPI MFCreateTopoLoader(IMFTopoLoader **loader);")
cpp_quote("HRESULT WINAPI MFGetSupportedMimeTypes(PROPVARIANT *array);")
cpp_quote("HRESULT WINAPI MFGetService(IUnknown *object, REFGUID service, REFIID iid, void **obj);")
cpp_quote("MFTIME WINAPI MFGetSystemTime(void);")
cpp_quote("HRESULT WINAPI MFShutdownObject(IUnknown *object);")
[
object,
@ -381,6 +382,22 @@ interface IMFMediaSink : IUnknown
HRESULT Shutdown();
}
typedef enum _MFSHUTDOWN_STATUS
{
MFSHUTDOWN_INITIATED,
MFSHUTDOWN_COMPLETED,
} MFSHUTDOWN_STATUS;
[
object,
uuid(97ec2ea4-0e42-4937-97ac-9d6d328824e1)
]
interface IMFShutdown : IUnknown
{
HRESULT Shutdown();
HRESULT GetShutdownStatus([out] MFSHUTDOWN_STATUS *status);
}
cpp_quote("#define MF_RESOLUTION_MEDIASOURCE 0x00000001")
cpp_quote("#define MF_RESOLUTION_BYTESTREAM 0x00000002")
cpp_quote("#define MF_RESOLUTION_CONTENT_DOES_NOT_HAVE_TO_MATCH_EXTENSION_OR_MIME_TYPE 0x00000010")