Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfplat/tests/mfplat.c | 90 +++++++++++++++----------------------- 1 file changed, 36 insertions(+), 54 deletions(-)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index c9a01644c6b..474d6281f5f 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -70,6 +70,21 @@ static void _expect_ref(IUnknown *obj, ULONG ref, int line) ok_(__FILE__,line)(rc == ref, "Unexpected refcount %d, expected %d.\n", rc, ref); }
+#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) +static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) +{ + IUnknown *iface = iface_ptr; + HRESULT hr, expected_hr; + IUnknown *unk; + + expected_hr = supported ? S_OK : E_NOINTERFACE; + + hr = IUnknown_QueryInterface(iface, iid, (void **)&unk); + ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr); + if (SUCCEEDED(hr)) + IUnknown_Release(unk); +} + static HRESULT (WINAPI *pD3D11CreateDevice)(IDXGIAdapter *adapter, D3D_DRIVER_TYPE driver_type, HMODULE swrast, UINT flags, const D3D_FEATURE_LEVEL *feature_levels, UINT levels, UINT sdk_version, ID3D11Device **device_out, D3D_FEATURE_LEVEL *obtained_feature_level, ID3D11DeviceContext **immediate_context); @@ -867,8 +882,8 @@ if(0) hr = MFCreateMediaType(&mediatype); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
- hr = IMFMediaType_QueryInterface(mediatype, &IID_IMFVideoMediaType, (void **)&unk); - ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr); + check_interface(mediatype, &IID_IMFVideoMediaType, FALSE); + hr = IMFMediaType_QueryInterface(mediatype, &IID_IUnknown, (void **)&unk); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(unk == (IUnknown *)mediatype, "Unexpected pointer.\n"); @@ -899,13 +914,9 @@ if(0)
hr = MFCreateVideoMediaTypeFromSubtype(&MFVideoFormat_RGB555, &video_type); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - hr = IMFVideoMediaType_QueryInterface(video_type, &IID_IMFMediaType, (void **)&unk); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - IUnknown_Release(unk);
- hr = IMFVideoMediaType_QueryInterface(video_type, &IID_IMFVideoMediaType, (void **)&unk); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - IUnknown_Release(unk); + check_interface(video_type, &IID_IMFMediaType, TRUE); + check_interface(video_type, &IID_IMFVideoMediaType, TRUE);
/* Major and subtype are set on creation. */ hr = IMFVideoMediaType_GetCount(video_type, &count); @@ -917,8 +928,7 @@ if(0) hr = IMFVideoMediaType_GetCount(video_type, &count); ok(!count, "Unexpected attribute count %#x.\n", hr);
- hr = IMFVideoMediaType_QueryInterface(video_type, &IID_IMFVideoMediaType, (void **)&unk); - ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr); + check_interface(video_type, &IID_IMFVideoMediaType, FALSE);
IMFVideoMediaType_Release(video_type);
@@ -928,8 +938,8 @@ if(0) hr = MFCreateMediaType(&mediatype); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
- hr = IMFMediaType_QueryInterface(mediatype, &IID_IMFAudioMediaType, (void **)&unk); - ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr); + check_interface(mediatype, &IID_IMFAudioMediaType, FALSE); + hr = IMFMediaType_QueryInterface(mediatype, &IID_IUnknown, (void **)&unk); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(unk == (IUnknown *)mediatype, "Unexpected pointer.\n"); @@ -1620,17 +1630,10 @@ static void test_MFCreateMFByteStreamOnStream(void) ref = IMFByteStream_Release(bytestream2); ok(ref == 2, "got %u\n", ref);
- hr = IMFByteStream_QueryInterface(bytestream, &IID_IMFByteStreamBuffering, (void **)&unknown); - ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr); - - hr = IMFByteStream_QueryInterface(bytestream, &IID_IMFByteStreamCacheControl, (void **)&unknown); - ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr); - - hr = IMFByteStream_QueryInterface(bytestream, &IID_IMFMediaEventGenerator, (void **)&unknown); - ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr); - - hr = IMFByteStream_QueryInterface(bytestream, &IID_IMFGetService, (void **)&unknown); - ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr); + check_interface(bytestream, &IID_IMFByteStreamBuffering, FALSE); + check_interface(bytestream, &IID_IMFByteStreamCacheControl, FALSE); + check_interface(bytestream, &IID_IMFMediaEventGenerator, FALSE); + check_interface(bytestream, &IID_IMFGetService, FALSE);
hr = IMFByteStream_GetCapabilities(bytestream, &caps); ok(hr == S_OK, "Failed to get stream capabilities, hr %#x.\n", hr); @@ -1666,7 +1669,6 @@ static void test_file_stream(void) WCHAR pathW[MAX_PATH]; DWORD caps, count; WCHAR *filename; - IUnknown *unk; HRESULT hr; WCHAR *str; BOOL eos; @@ -1680,18 +1682,10 @@ static void test_file_stream(void) MF_FILEFLAGS_NONE, filename, &bytestream); ok(hr == S_OK, "got 0x%08x\n", hr);
- hr = IMFByteStream_QueryInterface(bytestream, &IID_IMFByteStreamBuffering, (void **)&unk); - ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr); - - hr = IMFByteStream_QueryInterface(bytestream, &IID_IMFByteStreamCacheControl, (void **)&unk); - ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr); - - hr = IMFByteStream_QueryInterface(bytestream, &IID_IMFMediaEventGenerator, (void **)&unk); - ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr); - - hr = IMFByteStream_QueryInterface(bytestream, &IID_IMFGetService, (void **)&unk); - ok(hr == S_OK, "Failed to get interface pointer, hr %#x.\n", hr); - IUnknown_Release(unk); + check_interface(bytestream, &IID_IMFByteStreamBuffering, FALSE); + check_interface(bytestream, &IID_IMFByteStreamCacheControl, FALSE); + check_interface(bytestream, &IID_IMFMediaEventGenerator, FALSE); + check_interface(bytestream, &IID_IMFGetService, TRUE);
hr = IMFByteStream_GetCapabilities(bytestream, &caps); ok(hr == S_OK, "Failed to get stream capabilities, hr %#x.\n", hr); @@ -1818,7 +1812,6 @@ static void test_system_memory_buffer(void) HRESULT hr; DWORD length, max; BYTE *data, *data2; - IUnknown *unk;
hr = MFCreateMemoryBuffer(1024, NULL); ok(hr == E_INVALIDARG || hr == E_POINTER, "got 0x%08x\n", hr); @@ -1837,8 +1830,7 @@ static void test_system_memory_buffer(void) hr = MFCreateMemoryBuffer(1024, &buffer); ok(hr == S_OK, "got 0x%08x\n", hr);
- hr = IMFMediaBuffer_QueryInterface(buffer, &IID_IMFGetService, (void **)&unk); - ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr); + check_interface(buffer, &IID_IMFGetService, FALSE);
hr = IMFMediaBuffer_GetMaxLength(buffer, NULL); ok(hr == E_INVALIDARG || hr == E_POINTER, "got 0x%08x\n", hr); @@ -4443,7 +4435,6 @@ static void test_create_property_store(void) PROPVARIANT value = {0}; PROPERTYKEY key; ULONG refcount; - IUnknown *unk; DWORD count; HRESULT hr;
@@ -4458,10 +4449,8 @@ static void test_create_property_store(void) ok(store2 != store, "Expected different store objects.\n"); IPropertyStore_Release(store2);
- hr = IPropertyStore_QueryInterface(store, &IID_IPropertyStoreCache, (void **)&unk); - ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr); - hr = IPropertyStore_QueryInterface(store, &IID_IPersistSerializedPropStorage, (void **)&unk); - ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr); + check_interface(store, &IID_IPropertyStoreCache, FALSE); + check_interface(store, &IID_IPersistSerializedPropStorage, FALSE);
hr = IPropertyStore_GetCount(store, NULL); ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); @@ -5195,7 +5184,6 @@ static void test_MFCreate2DMediaBuffer(void) IMF2DBuffer *_2dbuffer; IMFMediaBuffer *buffer; int i, pitch, pitch2; - IUnknown *unk; HRESULT hr; BOOL ret;
@@ -5218,9 +5206,7 @@ static void test_MFCreate2DMediaBuffer(void) hr = pMFCreate2DMediaBuffer(2, 3, MAKEFOURCC('N','V','1','2'), FALSE, &buffer); ok(hr == S_OK, "Failed to create a buffer, hr %#x.\n", hr);
- hr = IMFMediaBuffer_QueryInterface(buffer, &IID_IMFGetService, (void **)&unk); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - IUnknown_Release(unk); + check_interface(buffer, &IID_IMFGetService, TRUE);
/* Full backing buffer size, with 64 bytes per row alignment. */ hr = IMFMediaBuffer_GetMaxLength(buffer, &max_length); @@ -5450,7 +5436,6 @@ static void test_MFCreateMediaBufferFromMediaType(void) HRESULT hr; IMFMediaType *media_type; unsigned int i; - IUnknown *unk;
if (!pMFCreateMediaBufferFromMediaType) { @@ -5483,8 +5468,7 @@ static void test_MFCreateMediaBufferFromMediaType(void) if (FAILED(hr)) break;
- hr = IMFMediaBuffer_QueryInterface(buffer, &IID_IMFGetService, (void **)&unk); - ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr); + check_interface(buffer, &IID_IMFGetService, FALSE);
hr = IMFMediaBuffer_GetMaxLength(buffer, &length); ok(hr == S_OK, "Failed to get length, hr %#x.\n", hr); @@ -5827,7 +5811,6 @@ done: static void test_MFCreateTrackedSample(void) { IMFTrackedSample *tracked_sample; - IMFDesiredSample *desired_sample; IMFSample *sample; IUnknown *unk; HRESULT hr; @@ -5852,8 +5835,7 @@ static void test_MFCreateTrackedSample(void)
IMFSample_Release(sample);
- hr = IMFTrackedSample_QueryInterface(tracked_sample, &IID_IMFDesiredSample, (void **)&desired_sample); - ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr); + check_interface(tracked_sample, &IID_IMFDesiredSample, FALSE);
IMFTrackedSample_Release(tracked_sample); }
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- include/mfmediaengine.idl | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/include/mfmediaengine.idl b/include/mfmediaengine.idl index b914cb3600b..c00e364116e 100644 --- a/include/mfmediaengine.idl +++ b/include/mfmediaengine.idl @@ -76,6 +76,8 @@ typedef enum MF_MEDIA_ENGINE_CANPLAY MF_MEDIA_ENGINE_CANPLAY_PROBABLY, } MF_MEDIA_ENGINE_CANPLAY;
+cpp_quote("#ifndef _MFVideoNormalizedRect_") +cpp_quote("#define _MFVideoNormalizedRect_") typedef struct MFVideoNormalizedRect { float left; @@ -83,6 +85,7 @@ typedef struct MFVideoNormalizedRect float right; float bottom; } MFVideoNormalizedRect; +cpp_quote("#endif")
typedef enum MF_MEDIA_ENGINE_CREATEFLAGS {
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfplat/main.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 1c51fafff1e..44f29522487 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -33,6 +33,7 @@ #include "ole2.h" #include "propsys.h" #include "dxgi.h" +#include "uuids.h"
#include "wine/debug.h" #include "wine/list.h" @@ -1543,18 +1544,28 @@ const char *debugstr_attr(const GUID *guid) X(MF_TOPONODE_MARKIN_HERE), X(MF_MT_H264_SUPPORTED_SYNC_FRAME_TYPES), X(MF_TOPONODE_MARKOUT_HERE), + X(EVRConfig_ForceBob), X(MF_TOPONODE_DECODER), + X(EVRConfig_AllowDropToBob), X(MF_TOPOLOGY_PROJECTSTART), + X(EVRConfig_ForceThrottle), X(MF_VIDEO_MAX_MB_PER_SEC), X(MF_TOPOLOGY_PROJECTSTOP), X(MF_SINK_WRITER_ENCODER_CONFIG), + X(EVRConfig_AllowDropToThrottle), X(MF_TOPOLOGY_NO_MARKIN_MARKOUT), + X(EVRConfig_ForceHalfInterlace), + X(EVRConfig_AllowDropToHalfInterlace), + X(EVRConfig_ForceScaling), X(MF_MT_H264_CAPABILITIES), + X(EVRConfig_AllowScaling), X(MF_SOURCE_READER_ENABLE_TRANSCODE_ONLY_TRANSFORMS), X(MFT_PREFERRED_ENCODER_PROFILE), + X(EVRConfig_ForceBatching), + X(EVRConfig_AllowBatching), X(MF_TOPOLOGY_DYNAMIC_CHANGE_NOT_ALLOWED), - X(MF_MT_MPEG2_PROFILE), X(MF_MT_VIDEO_PROFILE), + X(MF_MT_MPEG2_PROFILE), X(MF_MT_DV_AAUX_CTRL_PACK_1), X(MF_MT_ALPHA_MODE), X(MF_MT_MPEG2_TIMECODE), @@ -1743,8 +1754,8 @@ const char *debugstr_attr(const GUID *guid) X(MF_TOPONODE_DISABLE_PREROLL), X(MF_MT_VIDEO_3D_FORMAT), X(MF_EVENT_STREAM_METADATA_KEYDATA), - X(MF_SOURCE_READER_D3D_MANAGER), X(MF_SINK_WRITER_D3D_MANAGER), + X(MF_SOURCE_READER_D3D_MANAGER), X(MFSampleExtension_3DVideo), X(MF_MT_H264_USAGE), X(MF_MEDIA_ENGINE_EME_CALLBACK),
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/evr/sample.c | 74 ++++++++++++++++++++++++++++++++++---------- dlls/evr/tests/evr.c | 39 +++++++++++++++++++++++ 2 files changed, 96 insertions(+), 17 deletions(-)
diff --git a/dlls/evr/sample.c b/dlls/evr/sample.c index 7764ec945d2..aedf19b9fd4 100644 --- a/dlls/evr/sample.c +++ b/dlls/evr/sample.c @@ -61,6 +61,13 @@ struct surface_buffer ULONG length; };
+enum sample_prop_flags +{ + SAMPLE_PROP_HAS_DURATION = 1 << 0, + SAMPLE_PROP_HAS_TIMESTAMP = 1 << 1, + SAMPLE_PROP_HAS_DESIRED_PROPS = 1 << 2, +}; + struct video_sample { IMFSample IMFSample_iface; @@ -73,9 +80,12 @@ struct video_sample IMFAsyncResult *tracked_result; LONG tracked_refcount;
- LONGLONG desired_time; + LONGLONG timestamp; + LONGLONG duration; + LONGLONG desired_timestamp; LONGLONG desired_duration; - BOOL desired_set; + unsigned int flags; + CRITICAL_SECTION cs; };
static struct video_sample *impl_from_IMFSample(IMFSample *iface) @@ -931,6 +941,7 @@ static ULONG WINAPI video_sample_Release(IMFSample *iface) video_sample_stop_tracking_thread(); if (sample->sample) IMFSample_Release(sample->sample); + DeleteCriticalSection(&sample->cs); heap_free(sample); }
@@ -1229,10 +1240,18 @@ static HRESULT WINAPI video_sample_SetSampleFlags(IMFSample *iface, DWORD flags) static HRESULT WINAPI video_sample_GetSampleTime(IMFSample *iface, LONGLONG *timestamp) { struct video_sample *sample = impl_from_IMFSample(iface); + HRESULT hr = S_OK;
TRACE("%p, %p.\n", iface, timestamp);
- return IMFSample_GetSampleTime(sample->sample, timestamp); + EnterCriticalSection(&sample->cs); + if (sample->flags & SAMPLE_PROP_HAS_TIMESTAMP) + *timestamp = sample->timestamp; + else + hr = MF_E_NO_SAMPLE_TIMESTAMP; + LeaveCriticalSection(&sample->cs); + + return hr; }
static HRESULT WINAPI video_sample_SetSampleTime(IMFSample *iface, LONGLONG timestamp) @@ -1241,16 +1260,29 @@ static HRESULT WINAPI video_sample_SetSampleTime(IMFSample *iface, LONGLONG time
TRACE("%p, %s.\n", iface, debugstr_time(timestamp));
- return IMFSample_SetSampleTime(sample->sample, timestamp); + EnterCriticalSection(&sample->cs); + sample->timestamp = timestamp; + sample->flags |= SAMPLE_PROP_HAS_TIMESTAMP; + LeaveCriticalSection(&sample->cs); + + return S_OK; }
static HRESULT WINAPI video_sample_GetSampleDuration(IMFSample *iface, LONGLONG *duration) { struct video_sample *sample = impl_from_IMFSample(iface); + HRESULT hr = S_OK;
TRACE("%p, %p.\n", iface, duration);
- return IMFSample_GetSampleDuration(sample->sample, duration); + EnterCriticalSection(&sample->cs); + if (sample->flags & SAMPLE_PROP_HAS_DURATION) + *duration = sample->duration; + else + hr = MF_E_NO_SAMPLE_DURATION; + LeaveCriticalSection(&sample->cs); + + return hr; }
static HRESULT WINAPI video_sample_SetSampleDuration(IMFSample *iface, LONGLONG duration) @@ -1259,7 +1291,12 @@ static HRESULT WINAPI video_sample_SetSampleDuration(IMFSample *iface, LONGLONG
TRACE("%p, %s.\n", iface, debugstr_time(duration));
- return IMFSample_SetSampleDuration(sample->sample, duration); + EnterCriticalSection(&sample->cs); + sample->duration = duration; + sample->flags |= SAMPLE_PROP_HAS_DURATION; + LeaveCriticalSection(&sample->cs); + + return S_OK; }
static HRESULT WINAPI video_sample_GetBufferCount(IMFSample *iface, DWORD *count) @@ -1468,15 +1505,15 @@ static HRESULT WINAPI desired_video_sample_GetDesiredSampleTimeAndDuration(IMFDe if (!sample_time || !sample_duration) return E_POINTER;
- IMFSample_LockStore(sample->sample); - if (sample->desired_set) + EnterCriticalSection(&sample->cs); + if (sample->flags & SAMPLE_PROP_HAS_DESIRED_PROPS) { - *sample_time = sample->desired_time; + *sample_time = sample->desired_timestamp; *sample_duration = sample->desired_duration; } else hr = MF_E_NOT_AVAILABLE; - IMFSample_UnlockStore(sample->sample); + LeaveCriticalSection(&sample->cs);
return hr; } @@ -1488,11 +1525,11 @@ static void WINAPI desired_video_sample_SetDesiredSampleTimeAndDuration(IMFDesir
TRACE("%p, %s, %s.\n", iface, debugstr_time(sample_time), debugstr_time(sample_duration));
- IMFSample_LockStore(sample->sample); - sample->desired_set = TRUE; - sample->desired_time = sample_time; + EnterCriticalSection(&sample->cs); + sample->flags |= SAMPLE_PROP_HAS_DESIRED_PROPS; + sample->desired_timestamp = sample_time; sample->desired_duration = sample_duration; - IMFSample_UnlockStore(sample->sample); + LeaveCriticalSection(&sample->cs); }
static void WINAPI desired_video_sample_Clear(IMFDesiredSample *iface) @@ -1501,9 +1538,11 @@ static void WINAPI desired_video_sample_Clear(IMFDesiredSample *iface)
TRACE("%p.\n", iface);
- IMFSample_LockStore(sample->sample); - sample->desired_set = FALSE; - IMFSample_UnlockStore(sample->sample); + EnterCriticalSection(&sample->cs); + sample->flags = 0; + IMFSample_SetSampleFlags(sample->sample, 0); + IMFSample_DeleteAllItems(sample->sample); + LeaveCriticalSection(&sample->cs); }
static const IMFDesiredSampleVtbl desired_video_sample_vtbl = @@ -1693,6 +1732,7 @@ HRESULT WINAPI MFCreateVideoSampleFromSurface(IUnknown *surface, IMFSample **sam object->IMFTrackedSample_iface.lpVtbl = &tracked_video_sample_vtbl; object->IMFDesiredSample_iface.lpVtbl = &desired_video_sample_vtbl; object->refcount = 1; + InitializeCriticalSection(&object->cs);
if (FAILED(hr = MFCreateSample(&object->sample))) { diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index 882d61b9d37..f1831b58f89 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -790,6 +790,45 @@ static void test_surface_sample(void) ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(!count, "Unexpected attribute count %u.\n", count);
+ /* Attributes are cleared. */ + hr = IMFSample_SetUnknown(sample, &MFSampleExtension_Token, NULL); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMFSample_GetCount(sample, &count); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(count == 1, "Unexpected attribute count %u.\n", count); + + hr = IMFSample_SetSampleTime(sample, 0); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMFSample_GetSampleTime(sample, &time1); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMFSample_SetSampleDuration(sample, 0); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMFSample_GetSampleDuration(sample, &duration); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMFSample_SetSampleFlags(sample, 0x1); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + IMFDesiredSample_Clear(desired_sample); + + hr = IMFSample_GetCount(sample, &count); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(!count, "Unexpected attribute count %u.\n", count); + + hr = IMFSample_GetSampleTime(sample, &time1); + ok(hr == MF_E_NO_SAMPLE_TIMESTAMP, "Unexpected hr %#x.\n", hr); + + hr = IMFSample_GetSampleDuration(sample, &duration); + ok(hr == MF_E_NO_SAMPLE_DURATION, "Unexpected hr %#x.\n", hr); + + hr = IMFSample_GetSampleFlags(sample, &flags); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(flags == 0, "Unexpected flags %#x.\n", flags); + IMFDesiredSample_Release(desired_sample);
hr = IMFSample_GetCount(sample, &count);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/evr/mixer.c | 28 ++++++++++++++++++++++++---- dlls/evr/tests/evr.c | 2 -- 2 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/dlls/evr/mixer.c b/dlls/evr/mixer.c index 66cb9b021a7..997c5054f12 100644 --- a/dlls/evr/mixer.c +++ b/dlls/evr/mixer.c @@ -1222,10 +1222,25 @@ static void video_mixer_render(struct video_mixer *mixer, IDirect3DSurface9 *rt) IDirect3DSurface9_Release(surface); }
+static HRESULT video_mixer_get_sample_desired_time(IMFSample *sample, LONGLONG *timestamp, LONGLONG *duration) +{ + IMFDesiredSample *desired; + HRESULT hr; + + if (SUCCEEDED(hr = IMFSample_QueryInterface(sample, &IID_IMFDesiredSample, (void **)&desired))) + { + hr = IMFDesiredSample_GetDesiredSampleTimeAndDuration(desired, timestamp, duration); + IMFDesiredSample_Release(desired); + } + + return hr; +} + static HRESULT WINAPI video_mixer_transform_ProcessOutput(IMFTransform *iface, DWORD flags, DWORD count, MFT_OUTPUT_DATA_BUFFER *buffers, DWORD *status) { struct video_mixer *mixer = impl_from_IMFTransform(iface); + LONGLONG timestamp, duration; IDirect3DSurface9 *surface; IDirect3DDevice9 *device; unsigned int i; @@ -1272,12 +1287,17 @@ static HRESULT WINAPI video_mixer_transform_ProcessOutput(IMFTransform *iface, D } else { - if (SUCCEEDED(hr = video_mixer_get_d3d_device(mixer, &device))) + if (SUCCEEDED(video_mixer_get_sample_desired_time(buffers->pSample, ×tamp, &duration))) { - IDirect3DDevice9_ColorFill(device, surface, NULL, 0); - IDirect3DDeviceManager9_UnlockDevice(mixer->device_manager, mixer->device_handle, FALSE); - IDirect3DDevice9_Release(device); + if (SUCCEEDED(hr = video_mixer_get_d3d_device(mixer, &device))) + { + IDirect3DDevice9_ColorFill(device, surface, NULL, 0); + IDirect3DDeviceManager9_UnlockDevice(mixer->device_manager, mixer->device_handle, FALSE); + IDirect3DDevice9_Release(device); + } } + else + hr = MF_E_TRANSFORM_NEED_MORE_INPUT; } IDirect3DSurface9_Release(surface); } diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index f1831b58f89..dbc3bcbc582 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -2324,11 +2324,9 @@ static void test_mixer_samples(void)
buffers[0].pSample = sample; hr = IMFTransform_ProcessOutput(mixer, 0, 1, buffers, &status); -todo_wine ok(hr == MF_E_TRANSFORM_NEED_MORE_INPUT, "Unexpected hr %#x.\n", hr);
color = get_surface_color(surface, 0, 0); -todo_wine ok(color == D3DCOLOR_ARGB(0x10, 0xff, 0x00, 0x00), "Unexpected color %#x.\n", color);
/* Streaming is not started yet. Output is colored black, but only if desired timestamps were set. */
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/evr/tests/evr.c | 67 ++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 36 deletions(-)
diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index dbc3bcbc582..244d4310bbc 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -231,6 +231,21 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO IUnknown_Release(unk); }
+#define check_service_interface(a, b, c, d) check_service_interface_(__LINE__, a, b, c, d) +static void check_service_interface_(unsigned int line, void *iface_ptr, REFGUID service, REFIID iid, BOOL supported) +{ + IUnknown *iface = iface_ptr; + HRESULT hr, expected_hr; + IUnknown *unk; + + expected_hr = supported ? S_OK : E_NOINTERFACE; + + hr = MFGetService(iface, service, iid, (void **)&unk); + ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr); + if (SUCCEEDED(hr)) + IUnknown_Release(unk); +} + static void test_interfaces(void) { IBaseFilter *filter = create_evr(); @@ -449,7 +464,6 @@ static void test_default_mixer(void) DXVA2_ValueRange range; DXVA2_Fixed32 dxva_value; DWORD flags, value, count; - IMFGetService *gs; COLORREF color; unsigned int i; DWORD ids[16]; @@ -471,22 +485,12 @@ static void test_default_mixer(void) check_interface(transform, &IID_IMFVideoProcessor, TRUE); check_interface(transform, &IID_IMFVideoMixerControl, TRUE); check_interface(transform, &IID_IMFVideoDeviceID, TRUE); + check_service_interface(transform, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoMixerBitmap, TRUE); + check_service_interface(transform, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoProcessor, TRUE); + check_service_interface(transform, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoMixerControl, TRUE); + check_service_interface(transform, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoPositionMapper, TRUE);
- hr = IMFTransform_QueryInterface(transform, &IID_IMFGetService, (void **)&gs); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - - hr = IMFGetService_GetService(gs, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoMixerBitmap, (void **)&unk); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - IUnknown_Release(unk); - - hr = IMFGetService_GetService(gs, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoProcessor, (void **)&processor); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - - hr = IMFGetService_GetService(gs, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoMixerControl, (void **)&unk); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - IUnknown_Release(unk); - - if (SUCCEEDED(IMFGetService_GetService(gs, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoMixerControl2, (void **)&mixer_control2))) + if (SUCCEEDED(MFGetService((IUnknown *)transform, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoMixerControl2, (void **)&mixer_control2))) { hr = IMFVideoMixerControl2_GetMixingPrefs(mixer_control2, NULL); ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); @@ -498,6 +502,9 @@ static void test_default_mixer(void) IMFVideoMixerControl2_Release(mixer_control2); }
+ hr = MFGetService((IUnknown *)transform, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoProcessor, (void **)&processor); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMFVideoProcessor_GetBackgroundColor(processor, NULL); ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
@@ -527,12 +534,6 @@ todo_wine
IMFVideoProcessor_Release(processor);
- hr = IMFGetService_GetService(gs, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoPositionMapper, (void **)&unk); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - IUnknown_Release(unk); - - IMFGetService_Release(gs); - hr = IMFTransform_SetOutputBounds(transform, 100, 10); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
@@ -1123,9 +1124,7 @@ static void test_default_presenter(void) IMFRateSupport *rate_support; IDirect3DDeviceManager9 *dm; IMFVideoDeviceID *deviceid; - IMFGetService *gs; HWND hwnd, hwnd2; - IUnknown *unk; DWORD flags; float rate; HRESULT hr; @@ -1149,10 +1148,11 @@ static void test_default_presenter(void) check_interface(presenter, &IID_IMFVideoPresenter, TRUE); check_interface(presenter, &IID_IMFVideoDeviceID, TRUE); check_interface(presenter, &IID_IMFQualityAdvise, TRUE); - - hr = MFGetService((IUnknown *)presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoPositionMapper, (void **)&unk); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - IUnknown_Release(unk); + check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoPositionMapper, TRUE); + check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoDisplayControl, TRUE); + todo_wine check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoPresenter, TRUE); + todo_wine check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFClockStateSink, TRUE); + check_service_interface(presenter, &MR_VIDEO_ACCELERATION_SERVICE, &IID_IDirect3DDeviceManager9, TRUE);
hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFVideoDeviceID, (void **)&deviceid); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); @@ -1166,10 +1166,7 @@ static void test_default_presenter(void)
IMFVideoDeviceID_Release(deviceid);
- hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFGetService, (void **)&gs); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - - hr = IMFGetService_GetService(gs, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoDisplayControl, (void **)&display_control); + hr = MFGetService((IUnknown *)presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoDisplayControl, (void **)&display_control); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFVideoDisplayControl_GetRenderingPrefs(display_control, NULL); @@ -1182,7 +1179,7 @@ static void test_default_presenter(void)
IMFVideoDisplayControl_Release(display_control);
- hr = IMFGetService_GetService(gs, &MR_VIDEO_ACCELERATION_SERVICE, &IID_IDirect3DDeviceManager9, (void **)&dm); + hr = MFGetService((IUnknown *)presenter, &MR_VIDEO_ACCELERATION_SERVICE, &IID_IDirect3DDeviceManager9, (void **)&dm); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFVideoDisplayControl, (void **)&display_control); @@ -1461,9 +1458,7 @@ todo_wine hr = IMFSample_GetBufferByIndex(sample, 0, &buffer); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
- hr = MFGetService((IUnknown *)buffer, &MR_BUFFER_SERVICE, &IID_IDirect3DSurface9, (void **)&surface); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - IDirect3DSurface9_Release(surface); + check_service_interface(buffer, &MR_BUFFER_SERVICE, &IID_IDirect3DSurface9, TRUE);
hr = IMFMediaBuffer_QueryInterface(buffer, &IID_IMF2DBuffer, (void **)&unk); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/evr/presenter.c | 13 +------------ dlls/evr/tests/evr.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/dlls/evr/presenter.c b/dlls/evr/presenter.c index 97b9029c70e..84ef223e0fc 100644 --- a/dlls/evr/presenter.c +++ b/dlls/evr/presenter.c @@ -1254,18 +1254,7 @@ static HRESULT WINAPI video_presenter_getservice_GetService(IMFGetService *iface return IDirect3DDeviceManager9_QueryInterface(presenter->device_manager, riid, obj);
if (IsEqualGUID(&MR_VIDEO_RENDER_SERVICE, service)) - { - if (IsEqualIID(riid, &IID_IMFVideoDisplayControl) || - IsEqualIID(riid, &IID_IMFVideoPositionMapper)) - { - return IMFVideoPresenter_QueryInterface(&presenter->IMFVideoPresenter_iface, riid, obj); - } - else - { - FIXME("Unsupported interface %s.\n", debugstr_guid(riid)); - return E_NOTIMPL; - } - } + return IMFVideoPresenter_QueryInterface(&presenter->IMFVideoPresenter_iface, riid, obj);
FIXME("Unimplemented service %s.\n", debugstr_guid(service));
diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index 244d4310bbc..c456bcf5653 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -1150,8 +1150,14 @@ static void test_default_presenter(void) check_interface(presenter, &IID_IMFQualityAdvise, TRUE); check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoPositionMapper, TRUE); check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoDisplayControl, TRUE); - todo_wine check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoPresenter, TRUE); - todo_wine check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFClockStateSink, TRUE); + check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoPresenter, TRUE); + check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFClockStateSink, TRUE); + check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFTopologyServiceLookupClient, TRUE); + check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IQualProp, TRUE); + check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFRateSupport, TRUE); + check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFGetService, TRUE); + check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoDeviceID, TRUE); + check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFQualityAdvise, TRUE); check_service_interface(presenter, &MR_VIDEO_ACCELERATION_SERVICE, &IID_IDirect3DDeviceManager9, TRUE);
hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFVideoDeviceID, (void **)&deviceid);