mfplat/allocator: Add support for MF_SA_BUFFERS_PER_SAMPLE.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-02-03 14:28:02 +03:00 committed by Alexandre Julliard
parent d100d92f93
commit d2a30424ef
2 changed files with 6 additions and 2 deletions

View File

@ -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);

View File

@ -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);