Commit 08088da4 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mf: Implement NotifyTopology() for the standard quality manager.

parent 144dcc1a
...@@ -331,6 +331,7 @@ struct quality_manager ...@@ -331,6 +331,7 @@ struct quality_manager
IMFClockStateSink IMFClockStateSink_iface; IMFClockStateSink IMFClockStateSink_iface;
LONG refcount; LONG refcount;
IMFTopology *topology;
IMFPresentationClock *clock; IMFPresentationClock *clock;
unsigned int state; unsigned int state;
CRITICAL_SECTION cs; CRITICAL_SECTION cs;
...@@ -4802,6 +4803,8 @@ static ULONG WINAPI standard_quality_manager_Release(IMFQualityManager *iface) ...@@ -4802,6 +4803,8 @@ static ULONG WINAPI standard_quality_manager_Release(IMFQualityManager *iface)
{ {
if (manager->clock) if (manager->clock)
IMFPresentationClock_Release(manager->clock); IMFPresentationClock_Release(manager->clock);
if (manager->topology)
IMFTopology_Release(manager->topology);
DeleteCriticalSection(&manager->cs); DeleteCriticalSection(&manager->cs);
heap_free(manager); heap_free(manager);
} }
...@@ -4809,11 +4812,32 @@ static ULONG WINAPI standard_quality_manager_Release(IMFQualityManager *iface) ...@@ -4809,11 +4812,32 @@ static ULONG WINAPI standard_quality_manager_Release(IMFQualityManager *iface)
return refcount; return refcount;
} }
static void standard_quality_manager_set_topology(struct quality_manager *manager, IMFTopology *topology)
{
if (manager->topology)
IMFTopology_Release(manager->topology);
manager->topology = topology;
if (manager->topology)
IMFTopology_AddRef(manager->topology);
}
static HRESULT WINAPI standard_quality_manager_NotifyTopology(IMFQualityManager *iface, IMFTopology *topology) static HRESULT WINAPI standard_quality_manager_NotifyTopology(IMFQualityManager *iface, IMFTopology *topology)
{ {
FIXME("%p, %p stub.\n", iface, topology); struct quality_manager *manager = impl_from_IMFQualityManager(iface);
HRESULT hr = S_OK;
return S_OK; TRACE("%p, %p.\n", iface, topology);
EnterCriticalSection(&manager->cs);
if (manager->state == QUALITY_MANAGER_SHUT_DOWN)
hr = MF_E_SHUTDOWN;
else
{
standard_quality_manager_set_topology(manager, topology);
}
LeaveCriticalSection(&manager->cs);
return hr;
} }
static void standard_quality_manager_release_clock(struct quality_manager *manager) static void standard_quality_manager_release_clock(struct quality_manager *manager)
...@@ -4886,6 +4910,7 @@ static HRESULT WINAPI standard_quality_manager_Shutdown(IMFQualityManager *iface ...@@ -4886,6 +4910,7 @@ static HRESULT WINAPI standard_quality_manager_Shutdown(IMFQualityManager *iface
if (manager->state != QUALITY_MANAGER_SHUT_DOWN) if (manager->state != QUALITY_MANAGER_SHUT_DOWN)
{ {
standard_quality_manager_release_clock(manager); standard_quality_manager_release_clock(manager);
standard_quality_manager_set_topology(manager, NULL);
manager->state = QUALITY_MANAGER_SHUT_DOWN; manager->state = QUALITY_MANAGER_SHUT_DOWN;
} }
LeaveCriticalSection(&manager->cs); LeaveCriticalSection(&manager->cs);
......
...@@ -3649,6 +3649,7 @@ static void test_quality_manager(void) ...@@ -3649,6 +3649,7 @@ static void test_quality_manager(void)
{ {
IMFPresentationClock *clock; IMFPresentationClock *clock;
IMFQualityManager *manager; IMFQualityManager *manager;
IMFTopology *topology;
HRESULT hr; HRESULT hr;
hr = MFStartup(MF_VERSION, MFSTARTUP_FULL); hr = MFStartup(MF_VERSION, MFSTARTUP_FULL);
...@@ -3666,6 +3667,9 @@ static void test_quality_manager(void) ...@@ -3666,6 +3667,9 @@ static void test_quality_manager(void)
hr = IMFQualityManager_NotifyPresentationClock(manager, NULL); hr = IMFQualityManager_NotifyPresentationClock(manager, NULL);
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
hr = IMFQualityManager_NotifyTopology(manager, NULL);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
/* Set clock, then shutdown. */ /* Set clock, then shutdown. */
EXPECT_REF(clock, 1); EXPECT_REF(clock, 1);
EXPECT_REF(manager, 1); EXPECT_REF(manager, 1);
...@@ -3681,6 +3685,9 @@ static void test_quality_manager(void) ...@@ -3681,6 +3685,9 @@ static void test_quality_manager(void)
hr = IMFQualityManager_NotifyPresentationClock(manager, clock); hr = IMFQualityManager_NotifyPresentationClock(manager, clock);
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
hr = IMFQualityManager_NotifyTopology(manager, NULL);
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
hr = IMFQualityManager_NotifyPresentationClock(manager, NULL); hr = IMFQualityManager_NotifyPresentationClock(manager, NULL);
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
...@@ -3703,6 +3710,48 @@ static void test_quality_manager(void) ...@@ -3703,6 +3710,48 @@ static void test_quality_manager(void)
IMFPresentationClock_Release(clock); IMFPresentationClock_Release(clock);
/* Set topology. */
hr = MFCreateStandardQualityManager(&manager);
ok(hr == S_OK, "Failed to create quality manager, hr %#x.\n", hr);
hr = MFCreateTopology(&topology);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
EXPECT_REF(topology, 1);
hr = IMFQualityManager_NotifyTopology(manager, topology);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
EXPECT_REF(topology, 2);
hr = IMFQualityManager_NotifyTopology(manager, NULL);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
EXPECT_REF(topology, 1);
hr = IMFQualityManager_NotifyTopology(manager, topology);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
EXPECT_REF(topology, 2);
hr = IMFQualityManager_Shutdown(manager);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
EXPECT_REF(topology, 1);
hr = IMFQualityManager_NotifyTopology(manager, topology);
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
IMFQualityManager_Release(manager);
hr = MFCreateStandardQualityManager(&manager);
ok(hr == S_OK, "Failed to create quality manager, hr %#x.\n", hr);
EXPECT_REF(topology, 1);
hr = IMFQualityManager_NotifyTopology(manager, topology);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
EXPECT_REF(topology, 2);
IMFQualityManager_Release(manager);
EXPECT_REF(topology, 1);
IMFTopology_Release(topology);
hr = MFShutdown(); hr = MFShutdown();
ok(hr == S_OK, "Shutdown failure, hr %#x.\n", hr); ok(hr == S_OK, "Shutdown failure, hr %#x.\n", hr);
} }
......
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