[PATCH 6/6] evr/allocator: Implement GetFreeSampleCount().
Nikolay Sivov
nsivov at codeweavers.com
Thu Oct 8 06:44:18 CDT 2020
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/evr/sample.c | 12 ++++++++++--
dlls/evr/tests/evr.c | 14 ++++++++------
dlls/mf/tests/mf.c | 1 -
3 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/dlls/evr/sample.c b/dlls/evr/sample.c
index 31e3ff43334..2887a37e8d9 100644
--- a/dlls/evr/sample.c
+++ b/dlls/evr/sample.c
@@ -32,6 +32,7 @@ struct sample_allocator
LONG refcount;
IMFVideoSampleAllocatorNotify *callback;
+ unsigned int free_samples;
CRITICAL_SECTION cs;
};
@@ -180,9 +181,16 @@ static HRESULT WINAPI sample_allocator_callback_SetCallback(IMFVideoSampleAlloca
static HRESULT WINAPI sample_allocator_callback_GetFreeSampleCount(IMFVideoSampleAllocatorCallback *iface,
LONG *count)
{
- FIXME("%p, %p.\n", iface, count);
+ struct sample_allocator *allocator = impl_from_IMFVideoSampleAllocatorCallback(iface);
- return E_NOTIMPL;
+ TRACE("%p, %p.\n", iface, count);
+
+ EnterCriticalSection(&allocator->cs);
+ if (count)
+ *count = allocator->free_samples;
+ LeaveCriticalSection(&allocator->cs);
+
+ return S_OK;
}
static const IMFVideoSampleAllocatorCallbackVtbl sample_allocator_callback_vtbl =
diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c
index 3951b813a02..7ad011d2a09 100644
--- a/dlls/evr/tests/evr.c
+++ b/dlls/evr/tests/evr.c
@@ -1219,12 +1219,14 @@ static void test_MFCreateVideoSampleAllocator(void)
hr = IMFVideoSampleAllocatorCallback_SetCallback(allocator_cb, NULL);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ hr = IMFVideoSampleAllocatorCallback_GetFreeSampleCount(allocator_cb, NULL);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
count = 10;
hr = IMFVideoSampleAllocatorCallback_GetFreeSampleCount(allocator_cb, &count);
-todo_wine {
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(!count, "Unexpected count %d.\n", count);
-}
+
hr = IMFVideoSampleAllocator_UninitializeSampleAllocator(allocator);
todo_wine
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
@@ -1256,10 +1258,10 @@ todo_wine
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFVideoSampleAllocatorCallback_GetFreeSampleCount(allocator_cb, &count);
-todo_wine {
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+todo_wine
ok(count == 1, "Unexpected count %d.\n", count);
-}
+
sample = NULL;
hr = IMFVideoSampleAllocator_AllocateSample(allocator, &sample);
todo_wine
@@ -1279,10 +1281,10 @@ todo_wine
ok(get_refcount(sample) == 3, "Unexpected refcount %u.\n", get_refcount(sample));
hr = IMFVideoSampleAllocatorCallback_GetFreeSampleCount(allocator_cb, &count);
-todo_wine {
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+todo_wine
ok(count == 4, "Unexpected count %d.\n", count);
-}
+
if (sample)
{
hr = IMFSample_QueryInterface(sample, &IID_IMFDesiredSample, (void **)&unk);
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c
index bd6e66a5132..a63c353a4b5 100644
--- a/dlls/mf/tests/mf.c
+++ b/dlls/mf/tests/mf.c
@@ -3308,7 +3308,6 @@ static void test_evr(void)
sample_count = 0;
hr = IMFVideoSampleAllocatorCallback_GetFreeSampleCount(allocator_callback, &sample_count);
-todo_wine
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(!sample_count, "Unexpected sample count %d.\n", sample_count);
--
2.28.0
More information about the wine-devel
mailing list