d3d11videosink: post "have-window-handle" element message on the bus

* when window_id is not user-provided and window_type==GST_D3D11_WINDOW_NATIVE_TYPE_HWND
* allows user to retrieve internally created window handle
  * for custom positionning
  * for custom icons
  * ...

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5544>
This commit is contained in:
Adrien De Coninck 2023-10-24 16:32:36 +02:00
parent 8aac08506a
commit 65365caa21
3 changed files with 18 additions and 0 deletions

View file

@ -1019,6 +1019,14 @@ gst_d3d11_video_sink_prepare_window (GstD3D11VideoSink * self)
#if (!GST_D3D11_WINAPI_ONLY_APP) #if (!GST_D3D11_WINAPI_ONLY_APP)
case GST_D3D11_WINDOW_NATIVE_TYPE_HWND: case GST_D3D11_WINDOW_NATIVE_TYPE_HWND:
self->window = gst_d3d11_window_win32_new (self->device, self->window_id); self->window = gst_d3d11_window_win32_new (self->device, self->window_id);
if (!self->window_id) {
HWND internal_hwnd =
gst_d3d11_window_win32_get_internal_hwnd (self->window);
GST_DEBUG_OBJECT (self, "Have window handle %" G_GUINTPTR_FORMAT,
(guintptr) internal_hwnd);
gst_video_overlay_got_window_handle (GST_VIDEO_OVERLAY (self),
(guintptr) internal_hwnd);
}
break; break;
#endif #endif
#if GST_D3D11_WINAPI_APP #if GST_D3D11_WINAPI_APP

View file

@ -1285,6 +1285,13 @@ gst_d3d11_window_win32_change_fullscreen_mode (GstD3D11Window * window)
} }
} }
HWND
gst_d3d11_window_win32_get_internal_hwnd (GstD3D11Window * window)
{
GstD3D11WindowWin32 *self = GST_D3D11_WINDOW_WIN32 (window);
return self->internal_hwnd;
}
GstD3D11Window * GstD3D11Window *
gst_d3d11_window_win32_new (GstD3D11Device * device, guintptr handle) gst_d3d11_window_win32_new (GstD3D11Device * device, guintptr handle)
{ {

View file

@ -34,6 +34,9 @@ G_DECLARE_FINAL_TYPE (GstD3D11WindowWin32,
GstD3D11Window * gst_d3d11_window_win32_new (GstD3D11Device * device, GstD3D11Window * gst_d3d11_window_win32_new (GstD3D11Device * device,
guintptr handle); guintptr handle);
HWND gst_d3d11_window_win32_get_internal_hwnd (GstD3D11Window * window);
G_END_DECLS G_END_DECLS
#endif /* __GST_D3D11_WINDOW_WIN32_H__ */ #endif /* __GST_D3D11_WINDOW_WIN32_H__ */