mf/session: Handle shutdown state on GetService().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
aaf520cf5e
commit
a2728cdece
|
@ -2020,34 +2020,8 @@ static ULONG WINAPI session_get_service_Release(IMFGetService *iface)
|
|||
return IMFMediaSession_Release(&session->IMFMediaSession_iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI session_get_service_GetService(IMFGetService *iface, REFGUID service, REFIID riid, void **obj)
|
||||
{
|
||||
struct media_session *session = impl_from_IMFGetService(iface);
|
||||
|
||||
TRACE("%p, %s, %s, %p.\n", iface, debugstr_guid(service), debugstr_guid(riid), obj);
|
||||
|
||||
*obj = NULL;
|
||||
|
||||
if (IsEqualGUID(service, &MF_RATE_CONTROL_SERVICE))
|
||||
{
|
||||
if (IsEqualIID(riid, &IID_IMFRateSupport))
|
||||
{
|
||||
*obj = &session->IMFRateSupport_iface;
|
||||
}
|
||||
else if (IsEqualIID(riid, &IID_IMFRateControl))
|
||||
{
|
||||
*obj = &session->IMFRateControl_iface;
|
||||
}
|
||||
}
|
||||
else if (IsEqualGUID(service, &MF_LOCAL_MFT_REGISTRATION_SERVICE))
|
||||
{
|
||||
return IMFLocalMFTRegistration_QueryInterface(&local_mft_registration, riid, obj);
|
||||
}
|
||||
else if (IsEqualGUID(service, &MF_TOPONODE_ATTRIBUTE_EDITOR_SERVICE))
|
||||
{
|
||||
*obj = &session->IMFTopologyNodeAttributeEditor_iface;
|
||||
}
|
||||
else if (IsEqualGUID(service, &MR_VIDEO_RENDER_SERVICE))
|
||||
static HRESULT session_get_video_render_service(struct media_session *session, REFGUID service,
|
||||
REFIID riid, void **obj)
|
||||
{
|
||||
IMFStreamSink *stream_sink;
|
||||
IMFTopologyNode *node;
|
||||
|
@ -2055,9 +2029,7 @@ static HRESULT WINAPI session_get_service_GetService(IMFGetService *iface, REFGU
|
|||
IMFMediaSink *sink;
|
||||
unsigned int i = 0;
|
||||
IUnknown *vr;
|
||||
HRESULT hr;
|
||||
|
||||
EnterCriticalSection(&session->cs);
|
||||
HRESULT hr = E_FAIL;
|
||||
|
||||
/* Use first sink to support IMFVideoRenderer. */
|
||||
if (session->presentation.current_topology)
|
||||
|
@ -2091,15 +2063,57 @@ static HRESULT WINAPI session_get_service_GetService(IMFGetService *iface, REFGU
|
|||
}
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&session->cs);
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI session_get_service_GetService(IMFGetService *iface, REFGUID service, REFIID riid, void **obj)
|
||||
{
|
||||
struct media_session *session = impl_from_IMFGetService(iface);
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
TRACE("%p, %s, %s, %p.\n", iface, debugstr_guid(service), debugstr_guid(riid), obj);
|
||||
|
||||
*obj = NULL;
|
||||
|
||||
EnterCriticalSection(&session->cs);
|
||||
if (FAILED(hr = session_is_shut_down(session)))
|
||||
{
|
||||
}
|
||||
else if (IsEqualGUID(service, &MF_RATE_CONTROL_SERVICE))
|
||||
{
|
||||
if (IsEqualIID(riid, &IID_IMFRateSupport))
|
||||
{
|
||||
*obj = &session->IMFRateSupport_iface;
|
||||
}
|
||||
else if (IsEqualIID(riid, &IID_IMFRateControl))
|
||||
{
|
||||
*obj = &session->IMFRateControl_iface;
|
||||
}
|
||||
else
|
||||
hr = E_NOINTERFACE;
|
||||
|
||||
if (*obj)
|
||||
IUnknown_AddRef((IUnknown *)*obj);
|
||||
}
|
||||
else if (IsEqualGUID(service, &MF_LOCAL_MFT_REGISTRATION_SERVICE))
|
||||
{
|
||||
hr = IMFLocalMFTRegistration_QueryInterface(&local_mft_registration, riid, obj);
|
||||
}
|
||||
else if (IsEqualGUID(service, &MF_TOPONODE_ATTRIBUTE_EDITOR_SERVICE))
|
||||
{
|
||||
*obj = &session->IMFTopologyNodeAttributeEditor_iface;
|
||||
IUnknown_AddRef((IUnknown *)*obj);
|
||||
}
|
||||
else if (IsEqualGUID(service, &MR_VIDEO_RENDER_SERVICE))
|
||||
{
|
||||
hr = session_get_video_render_service(session, service, riid, obj);
|
||||
}
|
||||
else
|
||||
FIXME("Unsupported service %s.\n", debugstr_guid(service));
|
||||
|
||||
if (*obj)
|
||||
IUnknown_AddRef((IUnknown *)*obj);
|
||||
LeaveCriticalSection(&session->cs);
|
||||
|
||||
return *obj ? S_OK : E_NOINTERFACE;
|
||||
return hr;
|
||||
}
|
||||
|
||||
static const IMFGetServiceVtbl session_get_service_vtbl =
|
||||
|
|
|
@ -1170,6 +1170,7 @@ static void test_media_session(void)
|
|||
IMFShutdown *shutdown;
|
||||
PROPVARIANT propvar;
|
||||
DWORD status, caps;
|
||||
IMFGetService *gs;
|
||||
IMFClock *clock;
|
||||
IUnknown *unk;
|
||||
HRESULT hr;
|
||||
|
@ -1271,6 +1272,16 @@ todo_wine
|
|||
hr = IMFMediaSession_Shutdown(session);
|
||||
ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
|
||||
|
||||
check_interface(session, &IID_IMFGetService, TRUE);
|
||||
|
||||
hr = IMFMediaSession_QueryInterface(session, &IID_IMFGetService, (void **)&gs);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IMFGetService_GetService(gs, &MF_RATE_CONTROL_SERVICE, &IID_IMFRateSupport, (void **)&rate_support);
|
||||
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
IMFGetService_Release(gs);
|
||||
|
||||
hr = IMFShutdown_GetShutdownStatus(shutdown, &status);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
ok(status == MFSHUTDOWN_COMPLETED, "Unexpected shutdown status %u.\n", status);
|
||||
|
|
Loading…
Reference in New Issue