Commit 8b6f2762 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mf/session: Forward MR_POLICY_VOLUME_SERVICE service requests to the SAR node.

parent 43dd2fbf
...@@ -80,4 +80,5 @@ static inline const char *debugstr_time(LONGLONG time) ...@@ -80,4 +80,5 @@ static inline const char *debugstr_time(LONGLONG time)
} }
extern BOOL mf_is_sample_copier_transform(IMFTransform *transform) DECLSPEC_HIDDEN; extern BOOL mf_is_sample_copier_transform(IMFTransform *transform) DECLSPEC_HIDDEN;
extern BOOL mf_is_sar_sink(IMFMediaSink *sink) DECLSPEC_HIDDEN;
extern HRESULT topology_node_get_object(IMFTopologyNode *node, REFIID riid, void **obj) DECLSPEC_HIDDEN; extern HRESULT topology_node_get_object(IMFTopologyNode *node, REFIID riid, void **obj) DECLSPEC_HIDDEN;
...@@ -1915,6 +1915,11 @@ failed: ...@@ -1915,6 +1915,11 @@ failed:
return hr; return hr;
} }
BOOL mf_is_sar_sink(IMFMediaSink *sink)
{
return sink->lpVtbl == &audio_renderer_sink_vtbl;
}
static void sar_shutdown_object(void *user_context, IUnknown *obj) static void sar_shutdown_object(void *user_context, IUnknown *obj)
{ {
IMFMediaSink *sink; IMFMediaSink *sink;
......
...@@ -1952,18 +1952,36 @@ static ULONG WINAPI session_get_service_Release(IMFGetService *iface) ...@@ -1952,18 +1952,36 @@ static ULONG WINAPI session_get_service_Release(IMFGetService *iface)
return IMFMediaSession_Release(&session->IMFMediaSession_iface); return IMFMediaSession_Release(&session->IMFMediaSession_iface);
} }
static HRESULT session_get_video_render_service(struct media_session *session, REFGUID service, typedef BOOL (*p_renderer_node_test_func)(IMFMediaSink *sink);
REFIID riid, void **obj)
static BOOL session_video_renderer_test_func(IMFMediaSink *sink)
{
IUnknown *obj;
HRESULT hr;
/* Use first sink to support IMFVideoRenderer. */
hr = IMFMediaSink_QueryInterface(sink, &IID_IMFVideoRenderer, (void **)&obj);
if (obj)
IUnknown_Release(obj);
return hr == S_OK;
}
static BOOL session_audio_renderer_test_func(IMFMediaSink *sink)
{
return mf_is_sar_sink(sink);
}
static HRESULT session_get_renderer_node_service(struct media_session *session,
p_renderer_node_test_func node_test_func, REFGUID service, REFIID riid, void **obj)
{ {
IMFStreamSink *stream_sink; IMFStreamSink *stream_sink;
IMFTopologyNode *node; IMFTopologyNode *node;
IMFCollection *nodes; IMFCollection *nodes;
IMFMediaSink *sink; IMFMediaSink *sink;
unsigned int i = 0; unsigned int i = 0;
IUnknown *vr;
HRESULT hr = E_FAIL; HRESULT hr = E_FAIL;
/* Use first sink to support IMFVideoRenderer. */
if (session->presentation.current_topology) if (session->presentation.current_topology)
{ {
if (SUCCEEDED(IMFTopology_GetOutputNodeCollection(session->presentation.current_topology, if (SUCCEEDED(IMFTopology_GetOutputNodeCollection(session->presentation.current_topology,
...@@ -1975,11 +1993,10 @@ static HRESULT session_get_video_render_service(struct media_session *session, R ...@@ -1975,11 +1993,10 @@ static HRESULT session_get_video_render_service(struct media_session *session, R
{ {
if (SUCCEEDED(IMFStreamSink_GetMediaSink(stream_sink, &sink))) if (SUCCEEDED(IMFStreamSink_GetMediaSink(stream_sink, &sink)))
{ {
if (SUCCEEDED(IMFMediaSink_QueryInterface(sink, &IID_IMFVideoRenderer, (void **)&vr))) if (node_test_func(sink))
{ {
if (FAILED(hr = MFGetService(vr, service, riid, obj))) if (FAILED(hr = MFGetService((IUnknown *)sink, service, riid, obj)))
WARN("Failed to get service from video renderer %#x.\n", hr); WARN("Failed to get service from renderer node, %#x.\n", hr);
IUnknown_Release(vr);
} }
} }
IMFStreamSink_Release(stream_sink); IMFStreamSink_Release(stream_sink);
...@@ -1998,6 +2015,20 @@ static HRESULT session_get_video_render_service(struct media_session *session, R ...@@ -1998,6 +2015,20 @@ static HRESULT session_get_video_render_service(struct media_session *session, R
return hr; return hr;
} }
static HRESULT session_get_audio_render_service(struct media_session *session, REFGUID service,
REFIID riid, void **obj)
{
return session_get_renderer_node_service(session, session_audio_renderer_test_func,
service, riid, obj);
}
static HRESULT session_get_video_render_service(struct media_session *session, REFGUID service,
REFIID riid, void **obj)
{
return session_get_renderer_node_service(session, session_video_renderer_test_func,
service, riid, obj);
}
static HRESULT WINAPI session_get_service_GetService(IMFGetService *iface, REFGUID service, REFIID riid, void **obj) static HRESULT WINAPI session_get_service_GetService(IMFGetService *iface, REFGUID service, REFIID riid, void **obj)
{ {
struct media_session *session = impl_from_IMFGetService(iface); struct media_session *session = impl_from_IMFGetService(iface);
...@@ -2040,6 +2071,10 @@ static HRESULT WINAPI session_get_service_GetService(IMFGetService *iface, REFGU ...@@ -2040,6 +2071,10 @@ static HRESULT WINAPI session_get_service_GetService(IMFGetService *iface, REFGU
{ {
hr = session_get_video_render_service(session, service, riid, obj); hr = session_get_video_render_service(session, service, riid, obj);
} }
else if (IsEqualGUID(service, &MR_POLICY_VOLUME_SERVICE))
{
hr = session_get_audio_render_service(session, service, riid, obj);
}
else else
FIXME("Unsupported service %s.\n", debugstr_guid(service)); FIXME("Unsupported service %s.\n", debugstr_guid(service));
......
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