d3d11videosink: Add support for GstVideoOverlay::set_render_rectangle
authorSeungha Yang <seungha@centricular.com>
Fri, 30 Jul 2021 15:59:14 +0000 (00:59 +0900)
committerSeungha Yang <seungha@centricular.com>
Mon, 2 Aug 2021 07:40:14 +0000 (16:40 +0900)
commit2a7ecf17f9285cdde4b2da57b819a9bb82490c60
treeadc3000ee175c87c94e566fe4fcaa242fb8781a7
parent42ed4c85fc42aef87e9d78a08dfc0bdcdecb513c
d3d11videosink: Add support for GstVideoOverlay::set_render_rectangle

Inspired by an MR https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2382

The idea is that we can make use of MoveWindow() in WIN32 d3d11window
implementation safely because WIN32 d3d11window implementation creates
internal HWND even when external HWND is set and then subclassing is used to
draw on internal HWND in any case. So the coordinates passed to MoveWindow()
will be relative to parent HWND, and it meets well to the concept of
set_render_rectangle().

On MoveWindow() event, WM_SIZE event will be generated by OS and then
GstD3D11WindowWin32 implementation will update render area including swapchain
correspondingly, as if it's normal window move/resize case.

But in case of UWP (CoreWindow or SwapChainPanel), we need more research to
meet expected behavior of set_render_rectangle()

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1416
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2450>
sys/d3d11/gstd3d11videosink.cpp
sys/d3d11/gstd3d11window.cpp
sys/d3d11/gstd3d11window.h
sys/d3d11/gstd3d11window_win32.cpp