[vlc-devel] [PATCH 2/7] vout: move out vout_window_t from vout_display_cfg_t
Thomas Guillem
thomas at gllm.fr
Thu Mar 26 16:35:25 CET 2020
I only tested the compilation on Android and Linux.
If accepted, I will do more checks on Windows, macOS, and iOS.
On Thu, Mar 26, 2020, at 16:33, Thomas Guillem wrote:
> The main reason of this change is that the vout_display_cfg_t struct is
> expected to change (from the different vd controls) whereas the window should
> not change during the lifetime of the vd plugin. Furthermore, the window can't
> be "configured" like the other members of this struct.
> ---
> include/vlc_opengl.h | 3 +++
> include/vlc_vout_display.h | 18 ++++++++++-----
> modules/hw/mmal/vout.c | 4 ++--
> modules/hw/vdpau/display.c | 4 ++--
> modules/video_output/android/display.c | 4 ++--
> modules/video_output/caca.c | 4 ++--
> modules/video_output/caopengllayer.m | 4 ++--
> modules/video_output/fb.c | 3 ++-
> modules/video_output/ios.m | 4 ++--
> modules/video_output/kms.c | 2 +-
> modules/video_output/kva.c | 8 +++----
> modules/video_output/macosx.m | 4 ++--
> modules/video_output/opengl/display.c | 4 ++--
> modules/video_output/splitter.c | 10 ++++-----
> modules/video_output/vulkan/display.c | 2 +-
> modules/video_output/wayland/shm.c | 4 ++--
> modules/video_output/win32/common.c | 5 +++--
> modules/video_output/win32/direct3d11.c | 2 +-
> modules/video_output/win32/direct3d9.c | 2 +-
> modules/video_output/win32/glwin32.c | 2 +-
> modules/video_output/win32/wingdi.c | 2 +-
> modules/video_output/xcb/render.c | 4 ++--
> modules/video_output/xcb/x11.c | 4 ++--
> src/video_output/display.c | 2 ++
> src/video_output/opengl.c | 5 ++---
> src/video_output/video_output.c | 29 +++++++++++++------------
> src/video_output/vout_internal.h | 4 +++-
> src/video_output/vout_wrapper.c | 4 ++--
> 28 files changed, 81 insertions(+), 66 deletions(-)
>
> diff --git a/include/vlc_opengl.h b/include/vlc_opengl.h
> index 4e436c939b..85f35571a9 100644
> --- a/include/vlc_opengl.h
> +++ b/include/vlc_opengl.h
> @@ -24,6 +24,8 @@
> #ifndef VLC_GL_H
> #define VLC_GL_H 1
>
> +#include <vlc_vout_window.h>
> +
> /**
> * \file
> * This file defines GL structures and functions.
> @@ -95,6 +97,7 @@ enum {
> * @return a new context, or NULL on failure
> */
> VLC_API vlc_gl_t *vlc_gl_Create(const struct vout_display_cfg *cfg,
> + vout_window_t *window,
> unsigned flags, const char *name) VLC_USED;
> VLC_API void vlc_gl_Release(vlc_gl_t *);
> VLC_API void vlc_gl_Hold(vlc_gl_t *);
> diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
> index cef9b47b40..7d748813a9 100644
> --- a/include/vlc_vout_display.h
> +++ b/include/vlc_vout_display.h
> @@ -90,7 +90,6 @@ typedef struct vlc_video_align {
> * multiplied by the zoom factor.
> */
> typedef struct vout_display_cfg {
> - struct vout_window_t *window; /**< Window */
> #if defined(__OS2__)
> bool is_fullscreen VLC_DEPRECATED; /* Is the display fullscreen */
> #endif
> @@ -258,6 +257,13 @@ typedef int (*vout_display_open_cb)(vout_display_t *vd,
> struct vout_display_t {
> struct vlc_object_t obj;
>
> + /**
> + * Window used by this display plugin.
> + *
> + * Always valid and can't be modified during the lifetime of the module.
> + */
> + vout_window_t *window;
> +
> /**
> * User configuration.
> *
> @@ -371,7 +377,7 @@ struct vout_display_t {
> VLC_API
> vout_display_t *vout_display_New(vlc_object_t *,
> const video_format_t *, vlc_video_context *,
> - const vout_display_cfg_t *, const char *module,
> + const vout_display_cfg_t *, vout_window_t *window, const char *module,
> const vout_display_owner_t *);
>
> /**
> @@ -421,15 +427,15 @@ VLC_API void
> vout_display_SendEventPicturesInvalid(vout_display_t *vd);
>
> static inline void vout_display_SendEventMousePressed(vout_display_t
> *vd, int button)
> {
> - vout_window_ReportMousePressed(vd->cfg->window, button);
> + vout_window_ReportMousePressed(vd->window, button);
> }
> static inline void vout_display_SendEventMouseReleased(vout_display_t
> *vd, int button)
> {
> - vout_window_ReportMouseReleased(vd->cfg->window, button);
> + vout_window_ReportMouseReleased(vd->window, button);
> }
> static inline void
> vout_display_SendEventMouseDoubleClick(vout_display_t *vd)
> {
> - vout_window_ReportMouseDoubleClick(vd->cfg->window,
> MOUSE_BUTTON_LEFT);
> + vout_window_ReportMouseDoubleClick(vd->window, MOUSE_BUTTON_LEFT);
> }
> static inline void vout_display_SendEventViewpointMoved(vout_display_t
> *vd,
> const
> vlc_viewpoint_t *vp)
> @@ -448,7 +454,7 @@ static inline void
> vout_display_SendEventViewpointMoved(vout_display_t *vd,
> */
> static inline void
> vout_display_SendMouseMovedDisplayCoordinates(vout_display_t *vd, int
> m_x, int m_y)
> {
> - vout_window_ReportMouseMoved(vd->cfg->window, m_x, m_y);
> + vout_window_ReportMouseMoved(vd->window, m_x, m_y);
> }
>
> /**
> diff --git a/modules/hw/mmal/vout.c b/modules/hw/mmal/vout.c
> index ee48a6a552..b36b1f8c68 100644
> --- a/modules/hw/mmal/vout.c
> +++ b/modules/hw/mmal/vout.c
> @@ -754,7 +754,7 @@ static void vd_manage(vout_display_t *vd)
> if (query_resolution(vd, sys->display_id, &width, &height) >= 0) {
> sys->display_width = width;
> sys->display_height = height;
> -// vout_window_ReportSize(vd->cfg->window, width, height);
> +// vout_window_ReportSize(vd->window, width, height);
> }
>
> sys->need_configure_display = false;
> @@ -1130,7 +1130,7 @@ static int OpenMmalVout(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> }
>
> if (sys->dec_dev == NULL)
> - sys->dec_dev = vlc_decoder_device_Create(VLC_OBJECT(vd),
> cfg->window);
> + sys->dec_dev = vlc_decoder_device_Create(VLC_OBJECT(vd),
> vd->window);
> if (sys->dec_dev == NULL || sys->dec_dev->type !=
> VLC_DECODER_DEVICE_MMAL)
> {
> msg_Err(vd, "Missing decoder device");
> diff --git a/modules/hw/vdpau/display.c b/modules/hw/vdpau/display.c
> index 5963be6371..4fcb76c15d 100644
> --- a/modules/hw/vdpau/display.c
> +++ b/modules/hw/vdpau/display.c
> @@ -293,7 +293,7 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> return VLC_ENOMEM;
>
> const xcb_screen_t *screen;
> - if (vlc_xcb_parent_Create(vd, cfg->window, &sys->conn, &screen) !=
> VLC_SUCCESS)
> + if (vlc_xcb_parent_Create(vd, vd->window, &sys->conn, &screen) !=
> VLC_SUCCESS)
> {
> free(sys);
> return VLC_EGENERIC;
> @@ -432,7 +432,7 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
>
> xcb_void_cookie_t c =
> xcb_create_window_checked(sys->conn, screen->root_depth,
> - sys->window, cfg->window->handle.xid, place.x, place.y,
> + sys->window, vd->window->handle.xid, place.x, place.y,
> place.width, place.height, 0,
> XCB_WINDOW_CLASS_INPUT_OUTPUT,
> screen->root_visual, mask, values);
> if (vlc_xcb_error_Check(vd, sys->conn, "window creation
> failure", c))
> diff --git a/modules/video_output/android/display.c
> b/modules/video_output/android/display.c
> index 3ad9aeb452..6948516ad1 100644
> --- a/modules/video_output/android/display.c
> +++ b/modules/video_output/android/display.c
> @@ -483,7 +483,7 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> vout_display_sys_t *sys;
> video_format_t fmt, sub_fmt;
>
> - vout_window_t *embed = cfg->window;
> + vout_window_t *embed = vd->window;
> if (embed->type != VOUT_WINDOW_TYPE_ANDROID_NATIVE)
> return VLC_EGENERIC;
>
> @@ -610,7 +610,7 @@ static void ClearSurface(vout_display_t *vd)
> {
> /* Clear the surface to black with OpenGL ES 2 */
> char *modlist = var_InheritString(sys->embed, "gles2");
> - vlc_gl_t *gl = vlc_gl_Create(vd->cfg, VLC_OPENGL_ES2, modlist);
> + vlc_gl_t *gl = vlc_gl_Create(vd->cfg, vd->window,
> VLC_OPENGL_ES2, modlist);
> free(modlist);
> if (gl == NULL)
> return;
> diff --git a/modules/video_output/caca.c b/modules/video_output/caca.c
> index b3f235ab91..5fe85ef722 100644
> --- a/modules/video_output/caca.c
> +++ b/modules/video_output/caca.c
> @@ -383,7 +383,7 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
>
> (void) context;
>
> - if (vout_window_IsValid(cfg->window))
> + if (vout_window_IsValid(vd->window))
> return VLC_EGENERIC;
> #if !defined(__APPLE__) && !defined(_WIN32)
> # ifndef X_DISPLAY_MISSING
> @@ -452,7 +452,7 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> goto error;
> }
>
> - sys->window = cfg->window;
> + sys->window = vd->window;
> const char *driver = NULL;
> #ifdef __APPLE__
> // Make sure we don't try to open a window.
> diff --git a/modules/video_output/caopengllayer.m
> b/modules/video_output/caopengllayer.m
> index 10fccdf90d..2638b9c443 100644
> --- a/modules/video_output/caopengllayer.m
> +++ b/modules/video_output/caopengllayer.m
> @@ -110,7 +110,7 @@ static int Open (vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> {
> vout_display_sys_t *sys;
>
> - if (cfg->window->type != VOUT_WINDOW_TYPE_NSOBJECT)
> + if (vd->window->type != VOUT_WINDOW_TYPE_NSOBJECT)
> return VLC_EGENERIC;
>
> /* Allocate structure */
> @@ -121,7 +121,7 @@ static int Open (vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> @autoreleasepool {
> id container = var_CreateGetAddress(vd, "drawable-nsobject");
> if (!container) {
> - sys->embed = cfg->window;
> + sys->embed = vd->window;
> container = sys->embed->handle.nsobject;
>
> if (!container) {
> diff --git a/modules/video_output/fb.c b/modules/video_output/fb.c
> index 338099e02c..7e130eb697 100644
> --- a/modules/video_output/fb.c
> +++ b/modules/video_output/fb.c
> @@ -167,9 +167,10 @@ static void ClearScreen(vout_display_sys_t *sys)
> static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
> video_format_t *fmtp, vlc_video_context *context)
> {
> + (void) cfg;
> vout_display_sys_t *sys;
>
> - if (vout_window_IsValid(cfg->window))
> + if (vout_window_IsValid(vd->window))
> return VLC_EGENERIC;
>
> /* Allocate instance and initialize some members */
> diff --git a/modules/video_output/ios.m b/modules/video_output/ios.m
> index 34ffcd8bf8..72f3f2176e 100644
> --- a/modules/video_output/ios.m
> +++ b/modules/video_output/ios.m
> @@ -142,7 +142,7 @@ static void *OurGetProcAddress(vlc_gl_t *gl, const
> char *name)
> static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
> video_format_t *fmt, vlc_video_context *context)
> {
> - if (vout_window_IsValid(cfg->window))
> + if (vout_window_IsValid(vd->window))
> return VLC_EGENERIC;
>
> vout_display_sys_t *sys = vlc_obj_calloc(VLC_OBJECT(vd), 1,
> sizeof(*sys));
> @@ -171,7 +171,7 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
>
> const vlc_fourcc_t *subpicture_chromas;
>
> - sys->embed = cfg->window;
> + sys->embed = vd->window;
> sys->gl = vlc_object_create(vd, sizeof(*sys->gl));
> if (!sys->gl)
> goto bailout;
> diff --git a/modules/video_output/kms.c b/modules/video_output/kms.c
> index 2c01aa36c5..96cf50a734 100644
> --- a/modules/video_output/kms.c
> +++ b/modules/video_output/kms.c
> @@ -693,7 +693,7 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> video_format_t fmt = {};
> char *chroma;
>
> - if (vout_window_IsValid(cfg->window))
> + if (vout_window_IsValid(vd->window))
> return VLC_EGENERIC;
>
> /*
> diff --git a/modules/video_output/kva.c b/modules/video_output/kva.c
> index 185e826960..6dab6c615c 100644
> --- a/modules/video_output/kva.c
> +++ b/modules/video_output/kva.c
> @@ -185,9 +185,9 @@ static void PMThread( void *arg )
>
> sys->b_fixt23 = var_CreateGetBool( vd, "kva-fixt23");
>
> - if( !sys->b_fixt23 && vd->cfg->window->type == VOUT_WINDOW_TYPE_HWND )
> + if( !sys->b_fixt23 && vd->window->type == VOUT_WINDOW_TYPE_HWND )
> /* If an external window was specified, we'll draw in it. */
> - sys->parent_window = vd->cfg->window;
> + sys->parent_window = vd->window;
>
> if( sys->parent_window )
> {
> @@ -921,7 +921,7 @@ static MRESULT EXPENTRY WndProc( HWND hwnd, ULONG
> msg, MPARAM mp1, MPARAM mp2 )
> {
> /* the user wants to close the window */
> case WM_CLOSE:
> - vout_window_ReportClose(vd->cfg->window);
> + vout_window_ReportClose(vd->window);
> result = 0;
> break;
>
> @@ -1020,7 +1020,7 @@ static MRESULT EXPENTRY WndProc( HWND hwnd, ULONG
> msg, MPARAM mp1, MPARAM mp2 )
> if( i_flags & KC_ALT )
> i_key |= KEY_MODIFIER_ALT;
>
> - vout_window_ReportKeyPress(vd->cfg->window, i_key);
> + vout_window_ReportKeyPress(vd->window, i_key);
> }
> }
> break;
> diff --git a/modules/video_output/macosx.m
> b/modules/video_output/macosx.m
> index 5e0a10af6f..64db52fb6e 100644
> --- a/modules/video_output/macosx.m
> +++ b/modules/video_output/macosx.m
> @@ -131,7 +131,7 @@ static int Open (vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> {
> vout_display_sys_t *sys = calloc (1, sizeof(*sys));
>
> - if (cfg->window->type != VOUT_WINDOW_TYPE_NSOBJECT)
> + if (vd->window->type != VOUT_WINDOW_TYPE_NSOBJECT)
> return VLC_EGENERIC;
>
> if (!sys)
> @@ -152,7 +152,7 @@ static int Open (vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> /* Get the drawable object */
> id container = var_CreateGetAddress (vd, "drawable-nsobject");
> if (!container) {
> - sys->embed = cfg->window;
> + sys->embed = vd->window;
> container = sys->embed->handle.nsobject;
>
> if (!container) {
> diff --git a/modules/video_output/opengl/display.c
> b/modules/video_output/opengl/display.c
> index ebb313926a..c1612019c4 100644
> --- a/modules/video_output/opengl/display.c
> +++ b/modules/video_output/opengl/display.c
> @@ -94,7 +94,7 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> sys->gl = NULL;
> sys->place_changed = false;
>
> - vout_window_t *surface = cfg->window;
> + vout_window_t *surface = vd->window;
> char *gl_name = var_InheritString(surface, MODULE_VARNAME);
>
> /* VDPAU GL interop works only with GLX. Override the "gl" option
> to force
> @@ -123,7 +123,7 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> }
> #endif
>
> - sys->gl = vlc_gl_Create(cfg, API, gl_name);
> + sys->gl = vlc_gl_Create(cfg, surface, API, gl_name);
> free(gl_name);
> if (sys->gl == NULL)
> goto error;
> diff --git a/modules/video_output/splitter.c
> b/modules/video_output/splitter.c
> index 06f6c05d76..475ddac70b 100644
> --- a/modules/video_output/splitter.c
> +++ b/modules/video_output/splitter.c
> @@ -173,7 +173,7 @@ static void
> vlc_vidsplit_window_MouseEvent(vout_window_t *wnd,
> vlc_mutex_lock(&sys->lock);
> if (video_splitter_Mouse(&sys->splitter, part - sys->parts,
> &ev) == VLC_SUCCESS)
> - vout_window_SendMouseEvent(vd->cfg->window, &ev);
> + vout_window_SendMouseEvent(vd->window, &ev);
> vlc_mutex_unlock(&sys->lock);
> }
>
> @@ -183,7 +183,7 @@ static void
> vlc_vidsplit_window_KeyboardEvent(vout_window_t *wnd, unsigned key)
> vout_display_sys_t *sys = vd->sys;
>
> vlc_mutex_lock(&sys->lock);
> - vout_window_ReportKeyPress(vd->cfg->window, key);
> + vout_window_ReportKeyPress(vd->window, key);
> vlc_mutex_unlock(&sys->lock);
> }
>
> @@ -223,9 +223,10 @@ static int vlc_vidsplit_Open(vout_display_t *vd,
> const vout_display_cfg_t *cfg,
> video_format_t *fmtp, vlc_video_context *ctx)
> {
> + (void) cfg;
> vlc_object_t *obj = VLC_OBJECT(vd);
>
> - if (vout_window_IsValid(cfg->window))
> + if (vout_window_IsValid(vd->window))
> return VLC_EGENERIC;
>
> char *name = var_InheritString(obj, "video-splitter");
> @@ -286,9 +287,8 @@ static int vlc_vidsplit_Open(vout_display_t *vd,
> return VLC_EGENERIC;
> }
>
> - vdcfg.window = part->window;
> vout_display_t *display = vout_display_New(obj, &output->fmt,
> ctx, &vdcfg,
> - modname, NULL);
> + part->window,
> modname, NULL);
> if (display == NULL) {
> vout_window_Disable(part->window);
> vout_window_Delete(part->window);
> diff --git a/modules/video_output/vulkan/display.c
> b/modules/video_output/vulkan/display.c
> index 174627d67d..51c7cb4238 100644
> --- a/modules/video_output/vulkan/display.c
> +++ b/modules/video_output/vulkan/display.c
> @@ -86,7 +86,7 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> if (unlikely(sys == NULL))
> return VLC_ENOMEM;
>
> - vout_window_t *window = vd->cfg->window;
> + vout_window_t *window = vd->window;
> if (window == NULL)
> {
> msg_Err(vd, "parent window not available");
> diff --git a/modules/video_output/wayland/shm.c
> b/modules/video_output/wayland/shm.c
> index 77acabdd0c..81e0bd0cc2 100644
> --- a/modules/video_output/wayland/shm.c
> +++ b/modules/video_output/wayland/shm.c
> @@ -267,7 +267,7 @@ static void Close(vout_display_t *vd)
> static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
> video_format_t *fmtp, vlc_video_context *context)
> {
> - if (cfg->window->type != VOUT_WINDOW_TYPE_WAYLAND)
> + if (vd->window->type != VOUT_WINDOW_TYPE_WAYLAND)
> return VLC_EGENERIC;
>
> vout_display_sys_t *sys = malloc(sizeof (*sys));
> @@ -283,7 +283,7 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> sys->display_height = cfg->display.height;
>
> /* Get window */
> - sys->embed = cfg->window;
> + sys->embed = vd->window;
> assert(sys->embed != NULL);
>
> struct wl_display *display = sys->embed->display.wl;
> diff --git a/modules/video_output/win32/common.c
> b/modules/video_output/win32/common.c
> index b31c77d0be..00bde81cea 100644
> --- a/modules/video_output/win32/common.c
> +++ b/modules/video_output/win32/common.c
> @@ -48,6 +48,7 @@ void CommonInit(vout_display_t *vd,
> display_win32_area_t *area, const vout_displ
> {
> area->place_changed = false;
> area->vdcfg = *vdcfg;
> + aera->window = vd->window;
>
> area->texture_source = vd->source;
>
> @@ -61,7 +62,7 @@ static void CommonChangeThumbnailClip(vlc_object_t *,
> vout_display_sys_win32_t *
> int CommonWindowInit(vlc_object_t *obj, display_win32_area_t *area,
> vout_display_sys_win32_t *sys, bool
> projection_gestures)
> {
> - if (unlikely(area->vdcfg.window == NULL))
> + if (unlikely(area->window == NULL))
> return VLC_EGENERIC;
>
> /* */
> @@ -72,7 +73,7 @@ int CommonWindowInit(vlc_object_t *obj,
> display_win32_area_t *area,
> sys->hparent = NULL;
>
> /* */
> - sys->event = EventThreadCreate(obj, area->vdcfg.window);
> + sys->event = EventThreadCreate(obj, area->window);
> if (!sys->event)
> return VLC_EGENERIC;
>
> diff --git a/modules/video_output/win32/direct3d11.c
> b/modules/video_output/win32/direct3d11.c
> index dd815124e5..dc1d407aea 100644
> --- a/modules/video_output/win32/direct3d11.c
> +++ b/modules/video_output/win32/direct3d11.c
> @@ -345,7 +345,7 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> goto error;
> }
>
> - vout_window_SetTitle(sys->area.vdcfg.window, VOUT_TITLE "
> (Direct3D11 output)");
> + vout_window_SetTitle(vd->window, VOUT_TITLE " (Direct3D11
> output)");
> msg_Dbg(vd, "Direct3D11 display adapter successfully initialized");
>
> vd->info.can_scale_spu = true;
> diff --git a/modules/video_output/win32/direct3d9.c
> b/modules/video_output/win32/direct3d9.c
> index ef0d83ef01..497821badd 100644
> --- a/modules/video_output/win32/direct3d9.c
> +++ b/modules/video_output/win32/direct3d9.c
> @@ -1668,7 +1668,7 @@ static int Direct3D9Open(vout_display_t *vd,
> video_format_t *fmt, vlc_video_cont
> }
>
> /* Change the window title bar text */
> - vout_window_SetTitle(sys->area.vdcfg.window, VOUT_TITLE "
> (Direct3D9 output)");
> + vout_window_SetTitle(vd->window, VOUT_TITLE " (Direct3D9 output)");
>
> msg_Dbg(vd, "Direct3D9 display adapter successfully initialized");
> return VLC_SUCCESS;
> diff --git a/modules/video_output/win32/glwin32.c
> b/modules/video_output/win32/glwin32.c
> index da893768c4..97dc01f91f 100644
> --- a/modules/video_output/win32/glwin32.c
> +++ b/modules/video_output/win32/glwin32.c
> @@ -128,7 +128,7 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> if (vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR)
> sys->p_sensors = HookWindowsSensors(vd, sys->sys.hvideownd);
>
> - vout_window_SetTitle(sys->area.vdcfg.window, VOUT_TITLE " (OpenGL
> output)");
> + vout_window_SetTitle(vd->window, VOUT_TITLE " (OpenGL output)");
>
> vout_display_cfg_t embed_cfg = *cfg;
> embed_cfg.window = EmbedVideoWindow_Create(vd);
> diff --git a/modules/video_output/win32/wingdi.c
> b/modules/video_output/win32/wingdi.c
> index 6653401b78..6038d504e0 100644
> --- a/modules/video_output/win32/wingdi.c
> +++ b/modules/video_output/win32/wingdi.c
> @@ -272,7 +272,7 @@ static int Init(vout_display_t *vd, video_format_t
> *fmt)
> SelectObject(sys->off_dc, sys->off_bitmap);
> ReleaseDC(sys->sys.hvideownd, window_dc);
>
> - vout_window_SetTitle(sys->area.vdcfg.window, VOUT_TITLE " (WinGDI
> output)");
> + vout_window_SetTitle(vd->window, VOUT_TITLE " (WinGDI output)");
>
> return VLC_SUCCESS;
> }
> diff --git a/modules/video_output/xcb/render.c
> b/modules/video_output/xcb/render.c
> index c3e71933f3..63c3a8b8b0 100644
> --- a/modules/video_output/xcb/render.c
> +++ b/modules/video_output/xcb/render.c
> @@ -563,7 +563,7 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> xcb_connection_t *conn;
> const xcb_screen_t *screen;
>
> - if (vlc_xcb_parent_Create(vd, cfg->window, &conn, &screen) != VLC_SUCCESS)
> + if (vlc_xcb_parent_Create(vd, vd->window, &conn, &screen) != VLC_SUCCESS)
> return VLC_EGENERIC;
>
> sys->conn = conn;
> @@ -673,7 +673,7 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> xcb_create_pixmap(conn, 32, sys->drawable.source, screen->root,
> vd->source.i_width, vd->source.i_height);
> xcb_create_gc(conn, sys->gc, sys->drawable.source, 0, NULL);
> - xcb_create_window(conn, 32, sys->drawable.dest,
> cfg->window->handle.xid,
> + xcb_create_window(conn, 32, sys->drawable.dest,
> vd->window->handle.xid,
> 0, 0, cfg->display.width, cfg->display.height, 0,
> XCB_WINDOW_CLASS_INPUT_OUTPUT, visual, cw_mask,
> cw_list);
> xcb_render_create_picture(conn, sys->picture.source,
> sys->drawable.source,
> diff --git a/modules/video_output/xcb/x11.c
> b/modules/video_output/xcb/x11.c
> index 05e012f389..9e465500e7 100644
> --- a/modules/video_output/xcb/x11.c
> +++ b/modules/video_output/xcb/x11.c
> @@ -265,7 +265,7 @@ static int Open (vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> /* Get window, connect to X server */
> xcb_connection_t *conn;
> const xcb_screen_t *scr;
> - if (vlc_xcb_parent_Create(vd, cfg->window, &conn, &scr) !=
> VLC_SUCCESS)
> + if (vlc_xcb_parent_Create(vd, vd->window, &conn, &scr) !=
> VLC_SUCCESS)
> {
> free (sys);
> return VLC_EGENERIC;
> @@ -317,7 +317,7 @@ static int Open (vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> sys->window = xcb_generate_id (conn);
> sys->gc = xcb_generate_id (conn);
>
> - xcb_create_window(conn, sys->depth, sys->window, cfg->window->handle.xid,
> + xcb_create_window(conn, sys->depth, sys->window, vd->window->handle.xid,
> place.x, place.y, place.width, place.height, 0,
> XCB_WINDOW_CLASS_INPUT_OUTPUT, vid, mask, values);
> xcb_map_window(conn, sys->window);
> diff --git a/src/video_output/display.c b/src/video_output/display.c
> index 76d49ee240..9ef2cd5a41 100644
> --- a/src/video_output/display.c
> +++ b/src/video_output/display.c
> @@ -725,6 +725,7 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
> const video_format_t *source,
> vlc_video_context *vctx,
> const vout_display_cfg_t *cfg,
> + vout_window_t *window,
> const char *module,
> const vout_display_owner_t *owner)
> {
> @@ -754,6 +755,7 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
>
> /* */
> vout_display_t *vd = &osys->display;
> + vd->window = window;
> video_format_Copy(&vd->source, source);
> vd->info = (vout_display_info_t){ };
> vd->cfg = &osys->cfg;
> diff --git a/src/video_output/opengl.c b/src/video_output/opengl.c
> index 99ba7b29e7..9cc8c8573c 100644
> --- a/src/video_output/opengl.c
> +++ b/src/video_output/opengl.c
> @@ -53,9 +53,9 @@ static int vlc_gl_start(void *func, bool forced, va_list ap)
> }
>
> vlc_gl_t *vlc_gl_Create(const struct vout_display_cfg *restrict cfg,
> + vout_window_t *restrict wnd,
> unsigned flags, const char *name)
> {
> - vout_window_t *wnd = cfg->window;
> struct vlc_gl_priv_t *glpriv;
> const char *type;
>
> @@ -165,7 +165,6 @@ vlc_gl_t *vlc_gl_surface_Create(vlc_object_t *obj,
>
> /* TODO: support ES? */
> struct vout_display_cfg dcfg = {
> - .window = surface,
> .display = { .width = cfg->width, cfg->height },
> };
>
> @@ -178,7 +177,7 @@ vlc_gl_t *vlc_gl_surface_Create(vlc_object_t *obj,
> }
> vlc_mutex_unlock(&sys->lock);
>
> - vlc_gl_t *gl = vlc_gl_Create(&dcfg, VLC_OPENGL, NULL);
> + vlc_gl_t *gl = vlc_gl_Create(&dcfg, surface, VLC_OPENGL, NULL);
> if (gl == NULL) {
> vout_window_Delete(surface);
> goto error;
> diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
> index 373c09f1dc..0f4387d684 100644
> --- a/src/video_output/video_output.c
> +++ b/src/video_output/video_output.c
> @@ -210,7 +210,7 @@ static void vout_UpdateWindowSizeLocked(vout_thread_t *vout)
> vlc_mutex_unlock(&sys->display_lock);
>
> msg_Dbg(vout, "requested window size: %ux%u", width, height);
> - vout_window_SetSize(sys->display_cfg.window, width, height);
> + vout_window_SetSize(sys->window, width, height);
> } else
> vlc_mutex_unlock(&sys->display_lock);
> }
> @@ -393,7 +393,7 @@ void vout_ChangeFullscreen(vout_thread_t *vout,
> const char *id)
> {
> assert(!vout->p->dummy);
> vlc_mutex_lock(&vout->p->window_lock);
> - vout_window_SetFullScreen(vout->p->display_cfg.window, id);
> + vout_window_SetFullScreen(vout->p->window, id);
> vlc_mutex_unlock(&vout->p->window_lock);
> }
>
> @@ -402,7 +402,7 @@ void vout_ChangeWindowed(vout_thread_t *vout)
> assert(!vout->p->dummy);
> vlc_mutex_lock(&vout->p->window_lock);
> vout_thread_sys_t *sys = vout->p;
> - vout_window_UnsetFullScreen(sys->display_cfg.window);
> + vout_window_UnsetFullScreen(sys->window);
> /* Attempt to reset the intended window size */
> vout_UpdateWindowSizeLocked(vout);
> vlc_mutex_unlock(&vout->p->window_lock);
> @@ -412,7 +412,7 @@ void vout_ChangeWindowState(vout_thread_t *vout,
> unsigned st)
> {
> assert(!vout->p->dummy);
> vlc_mutex_lock(&vout->p->window_lock);
> - vout_window_SetState(vout->p->display_cfg.window, st);
> + vout_window_SetState(vout->p->window, st);
> vlc_mutex_unlock(&vout->p->window_lock);
> }
>
> @@ -1374,7 +1374,7 @@ void vout_ChangePause(vout_thread_t *vout, bool
> is_paused, vlc_tick_t date)
> vout_control_Release(&vout->p->control);
>
> vlc_mutex_lock(&vout->p->window_lock);
> - vout_window_SetInhibition(vout->p->display_cfg.window, !is_paused);
> + vout_window_SetInhibition(vout->p->window, !is_paused);
> vlc_mutex_unlock(&vout->p->window_lock);
> }
>
> @@ -1605,7 +1605,8 @@ static int vout_Start(vout_thread_t *vout,
> vlc_video_context *vctx, const vout_c
> vlc_mutex_lock(&sys->display_lock);
> vlc_mutex_unlock(&sys->window_lock);
>
> - sys->display = vout_OpenWrapper(vout, sys->splitter_name, &dcfg, vctx);
> + sys->display = vout_OpenWrapper(vout, sys->splitter_name, &dcfg,
> + sys->window, vctx);
> if (sys->display == NULL) {
> vlc_mutex_unlock(&sys->display_lock);
> goto error;
> @@ -1786,7 +1787,7 @@ static void vout_DisableWindow(vout_thread_t *vout)
> vout_thread_sys_t *sys = vout->p;
> vlc_mutex_lock(&sys->window_lock);
> if (sys->window_enabled) {
> - vout_window_Disable(sys->display_cfg.window);
> + vout_window_Disable(sys->window);
> sys->window_enabled = false;
> }
> vlc_mutex_unlock(&sys->window_lock);
> @@ -1843,7 +1844,7 @@ void vout_Release(vout_thread_t *vout)
> vlc_decoder_device_Release(sys->dec_device);
>
> assert(!sys->window_enabled);
> - vout_display_window_Delete(sys->display_cfg.window);
> + vout_display_window_Delete(sys->window);
>
> vout_control_Clean(&sys->control);
>
> @@ -1938,8 +1939,8 @@ vout_thread_t *vout_Create(vlc_object_t *object)
> vlc_mutex_init(&sys->display_lock);
>
> /* Window */
> - sys->display_cfg.window = vout_display_window_New(vout);
> - if (sys->display_cfg.window == NULL) {
> + sys->window = vout_display_window_New(vout);
> + if (sys->window == NULL) {
> if (sys->spu)
> spu_Destroy(sys->spu);
> vlc_object_delete(vout);
> @@ -1955,9 +1956,9 @@ vout_thread_t *vout_Create(vlc_object_t *object)
> vout_chrono_Init(&sys->render, 5, VLC_TICK_FROM_MS(10));
>
> if (var_InheritBool(vout, "video-wallpaper"))
> - vout_window_SetState(sys->display_cfg.window, VOUT_WINDOW_STATE_BELOW);
> + vout_window_SetState(sys->window, VOUT_WINDOW_STATE_BELOW);
> else if (var_InheritBool(vout, "video-on-top"))
> - vout_window_SetState(sys->display_cfg.window, VOUT_WINDOW_STATE_ABOVE);
> + vout_window_SetState(sys->window, VOUT_WINDOW_STATE_ABOVE);
>
> return vout;
> }
> @@ -2007,7 +2008,7 @@ static int EnableWindowLocked(vout_thread_t
> *vout, const video_format_t *origina
> VoutGetDisplayCfg(vout, original, &sys->display_cfg);
> vout_SizeWindow(vout, original, &wcfg.width, &wcfg.height);
>
> - if (vout_window_Enable(sys->display_cfg.window, &wcfg)) {
> + if (vout_window_Enable(sys->window, &wcfg)) {
> msg_Err(vout, "failed to enable window");
> return -1;
> }
> @@ -2088,7 +2089,7 @@ vlc_decoder_device *vout_GetDevice(vout_thread_t *vout)
>
> vlc_mutex_lock(&sys->window_lock);
> if (sys->dec_device == NULL)
> - sys->dec_device = vlc_decoder_device_Create(&vout->obj,
> sys->display_cfg.window);
> + sys->dec_device = vlc_decoder_device_Create(&vout->obj,
> sys->window);
> dec_device = sys->dec_device ? vlc_decoder_device_Hold(
> sys->dec_device ) : NULL;
> vlc_mutex_unlock(&sys->window_lock);
> return dec_device;
> diff --git a/src/video_output/vout_internal.h
> b/src/video_output/vout_internal.h
> index fdc92bfa45..4d8a63784e 100644
> --- a/src/video_output/vout_internal.h
> +++ b/src/video_output/vout_internal.h
> @@ -169,6 +169,7 @@ struct vout_thread_sys_t
> void *mouse_opaque;
>
> /* Video output window */
> + vout_window_t *window;
> bool window_enabled;
> vlc_mutex_t window_lock;
> vlc_decoder_device *dec_device;
> @@ -272,7 +273,8 @@ void vout_IntfDeinit(vlc_object_t *);
>
> /* */
> vout_display_t *vout_OpenWrapper(vout_thread_t *, const char *,
> - const vout_display_cfg_t *, vlc_video_context *);
> + const vout_display_cfg_t *, vout_window_t *,
> + vlc_video_context *);
> void vout_CloseWrapper(vout_thread_t *, vout_display_t *vd);
>
> /* */
> diff --git a/src/video_output/vout_wrapper.c
> b/src/video_output/vout_wrapper.c
> index 9e5b14a56b..13eabd672f 100644
> --- a/src/video_output/vout_wrapper.c
> +++ b/src/video_output/vout_wrapper.c
> @@ -56,7 +56,7 @@ static void VoutViewpointMoved(void *sys, const
> vlc_viewpoint_t *vp)
>
> *****************************************************************************/
> vout_display_t *vout_OpenWrapper(vout_thread_t *vout,
> const char *splitter_name, const
> vout_display_cfg_t *cfg,
> - vlc_video_context *vctx)
> + vout_window_t *window, vlc_video_context *vctx)
> {
> vout_thread_sys_t *sys = vout->p;
> vout_display_t *vd;
> @@ -73,7 +73,7 @@ vout_display_t *vout_OpenWrapper(vout_thread_t *vout,
> else
> modlist = "splitter,none";
>
> - vd = vout_display_New(VLC_OBJECT(vout), &sys->original, vctx, cfg,
> + vd = vout_display_New(VLC_OBJECT(vout), &sys->original, vctx, cfg, window,
> modlist, &owner);
> free(modlistbuf);
>
> --
> 2.20.1
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list