Commit 2f166690 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mf: Implement MFShutdownObject().

parent b22b28e2
......@@ -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;
}
......@@ -78,6 +78,6 @@
@ stub MFGetTopoNodeCurrentType
@ stub MFReadSequencerSegmentOffset
@ stub MFRequireProtectedEnvironment
@ stub MFShutdownObject
@ stdcall MFShutdownObject(ptr)
@ stub MFTranscodeGetAudioOutputAvailableTypes
@ stub MergePropertyStore
......@@ -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();
}
......@@ -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")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment