Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/session.c | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c index 76310040ee..8edab28935 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -1395,9 +1395,42 @@ static HRESULT WINAPI mfsession_GetSessionCapabilities(IMFMediaSession *iface, D
static HRESULT WINAPI mfsession_GetFullTopology(IMFMediaSession *iface, DWORD flags, TOPOID id, IMFTopology **topology) { - FIXME("%p, %#x, %s, %p.\n", iface, flags, wine_dbgstr_longlong(id), topology); + struct media_session *session = impl_from_IMFMediaSession(iface); + struct queued_topology *queued; + HRESULT hr = S_OK; + TOPOID topo_id;
- return E_NOTIMPL; + TRACE("%p, %#x, %s, %p.\n", iface, flags, wine_dbgstr_longlong(id), topology); + + *topology = NULL; + + EnterCriticalSection(&session->cs); + + if (flags & MFSESSION_GETFULLTOPOLOGY_CURRENT) + { + if (session->presentation.topo_status != MF_TOPOSTATUS_INVALID) + *topology = session->presentation.current_topology; + else + hr = MF_E_INVALIDREQUEST; + } + else + { + LIST_FOR_EACH_ENTRY(queued, &session->topologies, struct queued_topology, entry) + { + if (SUCCEEDED(IMFTopology_GetTopologyID(queued->topology, &topo_id)) && topo_id == id) + { + *topology = queued->topology; + break; + } + } + } + + if (*topology) + IMFTopology_AddRef(*topology); + + LeaveCriticalSection(&session->cs); + + return hr; }
static const IMFMediaSessionVtbl mfmediasessionvtbl =
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/session.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c index 8edab28935..0c7e1fbf01 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -454,14 +454,17 @@ static HRESULT create_session_op(enum session_command command, struct session_op return S_OK; }
+static HRESULT session_is_shut_down(struct media_session *session) +{ + return session->state == SESSION_STATE_SHUT_DOWN ? MF_E_SHUTDOWN : S_OK; +} + static HRESULT session_submit_command(struct media_session *session, struct session_op *op) { HRESULT hr;
EnterCriticalSection(&session->cs); - if (session->state == SESSION_STATE_SHUT_DOWN) - hr = MF_E_SHUTDOWN; - else + if (SUCCEEDED(hr = session_is_shut_down(session))) hr = MFPutWorkItem(MFASYNC_CALLBACK_QUEUE_STANDARD, &session->commands_callback, &op->IUnknown_iface); LeaveCriticalSection(&session->cs);
@@ -707,7 +710,6 @@ static void session_stop(struct media_session *session) LeaveCriticalSection(&session->cs); }
- static struct media_source *session_get_media_source(struct media_session *session, IMFMediaSource *source) { struct media_source *cur; @@ -1347,9 +1349,7 @@ static HRESULT WINAPI mfsession_Shutdown(IMFMediaSession *iface) FIXME("%p.\n", iface);
EnterCriticalSection(&session->cs); - if (session->state == SESSION_STATE_SHUT_DOWN) - hr = MF_E_SHUTDOWN; - else + if (SUCCEEDED(hr = session_is_shut_down(session))) { session->state = SESSION_STATE_SHUT_DOWN; IMFMediaEventQueue_Shutdown(session->event_queue); @@ -1384,9 +1384,7 @@ static HRESULT WINAPI mfsession_GetSessionCapabilities(IMFMediaSession *iface, D return E_POINTER;
EnterCriticalSection(&session->cs); - if (session->state == SESSION_STATE_SHUT_DOWN) - hr = MF_E_SHUTDOWN; - else + if (SUCCEEDED(hr = session_is_shut_down(session))) *caps = session->caps; LeaveCriticalSection(&session->cs);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/session.c | 12 +++++++++--- dlls/mf/tests/mf.c | 4 ++++ 2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c index 0c7e1fbf01..a2a2ba6fe5 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -1364,13 +1364,19 @@ static HRESULT WINAPI mfsession_Shutdown(IMFMediaSession *iface) static HRESULT WINAPI mfsession_GetClock(IMFMediaSession *iface, IMFClock **clock) { struct media_session *session = impl_from_IMFMediaSession(iface); + HRESULT hr;
TRACE("%p, %p.\n", iface, clock);
- *clock = (IMFClock *)session->clock; - IMFClock_AddRef(*clock); + EnterCriticalSection(&session->cs); + if (SUCCEEDED(hr = session_is_shut_down(session))) + { + *clock = (IMFClock *)session->clock; + IMFClock_AddRef(*clock); + } + LeaveCriticalSection(&session->cs);
- return S_OK; + return hr; }
static HRESULT WINAPI mfsession_GetSessionCapabilities(IMFMediaSession *iface, DWORD *caps) diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 8f3a80360f..5f3114da32 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -1100,6 +1100,7 @@ todo_wine
hr = IMFClock_GetProperties(clock, &clock_props); ok(hr == MF_E_CLOCK_NO_TIME_SOURCE, "Unexpected hr %#x.\n", hr); + IMFClock_Release(clock);
IMFRateControl_Release(rate_control); IMFRateSupport_Release(rate_support); @@ -1117,6 +1118,9 @@ todo_wine hr = IMFMediaSession_Close(session); ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
+ hr = IMFMediaSession_GetClock(session, &clock); + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + IMFMediaSession_Release(session);
/* Custom topology loader, GUID is not registered. */
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=66078
Your paranoid android.
=== w8adm (32 bit report) ===
mf: mf.c:1007: Test failed: Unexpected return value 0x102. mf.c:931: Test failed: Failed to finalize GetEvent, hr 0xc00d3e85. 0cbc:mf: unhandled exception c0000005 at 004024DF