Nikolay Sivov : evr/presenter: Set VIDEO_ZOOM_RECT on SetVideoPosition().

Alexandre Julliard julliard at winehq.org
Mon Oct 5 15:54:59 CDT 2020


Module: wine
Branch: master
Commit: 94b2db85b6ae695c91f2a7c872549bc6ebca19f4
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=94b2db85b6ae695c91f2a7c872549bc6ebca19f4

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Oct  5 15:26:44 2020 +0300

evr/presenter: Set VIDEO_ZOOM_RECT on SetVideoPosition().

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/evr/presenter.c | 29 ++++++++++++++++++++++++++++-
 dlls/evr/tests/evr.c |  6 +-----
 2 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/dlls/evr/presenter.c b/dlls/evr/presenter.c
index 37f4e67593..eceabfd381 100644
--- a/dlls/evr/presenter.c
+++ b/dlls/evr/presenter.c
@@ -357,6 +357,25 @@ static ULONG WINAPI video_presenter_service_client_Release(IMFTopologyServiceLoo
     return IMFVideoPresenter_Release(&presenter->IMFVideoPresenter_iface);
 }
 
+static void video_presenter_set_mixer_rect(struct video_presenter *presenter)
+{
+    IMFAttributes *attributes;
+    HRESULT hr;
+
+    if (!presenter->mixer)
+        return;
+
+    if (SUCCEEDED(IMFTransform_GetAttributes(presenter->mixer, &attributes)))
+    {
+        if (FAILED(hr = IMFAttributes_SetBlob(attributes, &VIDEO_ZOOM_RECT, (const UINT8 *)&presenter->src_rect,
+                sizeof(presenter->src_rect))))
+        {
+            WARN("Failed to set zoom rectangle attribute, hr %#x.\n", hr);
+        }
+        IMFAttributes_Release(attributes);
+    }
+}
+
 static HRESULT video_presenter_attach_mixer(struct video_presenter *presenter, IMFTopologyServiceLookup *service_lookup)
 {
     IMFVideoDeviceID *device_id;
@@ -389,6 +408,8 @@ static HRESULT video_presenter_attach_mixer(struct video_presenter *presenter, I
         presenter->mixer = NULL;
     }
 
+    video_presenter_set_mixer_rect(presenter);
+
     return hr;
 }
 
@@ -528,7 +549,13 @@ static HRESULT WINAPI video_presenter_control_SetVideoPosition(IMFVideoDisplayCo
     else
     {
         if (src_rect)
-            presenter->src_rect = *src_rect;
+        {
+            if (memcmp(&presenter->src_rect, src_rect, sizeof(*src_rect)))
+            {
+                presenter->src_rect = *src_rect;
+                video_presenter_set_mixer_rect(presenter);
+            }
+        }
         if (dst_rect)
             presenter->dst_rect = *dst_rect;
     }
diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c
index 869af10b22..db9546a945 100644
--- a/dlls/evr/tests/evr.c
+++ b/dlls/evr/tests/evr.c
@@ -1414,16 +1414,13 @@ static void test_presenter_video_position(void)
 
     hr = IMFAttributes_GetCount(mixer_attributes, &count);
     ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
-todo_wine
     ok(count == 1, "Unexpected count %u.\n", count);
 
     memset(&src_rect, 0, sizeof(src_rect));
     hr = IMFAttributes_GetBlob(mixer_attributes, &VIDEO_ZOOM_RECT, (UINT8 *)&src_rect, sizeof(src_rect), NULL);
-todo_wine {
     ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
     ok(src_rect.left == 0.0f && src_rect.top == 0.0f && src_rect.right == 1.0f &&
             src_rect.bottom == 1.0f, "Unexpected source rectangle.\n");
-}
 
     hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFVideoDisplayControl, (void **)&display_control);
     ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
@@ -1505,11 +1502,10 @@ todo_wine {
     /* Presenter updates mixer attribute. */
     memset(&src_rect, 0, sizeof(src_rect));
     hr = IMFAttributes_GetBlob(mixer_attributes, &VIDEO_ZOOM_RECT, (UINT8 *)&src_rect, sizeof(src_rect), NULL);
-todo_wine {
     ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
     ok(src_rect.left == 0.1f && src_rect.top == 0.2f && src_rect.right == 0.8f &&
             src_rect.bottom == 0.9f, "Unexpected source rectangle.\n");
-}
+
     hr = IMFVideoDisplayControl_GetVideoPosition(display_control, &src_rect, &dst_rect);
     ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
     ok(src_rect.left == 0.1f && src_rect.top == 0.2f && src_rect.right == 0.8f &&




More information about the wine-cvs mailing list