Commit 3705c13a authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vout: simplify vout_display_NewWindow() parameters

Only the type is useful here. The other parameters are the same for
all video outputs (i.e. copied from vd->cfg), and should already have
been taken care of when the window was created.
parent aaef11b8
......@@ -235,7 +235,7 @@ struct vout_display_owner_t {
* These functions are set prior to the module instantiation and must not
* be overwritten nor used directly (use the vout_display_*Window
* wrapper */
vout_window_t *(*window_new)(vout_display_t *, const vout_window_cfg_t *);
vout_window_t *(*window_new)(vout_display_t *, unsigned type);
void (*window_del)(vout_display_t *, vout_window_t *);
};
......@@ -388,13 +388,11 @@ static inline void vout_display_SendEventMouseDoubleClick(vout_display_t *vd)
}
/**
* Asks for a new window with the given configuration as hint.
*
* b_standalone/i_x/i_y may be overwritten by the core
* Asks for a new window of a given type.
*/
static inline vout_window_t *vout_display_NewWindow(vout_display_t *vd, const vout_window_cfg_t *cfg)
static inline vout_window_t *vout_display_NewWindow(vout_display_t *vd, unsigned type)
{
return vd->owner.window_new(vd, cfg);
return vd->owner.window_new(vd, type);
}
/**
* Deletes a window created by vout_display_NewWindow if window is non NULL
......@@ -408,18 +406,7 @@ static inline void vout_display_DeleteWindow(vout_display_t *vd,
static inline bool vout_display_IsWindowed(vout_display_t *vd)
{
#ifndef __cplusplus
vout_window_cfg_t cfg = {
.width = vd->cfg->display.width,
.height = vd->cfg->display.height,
};
#else
vout_window_cfg_t cfg;
memset(&cfg, 0, sizeof (cfg));
cfg.width = vd->cfg->display.width;
cfg.height = vd->cfg->display.height;
#endif
vout_window_t *window = vout_display_NewWindow(vd, &cfg);
vout_window_t *window = vout_display_NewWindow(vd, VOUT_WINDOW_TYPE_INVALID);
if (window != NULL)
vout_display_DeleteWindow(vd, window);
return window != NULL;
......
......@@ -120,16 +120,7 @@ static int Open (vlc_object_t *p_this)
if (container)
vout_display_DeleteWindow(vd, NULL);
else {
vout_window_cfg_t wnd_cfg;
memset(&wnd_cfg, 0, sizeof(wnd_cfg));
wnd_cfg.type = VOUT_WINDOW_TYPE_NSOBJECT;
wnd_cfg.x = var_InheritInteger(vd, "video-x");
wnd_cfg.y = var_InheritInteger(vd, "video-y");
wnd_cfg.height = vd->cfg->display.height;
wnd_cfg.width = vd->cfg->display.width;
sys->embed = vout_display_NewWindow(vd, &wnd_cfg);
sys->embed = vout_display_NewWindow(vd, VOUT_WINDOW_TYPE_NSOBJECT);
if (sys->embed)
container = sys->embed->handle.nsobject;
......
......@@ -106,13 +106,7 @@ static int Open (vlc_object_t *obj)
sys->gl = NULL;
sys->pool = NULL;
vout_window_cfg_t cfg = {
.type = VOUT_WINDOW_TYPE_INVALID, /* any */
.width = vd->cfg->display.width,
.height = vd->cfg->display.height,
};
vout_window_t *surface = vout_display_NewWindow (vd, &cfg);
vout_window_t *surface = vout_display_NewWindow (vd, VOUT_WINDOW_TYPE_INVALID);
if (surface == NULL)
{
msg_Err (vd, "parent window not available");
......@@ -123,7 +117,7 @@ static int Open (vlc_object_t *obj)
if (sys->gl == NULL)
goto error;
vlc_gl_Resize (sys->gl, cfg.width, cfg.height);
vlc_gl_Resize (sys->gl, vd->cfg->display.width, vd->cfg->display.height);
/* Initialize video display */
const vlc_fourcc_t *spu_chromas;
......
......@@ -175,18 +175,9 @@ static void PMThread( void *arg )
sys->b_fixt23 = var_CreateGetBool( vd, "kva-fixt23");
if( !sys->b_fixt23 )
{
vout_window_cfg_t wnd_cfg;
wnd_cfg.is_standalone = false;
wnd_cfg.type = VOUT_WINDOW_TYPE_HWND;
wnd_cfg.width = vd->cfg->display.width;
wnd_cfg.height = vd->cfg->display.height;
/* If an external window was specified, we'll draw in it. */
sys->parent_window =
vout_display_NewWindow( vd, &wnd_cfg );
}
vout_display_NewWindow( vd, VOUT_WINDOW_TYPE_HWND );
if( sys->parent_window )
{
......
......@@ -156,16 +156,7 @@ static int Open (vlc_object_t *this)
if (container)
vout_display_DeleteWindow (vd, NULL);
else {
vout_window_cfg_t wnd_cfg;
memset (&wnd_cfg, 0, sizeof (wnd_cfg));
wnd_cfg.type = VOUT_WINDOW_TYPE_NSOBJECT;
wnd_cfg.x = var_InheritInteger (vd, "video-x");
wnd_cfg.y = var_InheritInteger (vd, "video-y");
wnd_cfg.width = vd->cfg->display.width;
wnd_cfg.height = vd->cfg->display.height;
sys->embed = vout_display_NewWindow (vd, &wnd_cfg);
sys->embed = vout_display_NewWindow (vd, VOUT_WINDOW_TYPE_NSOBJECT);
if (sys->embed)
container = sys->embed->handle.nsobject;
......
......@@ -685,14 +685,8 @@ static int Win32VoutCreateWindow( event_thread_t *p_event )
if( !p_event->use_desktop )
#endif
{
vout_window_cfg_t wnd_cfg = {
.type = VOUT_WINDOW_TYPE_HWND,
.width = p_event->width,
.height = p_event->height,
};
/* If an external window was specified, we'll draw in it. */
p_event->parent_window = vout_display_NewWindow(vd, &wnd_cfg );
p_event->parent_window = vout_display_NewWindow(vd, VOUT_WINDOW_TYPE_HWND);
if( p_event->parent_window )
p_event->hparent = p_event->parent_window->handle.hwnd;
else
......
......@@ -396,12 +396,7 @@ static int Open(vlc_object_t *obj)
sys->use_buffer_transform = false;
/* Get window */
vout_window_cfg_t wcfg = {
.type = VOUT_WINDOW_TYPE_WAYLAND,
.width = vd->cfg->display.width,
.height = vd->cfg->display.height,
};
sys->embed = vout_display_NewWindow(vd, &wcfg);
sys->embed = vout_display_NewWindow(vd, VOUT_WINDOW_TYPE_WAYLAND);
if (sys->embed == NULL)
goto error;
......
......@@ -128,13 +128,7 @@ vout_window_t *XCB_parent_Create (vout_display_t *vd,
xcb_connection_t **restrict pconn,
const xcb_screen_t **restrict pscreen)
{
vout_window_cfg_t cfg = {
.type = VOUT_WINDOW_TYPE_XID,
.width = vd->cfg->display.width,
.height = vd->cfg->display.height,
};
vout_window_t *wnd = vout_display_NewWindow (vd, &cfg);
vout_window_t *wnd = vout_display_NewWindow (vd, VOUT_WINDOW_TYPE_XID);
if (wnd == NULL)
{
msg_Err (vd, "window not available");
......
......@@ -716,10 +716,10 @@ static void VoutDisplayEvent(vout_display_t *vd, int event, va_list args)
}
}
static vout_window_t *VoutDisplayNewWindow(vout_display_t *vd, const vout_window_cfg_t *cfg)
static vout_window_t *VoutDisplayNewWindow(vout_display_t *vd, unsigned type)
{
vout_display_owner_sys_t *osys = vd->owner.sys;
vout_window_t *window = vout_NewDisplayWindow(osys->vout, cfg);
vout_window_t *window = vout_NewDisplayWindow(osys->vout, type);
if (window != NULL)
vout_display_window_Attach(window, vd);
return window;
......@@ -1342,13 +1342,16 @@ struct video_splitter_owner_t {
vout_display_t *wrapper;
};
static vout_window_t *SplitterNewWindow(vout_display_t *vd, const vout_window_cfg_t *cfg_ptr)
static vout_window_t *SplitterNewWindow(vout_display_t *vd, unsigned type)
{
vout_display_owner_sys_t *osys = vd->owner.sys;
vout_window_t *window;
vout_window_cfg_t cfg = *cfg_ptr;
cfg.is_standalone = true;
vout_window_cfg_t cfg = {
.type = type,
.width = vd->cfg->display.width,
.height = vd->cfg->display.height,
.is_standalone = true,
};
window = vout_display_window_New(osys->vout, &cfg);
if (window != NULL)
......
......@@ -34,7 +34,7 @@ vout_display_t *vout_NewSplitter(vout_thread_t *vout,
/* FIXME should not be there */
void vout_SendDisplayEventMouse(vout_thread_t *, const vlc_mouse_t *);
vout_window_t *vout_NewDisplayWindow(vout_thread_t *, const vout_window_cfg_t *);
vout_window_t *vout_NewDisplayWindow(vout_thread_t *, unsigned type);
void vout_DeleteDisplayWindow(vout_thread_t *, vout_window_t *);
void vout_SetDisplayWindowSize(vout_thread_t *, unsigned, unsigned);
......
......@@ -633,8 +633,7 @@ static void VoutGetDisplayCfg(vout_thread_t *vout, vout_display_cfg_t *cfg, cons
cfg->align.vertical = VOUT_DISPLAY_ALIGN_BOTTOM;
}
vout_window_t * vout_NewDisplayWindow(vout_thread_t *vout,
const vout_window_cfg_t *cfg)
vout_window_t *vout_NewDisplayWindow(vout_thread_t *vout, unsigned type)
{
vout_window_t *window = vout->p->window;
......@@ -642,10 +641,8 @@ vout_window_t * vout_NewDisplayWindow(vout_thread_t *vout,
if (window == NULL)
return NULL;
if (cfg->type != VOUT_WINDOW_TYPE_INVALID && cfg->type != window->type)
if (type != VOUT_WINDOW_TYPE_INVALID && type != window->type)
return NULL;
vout_window_SetSize(window, cfg->width, cfg->height);
return window;
}
......
......@@ -187,6 +187,9 @@ void vout_display_window_Attach(vout_window_t *window, vout_display_t *vd)
{
vout_display_window_t *state = window->owner.sys;
vout_window_SetSize(window,
vd->cfg->display.width, vd->cfg->display.height);
vlc_mutex_lock(&state->lock);
state->vd = vd;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment