Nikolay Sivov : evr/mixer: Reuse full set of type attributes for output types.
Alexandre Julliard
julliard at winehq.org
Mon Nov 9 15:11:51 CST 2020
Module: wine
Branch: master
Commit: 292b54f3ae4725f287fe587e3420fd5a7b59f03a
URL: https://source.winehq.org/git/wine.git/?a=commit;h=292b54f3ae4725f287fe587e3420fd5a7b59f03a
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Mon Nov 9 15:02:42 2020 +0300
evr/mixer: Reuse full set of type attributes for output types.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/evr/mixer.c | 16 ++++++++++++----
dlls/evr/tests/evr.c | 21 ++++++++++++++++++++-
2 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/dlls/evr/mixer.c b/dlls/evr/mixer.c
index 20b5e3b2bba..a60da623f64 100644
--- a/dlls/evr/mixer.c
+++ b/dlls/evr/mixer.c
@@ -653,7 +653,8 @@ static int rt_formats_sort_compare(const void *left, const void *right)
}
static HRESULT video_mixer_collect_output_types(struct video_mixer *mixer, const DXVA2_VideoDesc *video_desc,
- IDirectXVideoProcessorService *service, unsigned int device_count, const GUID *devices, unsigned int flags)
+ IMFMediaType *media_type, IDirectXVideoProcessorService *service, unsigned int device_count,
+ const GUID *devices, unsigned int flags)
{
unsigned int i, j, format_count, count;
struct rt_format *rt_formats = NULL, *ptr;
@@ -706,9 +707,16 @@ static HRESULT video_mixer_collect_output_types(struct video_mixer *mixer, const
{
for (i = 0; i < count; ++i)
{
+ IMFMediaType *rt_media_type;
+
subtype.Data1 = rt_formats[i].format;
mixer->output.rt_formats[i] = rt_formats[i];
- MFCreateVideoMediaTypeFromSubtype(&subtype, (IMFVideoMediaType **)&mixer->output.rt_formats[i].media_type);
+
+ MFCreateMediaType(&rt_media_type);
+ IMFMediaType_CopyAllItems(media_type, (IMFAttributes *)rt_media_type);
+ IMFMediaType_SetGUID(rt_media_type, &MF_MT_SUBTYPE, &subtype);
+
+ mixer->output.rt_formats[i].media_type = rt_media_type;
}
mixer->output.rt_formats_count = count;
}
@@ -785,8 +793,8 @@ static HRESULT WINAPI video_mixer_transform_SetInputType(IMFTransform *iface, DW
if (SUCCEEDED(hr = IDirectXVideoProcessorService_GetVideoProcessorDeviceGuids(service, &video_desc,
&count, &guids)))
{
- if (SUCCEEDED(hr = video_mixer_collect_output_types(mixer, &video_desc, service, count,
- guids, flags)) && !(flags & MFT_SET_TYPE_TEST_ONLY))
+ if (SUCCEEDED(hr = video_mixer_collect_output_types(mixer, &video_desc, media_type,
+ service, count, guids, flags)) && !(flags & MFT_SET_TYPE_TEST_ONLY))
{
if (mixer->inputs[0].media_type)
IMFMediaType_Release(mixer->inputs[0].media_type);
diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c
index a711be7ad21..a1d7b7109d9 100644
--- a/dlls/evr/tests/evr.c
+++ b/dlls/evr/tests/evr.c
@@ -915,11 +915,11 @@ static void test_default_mixer_type_negotiation(void)
IDirect3DDevice9 *device;
IMFMediaType *video_type;
IMFTransform *transform;
+ DWORD index, count;
GUID guid, *guids;
IDirect3D9 *d3d;
IUnknown *unk;
HWND window;
- DWORD count;
HRESULT hr;
UINT token;
@@ -1013,6 +1013,25 @@ static void test_default_mixer_type_negotiation(void)
IMFMediaType_Release(media_type);
IMFMediaType_Release(media_type2);
+ /* Check attributes on available output types. */
+ index = 0;
+ while (SUCCEEDED(IMFTransform_GetOutputAvailableType(transform, 0, index++, &media_type)))
+ {
+ UINT64 frame_size;
+ GUID subtype;
+ UINT32 value;
+
+ hr = IMFMediaType_GetGUID(media_type, &MF_MT_SUBTYPE, &subtype);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ hr = IMFMediaType_GetUINT64(media_type, &MF_MT_FRAME_SIZE, &frame_size);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ hr = IMFMediaType_GetUINT32(media_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, &value);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ IMFMediaType_Release(media_type);
+ }
+ ok(index > 1, "Unexpected number of available types.\n");
+
hr = IMFTransform_QueryInterface(transform, &IID_IMFVideoProcessor, (void **)&processor);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
More information about the wine-cvs
mailing list