Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com --- dlls/quartz/tests/vmr9.c | 23 +++++++++++++-- dlls/quartz/vmr9.c | 60 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 2 deletions(-)
diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c index df18bd5f2d5..7b470c6e534 100644 --- a/dlls/quartz/tests/vmr9.c +++ b/dlls/quartz/tests/vmr9.c @@ -242,7 +242,7 @@ static void test_common_interfaces(IBaseFilter *filter) check_interface(filter, &IID_IQualityControl, TRUE); todo_wine check_interface(filter, &IID_IQualProp, TRUE); check_interface(filter, &IID_IUnknown, TRUE); - todo_wine check_interface(filter, &IID_IVMRAspectRatioControl9, TRUE); + check_interface(filter, &IID_IVMRAspectRatioControl9, TRUE); todo_wine check_interface(filter, &IID_IVMRDeinterlaceControl9, TRUE); check_interface(filter, &IID_IVMRFilterConfig9, TRUE); check_interface(filter, &IID_IVMRMixerBitmap9, TRUE); @@ -3851,6 +3851,7 @@ static void test_windowless_size(void) }; IBaseFilter *filter = create_vmr9(VMR9Mode_Windowless); LONG width, height, aspect_width, aspect_height; + IVMRAspectRatioControl9 *aspect_ratio_control; IVMRWindowlessControl9 *windowless_control; IFilterGraph2 *graph = create_graph(); VMR9AspectRatioMode aspect_mode; @@ -3864,6 +3865,7 @@ static void test_windowless_size(void) IPin *pin;
IBaseFilter_QueryInterface(filter, &IID_IVMRWindowlessControl9, (void **)&windowless_control); + IBaseFilter_QueryInterface(filter, &IID_IVMRAspectRatioControl9, (void **)&aspect_ratio_control); IBaseFilter_FindPin(filter, L"VMR Input0", &pin); IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&input); testfilter_init(&source); @@ -3902,6 +3904,11 @@ static void test_windowless_size(void) ok(hr == S_OK, "Got hr %#x.\n", hr); ok(aspect_mode == VMR9ARMode_None, "Got mode %u.\n", aspect_mode);
+ aspect_mode = 0xdeadbeef; + hr = IVMRAspectRatioControl9_GetAspectRatioMode(aspect_ratio_control, &aspect_mode); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(aspect_mode == VMR9ARMode_None, "Got mode %u.\n", aspect_mode); + width = height = 0xdeadbeef; hr = IVMRWindowlessControl9_GetNativeVideoSize(windowless_control, &width, &height, NULL, NULL); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -3956,7 +3963,7 @@ static void test_windowless_size(void) SetRect(&expect, 0, 0, 640, 480); ok(EqualRect(&src, &expect), "Got window rect %s.\n", wine_dbgstr_rect(&src));
- hr = IVMRWindowlessControl9_SetAspectRatioMode(windowless_control, VMR9ARMode_LetterBox); + hr = IVMRAspectRatioControl9_SetAspectRatioMode(aspect_ratio_control, VMR9ARMode_LetterBox); ok(hr == S_OK, "Got hr %#x.\n", hr);
aspect_mode = 0xdeadbeef; @@ -3964,6 +3971,17 @@ static void test_windowless_size(void) ok(hr == S_OK, "Got hr %#x.\n", hr); ok(aspect_mode == VMR9ARMode_LetterBox, "Got mode %u.\n", aspect_mode);
+ hr = IVMRWindowlessControl9_SetAspectRatioMode(windowless_control, VMR9ARMode_None); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + aspect_mode = 0xdeadbeef; + hr = IVMRAspectRatioControl9_GetAspectRatioMode(aspect_ratio_control, &aspect_mode); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(aspect_mode == VMR9ARMode_None, "Got mode %u.\n", aspect_mode); + + hr = IVMRWindowlessControl9_SetAspectRatioMode(windowless_control, VMR9ARMode_LetterBox); + ok(hr == S_OK, "Got hr %#x.\n", hr); + memset(&src, 0xcc, sizeof(src)); memset(&dst, 0xcc, sizeof(dst)); hr = IVMRWindowlessControl9_GetVideoPosition(windowless_control, &src, &dst); @@ -3993,6 +4011,7 @@ out: IMemInputPin_Release(input); IPin_Release(pin); IVMRWindowlessControl9_Release(windowless_control); + IVMRAspectRatioControl9_Release(aspect_ratio_control); ref = IBaseFilter_Release(filter); ok(!ref, "Got outstanding refcount %d.\n", ref); DestroyWindow(window); diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index a24dbc62977..3ddef8dbed5 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -60,6 +60,7 @@ struct quartz_vmr
IAMCertifiedOutputProtection IAMCertifiedOutputProtection_iface; IAMFilterMiscFlags IAMFilterMiscFlags_iface; + IVMRAspectRatioControl9 IVMRAspectRatioControl9_iface; IVMRFilterConfig IVMRFilterConfig_iface; IVMRFilterConfig9 IVMRFilterConfig9_iface; IVMRMixerBitmap9 IVMRMixerBitmap9_iface; @@ -603,6 +604,8 @@ static HRESULT vmr_query_interface(struct strmbase_renderer *iface, REFIID iid, *out = &filter->IAMCertifiedOutputProtection_iface; else if (IsEqualGUID(iid, &IID_IAMFilterMiscFlags)) *out = &filter->IAMFilterMiscFlags_iface; + else if (IsEqualGUID(iid, &IID_IVMRAspectRatioControl9) && is_vmr9(filter)) + *out = &filter->IVMRAspectRatioControl9_iface; else if (IsEqualGUID(iid, &IID_IVMRFilterConfig) && !is_vmr9(filter)) *out = &filter->IVMRFilterConfig_iface; else if (IsEqualGUID(iid, &IID_IVMRFilterConfig9) && is_vmr9(filter)) @@ -2396,6 +2399,62 @@ static const IVMRMixerBitmap9Vtbl mixer_bitmap9_vtbl = mixer_bitmap9_GetAlphaBitmapParameters, };
+static inline struct quartz_vmr *impl_from_IVMRAspectRatioControl9(IVMRAspectRatioControl9 *iface) +{ + return CONTAINING_RECORD(iface, struct quartz_vmr, IVMRAspectRatioControl9_iface); +} + +static HRESULT WINAPI aspect_ratio_control9_QueryInterface(IVMRAspectRatioControl9 *iface, REFIID iid, void **out) +{ + struct quartz_vmr *filter = impl_from_IVMRAspectRatioControl9(iface); + return IUnknown_QueryInterface(filter->renderer.filter.outer_unk, iid, out); +} + +static ULONG WINAPI aspect_ratio_control9_AddRef(IVMRAspectRatioControl9 *iface) +{ + struct quartz_vmr *filter = impl_from_IVMRAspectRatioControl9(iface); + return IUnknown_AddRef(filter->renderer.filter.outer_unk); +} + +static ULONG WINAPI aspect_ratio_control9_Release(IVMRAspectRatioControl9 *iface) +{ + struct quartz_vmr *filter = impl_from_IVMRAspectRatioControl9(iface); + return IUnknown_Release(filter->renderer.filter.outer_unk); +} + +static HRESULT WINAPI aspect_ratio_control9_GetAspectRatioMode(IVMRAspectRatioControl9 *iface, DWORD *mode) +{ + struct quartz_vmr *filter = impl_from_IVMRAspectRatioControl9(iface); + + TRACE("filter %p, mode %p.\n", filter, mode); + + EnterCriticalSection(&filter->renderer.filter.csFilter); + *mode = filter->aspect_mode; + LeaveCriticalSection(&filter->renderer.filter.csFilter); + return S_OK; +} + +static HRESULT WINAPI aspect_ratio_control9_SetAspectRatioMode(IVMRAspectRatioControl9 *iface, DWORD mode) +{ + struct quartz_vmr *filter = impl_from_IVMRAspectRatioControl9(iface); + + TRACE("filter %p, mode %u.\n", filter, mode); + + EnterCriticalSection(&filter->renderer.filter.csFilter); + filter->aspect_mode = mode; + LeaveCriticalSection(&filter->renderer.filter.csFilter); + return S_OK; +} + +static const IVMRAspectRatioControl9Vtbl aspect_ratio_control9_vtbl = +{ + aspect_ratio_control9_QueryInterface, + aspect_ratio_control9_AddRef, + aspect_ratio_control9_Release, + aspect_ratio_control9_GetAspectRatioMode, + aspect_ratio_control9_SetAspectRatioMode, +}; + static inline struct quartz_vmr *impl_from_IOverlay(IOverlay *iface) { return CONTAINING_RECORD(iface, struct quartz_vmr, IOverlay_iface); @@ -2522,6 +2581,7 @@ static HRESULT vmr_create(IUnknown *outer, IUnknown **out, const CLSID *clsid) strmbase_renderer_init(&object->renderer, outer, clsid, L"VMR Input0", &renderer_ops); object->IAMCertifiedOutputProtection_iface.lpVtbl = &IAMCertifiedOutputProtection_Vtbl; object->IAMFilterMiscFlags_iface.lpVtbl = &IAMFilterMiscFlags_Vtbl; + object->IVMRAspectRatioControl9_iface.lpVtbl = &aspect_ratio_control9_vtbl; object->IVMRFilterConfig_iface.lpVtbl = &VMR7_FilterConfig_Vtbl; object->IVMRFilterConfig9_iface.lpVtbl = &VMR9_FilterConfig_Vtbl; object->IVMRMixerBitmap9_iface.lpVtbl = &mixer_bitmap9_vtbl;
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=81287
Your paranoid android.
=== w10pro64 (32 bit report) ===
quartz: vmr9.c:1446: Test failed: Got hr 0x1.
=== w10pro64_2scr (32 bit report) ===
quartz: vmr9.c:1436: Test failed: Thread should block in Receive().
=== w10pro64_2scr (64 bit report) ===
quartz: vmr9.c:1204: Test failed: Got hr 0x40237. vmr9.c:1210: Test failed: Got hr 0x1.
=== w10pro64_he (64 bit report) ===
quartz: vmr9.c:1446: Test failed: Got hr 0x1.
Signed-off-by: Zebediah Figura z.figura12@gmail.com
Ideally also the following line could be added: