Nikolay Sivov : mfplat/allocator: Add support for MF_SA_BUFFERS_PER_SAMPLE.

Alexandre Julliard julliard at winehq.org
Wed Feb 3 15:39:30 CST 2021


Module: wine
Branch: master
Commit: d2a30424ef64fd817a5cbfdac6943830c59489fb
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d2a30424ef64fd817a5cbfdac6943830c59489fb

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Wed Feb  3 14:28:02 2021 +0300

mfplat/allocator: Add support for MF_SA_BUFFERS_PER_SAMPLE.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mfplat/sample.c       | 4 +++-
 dlls/mfplat/tests/mfplat.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/mfplat/sample.c b/dlls/mfplat/sample.c
index 8a0281abf6c..acdc8836cc8 100644
--- a/dlls/mfplat/sample.c
+++ b/dlls/mfplat/sample.c
@@ -1355,12 +1355,15 @@ static HRESULT sample_allocator_initialize(struct sample_allocator *allocator, u
     {
         allocator->attributes = attributes;
         IMFAttributes_AddRef(allocator->attributes);
+
+        IMFAttributes_GetUINT32(attributes, &MF_SA_BUFFERS_PER_SAMPLE, &allocator->frame_desc.buffer_count);
     }
 
     allocator->frame_desc.d3d9_format = subtype.Data1;
     allocator->frame_desc.dxgi_format = MFMapDX9FormatToDXGIFormat(allocator->frame_desc.d3d9_format);
     allocator->frame_desc.width = frame_size >> 32;
     allocator->frame_desc.height = frame_size;
+    allocator->frame_desc.buffer_count = max(1, allocator->frame_desc.buffer_count);
 
     if (FAILED(hr = sample_allocator_get_surface_service(allocator, &service)))
         return hr;
@@ -1673,7 +1676,6 @@ HRESULT WINAPI MFCreateVideoSampleAllocatorEx(REFIID riid, void **obj)
     object->IMFVideoSampleAllocatorCallback_iface.lpVtbl = &sample_allocator_callback_vtbl;
     object->tracking_callback.lpVtbl = &sample_allocator_tracking_callback_vtbl;
     object->refcount = 1;
-    object->frame_desc.buffer_count = 1;
     list_init(&object->used_samples);
     list_init(&object->free_samples);
     InitializeCriticalSection(&object->cs);
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c
index ed862ab9bdb..deb9e78efba 100644
--- a/dlls/mfplat/tests/mfplat.c
+++ b/dlls/mfplat/tests/mfplat.c
@@ -6439,6 +6439,9 @@ todo_wine
     hr = IMFAttributes_SetUINT32(attributes, &MF_SA_BUFFERS_PER_SAMPLE, 2);
     ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
 
+    hr = IMFVideoSampleAllocatorEx_AllocateSample(allocatorex, &sample);
+    ok(hr == MF_E_NOT_INITIALIZED, "Unexpected hr %#x.\n", hr);
+
     EXPECT_REF(attributes, 1);
     hr = IMFVideoSampleAllocatorEx_InitializeSampleAllocatorEx(allocatorex, 0, 0, attributes, video_type);
     ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
@@ -6454,7 +6457,6 @@ todo_wine
 
     hr = IMFSample_GetBufferCount(sample, &buffer_count);
     ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
-todo_wine
     ok(buffer_count == 2, "Unexpected buffer count %u.\n", buffer_count);
 
     hr = IMFVideoSampleAllocatorEx_AllocateSample(allocatorex, &sample2);




More information about the wine-cvs mailing list