Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dxva2/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/dxva2/main.c b/dlls/dxva2/main.c index 6ebc4f00186..53e266d028f 100644 --- a/dlls/dxva2/main.c +++ b/dlls/dxva2/main.c @@ -392,7 +392,7 @@ static HRESULT WINAPI device_manager_OpenDeviceHandle(IDirect3DDeviceManager9 *i sizeof(*manager->handles))) { *hdevice = ULongToHandle(manager->count + 1); - manager->handles[manager->count].flags |= HANDLE_FLAG_OPEN; + manager->handles[manager->count].flags = HANDLE_FLAG_OPEN; manager->handles[manager->count].state_block = NULL; manager->count++; }
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dxva2/main.c | 139 ++++++++++++++++++++++++++++++++++++++- dlls/dxva2/tests/dxva2.c | 108 ++++++++++++++++++++++++++++-- 2 files changed, 241 insertions(+), 6 deletions(-)
diff --git a/dlls/dxva2/main.c b/dlls/dxva2/main.c index 53e266d028f..af6ad25697b 100644 --- a/dlls/dxva2/main.c +++ b/dlls/dxva2/main.c @@ -65,6 +65,14 @@ struct device_manager CONDITION_VARIABLE lock; };
+struct video_processor +{ + IDirectXVideoProcessor IDirectXVideoProcessor_iface; + LONG refcount; + + IDirectXVideoProcessorService *service; +}; + static BOOL dxva_array_reserve(void **elements, size_t *capacity, size_t count, size_t size) { size_t new_capacity, max_capacity; @@ -102,6 +110,121 @@ static struct device_manager *impl_from_IDirectXVideoProcessorService(IDirectXVi return CONTAINING_RECORD(iface, struct device_manager, IDirectXVideoProcessorService_iface); }
+static struct video_processor *impl_from_IDirectXVideoProcessor(IDirectXVideoProcessor *iface) +{ + return CONTAINING_RECORD(iface, struct video_processor, IDirectXVideoProcessor_iface); +} + +static HRESULT WINAPI video_processor_QueryInterface(IDirectXVideoProcessor *iface, REFIID riid, void **obj) +{ + if (IsEqualIID(riid, &IID_IDirectXVideoProcessor) || + IsEqualIID(riid, &IID_IUnknown)) + { + *obj = iface; + IDirectXVideoProcessor_AddRef(iface); + return S_OK; + } + + WARN("Unsupported interface %s.\n", debugstr_guid(riid)); + *obj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI video_processor_AddRef(IDirectXVideoProcessor *iface) +{ + struct video_processor *processor = impl_from_IDirectXVideoProcessor(iface); + ULONG refcount = InterlockedIncrement(&processor->refcount); + + TRACE("%p, refcount %u.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI video_processor_Release(IDirectXVideoProcessor *iface) +{ + struct video_processor *processor = impl_from_IDirectXVideoProcessor(iface); + ULONG refcount = InterlockedDecrement(&processor->refcount); + + TRACE("%p, refcount %u.\n", iface, refcount); + + if (!refcount) + { + IDirectXVideoProcessorService_Release(processor->service); + heap_free(processor); + } + + return refcount; +} + +static HRESULT WINAPI video_processor_GetVideoProcessorService(IDirectXVideoProcessor *iface, + IDirectXVideoProcessorService **service) +{ + struct video_processor *processor = impl_from_IDirectXVideoProcessor(iface); + + TRACE("%p, %p.\n", iface, service); + + *service = processor->service; + IDirectXVideoProcessorService_AddRef(*service); + + return S_OK; +} + +static HRESULT WINAPI video_processor_GetCreationParameters(IDirectXVideoProcessor *iface, + GUID *device, DXVA2_VideoDesc *video_desc, D3DFORMAT *rt_format, UINT *maxstreams) +{ + FIXME("%p, %p, %p, %p, %p.\n", iface, device, video_desc, rt_format, maxstreams); + + if (!device && !video_desc && !rt_format && !maxstreams) + return E_INVALIDARG; + + return E_NOTIMPL; +} + +static HRESULT WINAPI video_processor_GetVideoProcessorCaps(IDirectXVideoProcessor *iface, + DXVA2_VideoProcessorCaps *caps) +{ + FIXME("%p, %p.\n", iface, caps); + + return E_NOTIMPL; +} + +static HRESULT WINAPI video_processor_GetProcAmpRange(IDirectXVideoProcessor *iface, UINT cap, DXVA2_ValueRange *range) +{ + FIXME("%p, %u, %p.\n", iface, cap, range); + + return E_NOTIMPL; +} + +static HRESULT WINAPI video_processor_GetFilterPropertyRange(IDirectXVideoProcessor *iface, UINT setting, + DXVA2_ValueRange *range) +{ + FIXME("%p, %u, %p.\n", iface, setting, range); + + return E_NOTIMPL; +} + +static HRESULT WINAPI video_processor_VideoProcessBlt(IDirectXVideoProcessor *iface, IDirect3DSurface9 *rt, + const DXVA2_VideoProcessBltParams *params, const DXVA2_VideoSample *samples, UINT sample_count, + HANDLE *complete_handle) +{ + FIXME("%p, %p, %p, %p, %u, %p.\n", iface, rt, params, samples, sample_count, complete_handle); + + return E_NOTIMPL; +} + +static const IDirectXVideoProcessorVtbl video_processor_vtbl = +{ + video_processor_QueryInterface, + video_processor_AddRef, + video_processor_Release, + video_processor_GetVideoProcessorService, + video_processor_GetCreationParameters, + video_processor_GetVideoProcessorCaps, + video_processor_GetProcAmpRange, + video_processor_GetFilterPropertyRange, + video_processor_VideoProcessBlt, +}; + static HRESULT WINAPI device_manager_processor_service_QueryInterface(IDirectXVideoProcessorService *iface, REFIID riid, void **obj) { @@ -256,10 +379,24 @@ static HRESULT WINAPI device_manager_processor_service_CreateVideoProcessor(IDir REFGUID deviceguid, const DXVA2_VideoDesc *video_desc, D3DFORMAT rt_format, UINT max_substreams, IDirectXVideoProcessor **processor) { + struct video_processor *object; + FIXME("%p, %s, %p, %d, %u, %p.\n", iface, debugstr_guid(deviceguid), video_desc, rt_format, max_substreams, processor);
- return E_NOTIMPL; + /* FIXME: validate render target format */ + + if (!(object = heap_alloc_zero(sizeof(*object)))) + return E_OUTOFMEMORY; + + object->IDirectXVideoProcessor_iface.lpVtbl = &video_processor_vtbl; + object->refcount = 1; + object->service = iface; + IDirectXVideoProcessorService_AddRef(object->service); + + *processor = &object->IDirectXVideoProcessor_iface; + + return S_OK; }
static const IDirectXVideoProcessorServiceVtbl device_manager_processor_service_vtbl = diff --git a/dlls/dxva2/tests/dxva2.c b/dlls/dxva2/tests/dxva2.c index 9dcd3e5bf4e..84ccd3b0190 100644 --- a/dlls/dxva2/tests/dxva2.c +++ b/dlls/dxva2/tests/dxva2.c @@ -23,10 +23,11 @@ #include "initguid.h" #include "dxva2api.h"
-static int get_refcount(IUnknown *object) +static unsigned int get_refcount(void *object) { - IUnknown_AddRef(object); - return IUnknown_Release(object); + IUnknown *iface = object; + IUnknown_AddRef(iface); + return IUnknown_Release(iface); }
static HWND create_window(void) @@ -120,13 +121,13 @@ static void test_device_manager(void)
hr = IDirect3DDeviceManager9_ResetDevice(manager, device, token); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - refcount = get_refcount((IUnknown *)device); + refcount = get_refcount(device);
handle1 = NULL; hr = IDirect3DDeviceManager9_OpenDeviceHandle(manager, &handle1); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
- refcount2 = get_refcount((IUnknown *)device); + refcount2 = get_refcount(device); ok(refcount2 == refcount, "Unexpected refcount %d.\n", refcount);
handle = NULL; @@ -357,7 +358,104 @@ done: DestroyWindow(window); }
+static void test_video_processor(void) +{ + IDirectXVideoProcessorService *service, *service2; + IDirect3DDevice9 *device; + IDirect3DDeviceManager9 *manager; + HANDLE handle, handle1; + IDirect3D9 *d3d; + HWND window; + UINT token; + HRESULT hr; + IDirectXVideoProcessor *processor, *processor2; + DXVA2_VideoDesc video_desc; + GUID guid; + D3DFORMAT format; + + window = create_window(); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + + hr = DXVA2CreateDirect3DDeviceManager9(&token, &manager); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IDirect3DDeviceManager9_ResetDevice(manager, device, token); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + handle = NULL; + hr = IDirect3DDeviceManager9_OpenDeviceHandle(manager, &handle); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + handle1 = NULL; + hr = IDirect3DDeviceManager9_OpenDeviceHandle(manager, &handle1); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + ok(get_refcount(manager) == 1, "Unexpected refcount %u.\n", get_refcount(manager)); + + hr = IDirect3DDeviceManager9_GetVideoService(manager, handle, &IID_IDirectXVideoProcessorService, + (void **)&service); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + memset(&video_desc, 0, sizeof(video_desc)); + video_desc.SampleWidth = 64; + video_desc.SampleHeight = 64; + video_desc.Format = D3DFMT_A8R8G8B8; + + hr = IDirectXVideoProcessorService_CreateVideoProcessor(service, &DXVA2_VideoProcSoftwareDevice, &video_desc, + D3DFMT_A8R8G8B8, 1, &processor); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IDirectXVideoProcessorService_CreateVideoProcessor(service, &DXVA2_VideoProcSoftwareDevice, &video_desc, + D3DFMT_A8R8G8B8, 1, &processor2); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(processor2 != processor, "Unexpected instance.\n"); + + hr = IDirectXVideoProcessor_GetCreationParameters(processor, NULL, NULL, NULL, NULL); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + + hr = IDirectXVideoProcessor_GetCreationParameters(processor, &guid, NULL, NULL, NULL); +todo_wine { + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(IsEqualGUID(&guid, &DXVA2_VideoProcSoftwareDevice), "Unexpected device guid.\n"); +} + hr = IDirectXVideoProcessor_GetCreationParameters(processor, NULL, NULL, &format, NULL); +todo_wine { + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(format == D3DFMT_A8R8G8B8, "Unexpected format %u.\n", format); +} + IDirectXVideoProcessor_Release(processor); + IDirectXVideoProcessor_Release(processor2); + + hr = IDirect3DDeviceManager9_GetVideoService(manager, handle, &IID_IDirectXVideoProcessorService, + (void **)&service2); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(service == service2, "Unexpected pointer.\n"); + + IDirectXVideoProcessorService_Release(service2); + IDirectXVideoProcessorService_Release(service); + + hr = IDirect3DDeviceManager9_CloseDeviceHandle(manager, handle); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IDirect3DDeviceManager9_CloseDeviceHandle(manager, handle1); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + IDirect3DDevice9_Release(device); + IDirect3DDeviceManager9_Release(manager); + +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); +} + START_TEST(dxva2) { test_device_manager(); + test_video_processor(); }
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dxva2/main.c | 31 +++++++++++++++++++++++++------ dlls/dxva2/tests/dxva2.c | 6 ++---- 2 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/dlls/dxva2/main.c b/dlls/dxva2/main.c index af6ad25697b..6262531c7d1 100644 --- a/dlls/dxva2/main.c +++ b/dlls/dxva2/main.c @@ -71,6 +71,10 @@ struct video_processor LONG refcount;
IDirectXVideoProcessorService *service; + GUID device; + DXVA2_VideoDesc video_desc; + D3DFORMAT rt_format; + unsigned int max_substreams; };
static BOOL dxva_array_reserve(void **elements, size_t *capacity, size_t count, size_t size) @@ -170,14 +174,25 @@ static HRESULT WINAPI video_processor_GetVideoProcessorService(IDirectXVideoProc }
static HRESULT WINAPI video_processor_GetCreationParameters(IDirectXVideoProcessor *iface, - GUID *device, DXVA2_VideoDesc *video_desc, D3DFORMAT *rt_format, UINT *maxstreams) + GUID *device, DXVA2_VideoDesc *video_desc, D3DFORMAT *rt_format, UINT *max_substreams) { - FIXME("%p, %p, %p, %p, %p.\n", iface, device, video_desc, rt_format, maxstreams); + struct video_processor *processor = impl_from_IDirectXVideoProcessor(iface); + + TRACE("%p, %p, %p, %p, %p.\n", iface, device, video_desc, rt_format, max_substreams);
- if (!device && !video_desc && !rt_format && !maxstreams) + if (!device && !video_desc && !rt_format && !max_substreams) return E_INVALIDARG;
- return E_NOTIMPL; + if (device) + *device = processor->device; + if (video_desc) + *video_desc = processor->video_desc; + if (rt_format) + *rt_format = processor->rt_format; + if (max_substreams) + *max_substreams = processor->max_substreams; + + return S_OK; }
static HRESULT WINAPI video_processor_GetVideoProcessorCaps(IDirectXVideoProcessor *iface, @@ -376,12 +391,12 @@ static HRESULT WINAPI device_manager_processor_service_GetFilterPropertyRange( }
static HRESULT WINAPI device_manager_processor_service_CreateVideoProcessor(IDirectXVideoProcessorService *iface, - REFGUID deviceguid, const DXVA2_VideoDesc *video_desc, D3DFORMAT rt_format, UINT max_substreams, + REFGUID device, const DXVA2_VideoDesc *video_desc, D3DFORMAT rt_format, UINT max_substreams, IDirectXVideoProcessor **processor) { struct video_processor *object;
- FIXME("%p, %s, %p, %d, %u, %p.\n", iface, debugstr_guid(deviceguid), video_desc, rt_format, max_substreams, + FIXME("%p, %s, %p, %d, %u, %p.\n", iface, debugstr_guid(device), video_desc, rt_format, max_substreams, processor);
/* FIXME: validate render target format */ @@ -393,6 +408,10 @@ static HRESULT WINAPI device_manager_processor_service_CreateVideoProcessor(IDir object->refcount = 1; object->service = iface; IDirectXVideoProcessorService_AddRef(object->service); + object->device = *device; + object->video_desc = *video_desc; + object->rt_format = rt_format; + object->max_substreams = max_substreams;
*processor = &object->IDirectXVideoProcessor_iface;
diff --git a/dlls/dxva2/tests/dxva2.c b/dlls/dxva2/tests/dxva2.c index 84ccd3b0190..f617bf74079 100644 --- a/dlls/dxva2/tests/dxva2.c +++ b/dlls/dxva2/tests/dxva2.c @@ -420,15 +420,13 @@ static void test_video_processor(void) ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
hr = IDirectXVideoProcessor_GetCreationParameters(processor, &guid, NULL, NULL, NULL); -todo_wine { ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(IsEqualGUID(&guid, &DXVA2_VideoProcSoftwareDevice), "Unexpected device guid.\n"); -} + hr = IDirectXVideoProcessor_GetCreationParameters(processor, NULL, NULL, &format, NULL); -todo_wine { ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(format == D3DFMT_A8R8G8B8, "Unexpected format %u.\n", format); -} + IDirectXVideoProcessor_Release(processor); IDirectXVideoProcessor_Release(processor2);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/evr/mixer.c | 32 ++++++++++++++++++++++++++++++-- dlls/evr/tests/evr.c | 17 +++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/dlls/evr/mixer.c b/dlls/evr/mixer.c index 9969c8187db..b93510c991e 100644 --- a/dlls/evr/mixer.c +++ b/dlls/evr/mixer.c @@ -43,6 +43,7 @@ struct input_stream IMFMediaType *media_type; MFVideoNormalizedRect rect; unsigned int zorder; + IMFSample *sample; };
struct output_stream @@ -172,6 +173,9 @@ static void video_mixer_clear_types(struct video_mixer *mixer) if (mixer->inputs[i].media_type) IMFMediaType_Release(mixer->inputs[i].media_type); mixer->inputs[i].media_type = NULL; + if (mixer->inputs[i].sample) + IMFSample_Release(mixer->inputs[i].sample); + mixer->inputs[i].sample = NULL; } for (i = 0; i < mixer->output.type_count; ++i) { @@ -899,9 +903,33 @@ static HRESULT WINAPI video_mixer_transform_ProcessMessage(IMFTransform *iface,
static HRESULT WINAPI video_mixer_transform_ProcessInput(IMFTransform *iface, DWORD id, IMFSample *sample, DWORD flags) { - FIXME("%p, %u, %p, %#x.\n", iface, id, sample, flags); + struct video_mixer *mixer = impl_from_IMFTransform(iface); + struct input_stream *input; + HRESULT hr;
- return E_NOTIMPL; + TRACE("%p, %u, %p, %#x.\n", iface, id, sample, flags); + + if (!sample) + return E_POINTER; + + EnterCriticalSection(&mixer->cs); + + if (SUCCEEDED(hr = video_mixer_get_input(mixer, id, &input))) + { + if (!input->media_type || !mixer->output.media_type) + hr = MF_E_TRANSFORM_TYPE_NOT_SET; + else if (input->sample) + hr = MF_E_NOTACCEPTING; + else + { + input->sample = sample; + IMFSample_AddRef(input->sample); + } + } + + LeaveCriticalSection(&mixer->cs); + + return hr; }
static HRESULT WINAPI video_mixer_transform_ProcessOutput(IMFTransform *iface, DWORD flags, DWORD count, diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index 9124109c07f..182280d0a39 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -2154,6 +2154,23 @@ todo_wine todo_wine ok(!color, "Unexpected color %#x.\n", color);
+ IMFDesiredSample_Clear(desired); + + hr = IMFTransform_ProcessInput(mixer, 0, NULL, 0); + ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); + + hr = IMFTransform_ProcessInput(mixer, 5, NULL, 0); + ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); + + hr = IMFTransform_ProcessInput(mixer, 0, sample, 0); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMFTransform_ProcessInput(mixer, 0, sample, 0); + ok(hr == MF_E_NOTACCEPTING, "Unexpected hr %#x.\n", hr); + + hr = IMFTransform_ProcessInput(mixer, 5, sample, 0); + ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#x.\n", hr); + IMFSample_Release(sample);
IDirect3DSurface9_Release(surface);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/evr/mixer.c | 51 ++++++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 19 deletions(-)
diff --git a/dlls/evr/mixer.c b/dlls/evr/mixer.c index b93510c991e..fd7596eeadf 100644 --- a/dlls/evr/mixer.c +++ b/dlls/evr/mixer.c @@ -46,11 +46,18 @@ struct input_stream IMFSample *sample; };
+struct rt_format +{ + GUID device; + D3DFORMAT format; + IMFMediaType *media_type; +}; + struct output_stream { IMFMediaType *media_type; - IMFMediaType **media_types; - unsigned int type_count; + struct rt_format *rt_formats; + unsigned int rt_formats_count; };
struct video_mixer @@ -177,11 +184,11 @@ static void video_mixer_clear_types(struct video_mixer *mixer) IMFSample_Release(mixer->inputs[i].sample); mixer->inputs[i].sample = NULL; } - for (i = 0; i < mixer->output.type_count; ++i) + for (i = 0; i < mixer->output.rt_formats_count; ++i) { - IMFMediaType_Release(mixer->output.media_types[i]); + IMFMediaType_Release(mixer->output.rt_formats[i].media_type); } - heap_free(mixer->output.media_types); + heap_free(mixer->output.rt_formats); if (mixer->output.media_type) IMFMediaType_Release(mixer->output.media_type); mixer->output.media_type = NULL; @@ -564,11 +571,11 @@ static HRESULT WINAPI video_mixer_transform_GetOutputAvailableType(IMFTransform
if (!mixer->inputs[0].media_type) hr = MF_E_TRANSFORM_TYPE_NOT_SET; - else if (index >= mixer->output.type_count) + else if (index >= mixer->output.rt_formats_count) hr = MF_E_NO_MORE_TYPES; else { - *type = (IMFMediaType *)mixer->output.media_types[index]; + *type = mixer->output.rt_formats[index].media_type; IMFMediaType_AddRef(*type); }
@@ -609,10 +616,10 @@ done:
static int rt_formats_sort_compare(const void *left, const void *right) { - D3DFORMAT format1 = *(D3DFORMAT *)left, format2 = *(D3DFORMAT *)right; + const struct rt_format *format1 = left, *format2 = right;
- if (format1 < format2) return -1; - if (format1 > format2) return 1; + if (format1->format < format2->format) return -1; + if (format1->format > format2->format) return 1; return 0; }
@@ -620,8 +627,9 @@ static HRESULT video_mixer_collect_output_types(struct video_mixer *mixer, const IDirectXVideoProcessorService *service, unsigned int device_count, const GUID *devices, unsigned int flags) { unsigned int i, j, format_count, count; - D3DFORMAT *rt_formats = NULL, *formats, *ptr; + struct rt_format *rt_formats = NULL, *ptr; HRESULT hr = MF_E_INVALIDMEDIATYPE; + D3DFORMAT *formats; GUID subtype;
count = 0; @@ -639,7 +647,11 @@ static HRESULT video_mixer_collect_output_types(struct video_mixer *mixer, const } rt_formats = ptr;
- memcpy(&rt_formats[count], formats, format_count * sizeof(*formats)); + for (j = 0; j < format_count; ++j) + { + rt_formats[count + j].format = formats[j]; + rt_formats[count + j].device = devices[i]; + } count += format_count;
CoTaskMemFree(formats); @@ -653,7 +665,7 @@ static HRESULT video_mixer_collect_output_types(struct video_mixer *mixer, const j = 0; for (i = j + 1; i < count; ++i) { - if (rt_formats[i] != rt_formats[j]) + if (rt_formats[i].format != rt_formats[j].format) { rt_formats[++j] = rt_formats[i]; } @@ -661,14 +673,15 @@ static HRESULT video_mixer_collect_output_types(struct video_mixer *mixer, const count = j + 1;
memcpy(&subtype, &MFVideoFormat_Base, sizeof(subtype)); - if ((mixer->output.media_types = heap_calloc(count, sizeof(*mixer->output.media_types)))) + if ((mixer->output.rt_formats = heap_calloc(count, sizeof(*mixer->output.rt_formats)))) { for (i = 0; i < count; ++i) { - subtype.Data1 = rt_formats[i]; - MFCreateVideoMediaTypeFromSubtype(&subtype, (IMFVideoMediaType **)&mixer->output.media_types[i]); + subtype.Data1 = rt_formats[i].format; + mixer->output.rt_formats[i] = rt_formats[i]; + MFCreateVideoMediaTypeFromSubtype(&subtype, (IMFVideoMediaType **)&mixer->output.rt_formats[i].media_type); } - mixer->output.type_count = count; + mixer->output.rt_formats_count = count; } else { @@ -757,10 +770,10 @@ static HRESULT WINAPI video_mixer_transform_SetOutputType(IMFTransform *iface, D
EnterCriticalSection(&mixer->cs);
- for (i = 0; i < mixer->output.type_count; ++i) + for (i = 0; i < mixer->output.rt_formats_count; ++i) { compare_flags = 0; - if (FAILED(IMFMediaType_IsEqual(type, mixer->output.media_types[i], &compare_flags))) + if (FAILED(IMFMediaType_IsEqual(type, mixer->output.rt_formats[i].media_type, &compare_flags))) continue;
if ((compare_flags & equality_flags) == equality_flags)