[vlc-devel] [PATCH 01/20] display: use vd->cfg directly in VOUT_DISPLAY_CHANGE_xxx
Steve Lhomme
robux4 at ycbcr.xyz
Tue Aug 25 09:29:49 CEST 2020
No need to pass a const on a value we already have access to.
---
modules/hw/mmal/vout.c | 3 +--
modules/hw/vdpau/display.c | 7 +++----
modules/video_output/android/display.c | 6 ++----
modules/video_output/caopengllayer.m | 4 +---
modules/video_output/ios.m | 7 +------
modules/video_output/kva.c | 6 ++----
modules/video_output/macosx.m | 9 +++------
modules/video_output/opengl/display.c | 6 +++---
modules/video_output/vulkan/display.c | 3 +--
modules/video_output/wayland/shm.c | 11 +++++------
modules/video_output/win32/common.c | 4 ++--
modules/video_output/xcb/render.c | 15 ++++++---------
modules/video_output/xcb/x11.c | 3 +--
13 files changed, 31 insertions(+), 53 deletions(-)
diff --git a/modules/hw/mmal/vout.c b/modules/hw/mmal/vout.c
index 5889d3d55ec..8af3329ba45 100644
--- a/modules/hw/mmal/vout.c
+++ b/modules/hw/mmal/vout.c
@@ -700,8 +700,7 @@ static int vd_control(vout_display_t *vd, int query, va_list args)
switch (query) {
case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
{
- const vout_display_cfg_t *cfg = va_arg(args, const vout_display_cfg_t *);
- if (configure_display(vd, cfg, NULL) >= 0)
+ if (configure_display(vd, vd->cfg, NULL) >= 0)
ret = VLC_SUCCESS;
break;
}
diff --git a/modules/hw/vdpau/display.c b/modules/hw/vdpau/display.c
index 5963be63718..60916964110 100644
--- a/modules/hw/vdpau/display.c
+++ b/modules/hw/vdpau/display.c
@@ -231,13 +231,13 @@ static int Control(vout_display_t *vd, int query, va_list ap)
{
case VOUT_DISPLAY_RESET_PICTURES:
{
- const vout_display_cfg_t *cfg = va_arg(ap, const vout_display_cfg_t *);
+ va_arg(ap, const vout_display_cfg_t *);
video_format_t *fmt = va_arg(ap, video_format_t *);
const video_format_t *src= &vd->source;
vout_display_place_t place;
msg_Dbg(vd, "resetting pictures");
- vout_display_PlacePicture(&place, src, cfg);
+ vout_display_PlacePicture(&place, src, vd->cfg);
fmt->i_width = src->i_width * place.width / src->i_visible_width;
fmt->i_height = src->i_height * place.height / src->i_visible_height;
@@ -256,10 +256,9 @@ static int Control(vout_display_t *vd, int query, va_list ap)
}
case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
{
- const vout_display_cfg_t *cfg = va_arg(ap, const vout_display_cfg_t *);
vout_display_place_t place;
- vout_display_PlacePicture(&place, &vd->source, cfg);
+ vout_display_PlacePicture(&place, &vd->source, vd->cfg);
if (place.width != vd->fmt.i_visible_width
|| place.height != vd->fmt.i_visible_height)
return VLC_EGENERIC;
diff --git a/modules/video_output/android/display.c b/modules/video_output/android/display.c
index ba7947b7624..0b849b7f0f7 100644
--- a/modules/video_output/android/display.c
+++ b/modules/video_output/android/display.c
@@ -916,10 +916,8 @@ static int Control(vout_display_t *vd, int query, va_list args)
}
case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
{
- const vout_display_cfg_t *cfg = va_arg(args, const vout_display_cfg_t *);
-
- sys->i_display_width = cfg->display.width;
- sys->i_display_height = cfg->display.height;
+ sys->i_display_width = vd->cfg->display.width;
+ sys->i_display_height = vd->cfg->display.height;
msg_Dbg(vd, "change display size: %dx%d", sys->i_display_width,
sys->i_display_height);
FixSubtitleFormat(sys);
diff --git a/modules/video_output/caopengllayer.m b/modules/video_output/caopengllayer.m
index 0dafcec000a..029517b4ab6 100644
--- a/modules/video_output/caopengllayer.m
+++ b/modules/video_output/caopengllayer.m
@@ -308,11 +308,9 @@ static int Control (vout_display_t *vd, int query, va_list ap)
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
{
- const vout_display_cfg_t *cfg =
- va_arg (ap, const vout_display_cfg_t *);
/* we always use our current frame here */
- vout_display_cfg_t cfg_tmp = *cfg;
+ vout_display_cfg_t cfg_tmp = *vd->cfg;
[CATransaction lock];
CGRect bounds = [sys->cgLayer visibleRect];
[CATransaction unlock];
diff --git a/modules/video_output/ios.m b/modules/video_output/ios.m
index 80b75147c7e..87a0787aa72 100644
--- a/modules/video_output/ios.m
+++ b/modules/video_output/ios.m
@@ -261,12 +261,7 @@ static int Control(vout_display_t *vd, int query, va_list ap)
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
{
- const vout_display_cfg_t *cfg =
- va_arg(ap, const vout_display_cfg_t *);
-
- assert(cfg);
-
- [sys->glESView updateVoutCfg:cfg withVGL:glsys->vgl];
+ [sys->glESView updateVoutCfg:vd->cfg withVGL:glsys->vgl];
return VLC_SUCCESS;
}
diff --git a/modules/video_output/kva.c b/modules/video_output/kva.c
index 185e8269600..994035aa713 100644
--- a/modules/video_output/kva.c
+++ b/modules/video_output/kva.c
@@ -420,11 +420,9 @@ static int Control( vout_display_t *vd, int query, va_list args )
case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
{
- const vout_display_cfg_t *cfg = va_arg(args, const vout_display_cfg_t *);
-
WinPostMsg( sys->client, WM_VLC_SIZE_CHANGE,
- MPFROMLONG( cfg->display.width ),
- MPFROMLONG( cfg->display.height ));
+ MPFROMLONG( vd->cfg->display.width ),
+ MPFROMLONG( vd->cfg->display.height ));
return VLC_SUCCESS;
}
diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index 15d0c305772..9201c491d82 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -350,12 +350,9 @@ static int Control (vout_display_t *vd, int query, va_list ap)
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
{
- const vout_display_cfg_t *cfg =
- va_arg (ap, const vout_display_cfg_t *);
-
/* we always use our current frame here, because we have some size constraints
in the ui vout provider */
- vout_display_cfg_t cfg_tmp = *cfg;
+ vout_display_cfg_t cfg_tmp = *vd->cfg;
/* Reverse vertical alignment as the GL tex are Y inverted */
if (cfg_tmp.align.vertical == VLC_VIDEO_ALIGN_TOP)
@@ -366,7 +363,7 @@ static int Control (vout_display_t *vd, int query, va_list ap)
vout_display_place_t place;
vout_display_PlacePicture(&place, &vd->source, &cfg_tmp);
@synchronized (sys->glView) {
- sys->cfg = *cfg;
+ sys->cfg = *vd->cfg;
}
if (vlc_gl_MakeCurrent (sys->gl) != VLC_SUCCESS)
@@ -378,7 +375,7 @@ static int Control (vout_display_t *vd, int query, va_list ap)
if (query != VOUT_DISPLAY_CHANGE_DISPLAY_SIZE)
// x / y are top left corner, but we need the lower left one
vout_display_opengl_Viewport(sys->vgl, place.x,
- cfg_tmp.display.height - (place.y + place.height),
+ vd->cfg->display.height - (place.y + place.height),
place.width, place.height);
vlc_gl_ReleaseCurrent (sys->gl);
diff --git a/modules/video_output/opengl/display.c b/modules/video_output/opengl/display.c
index 2db08ccc03b..9350e64814c 100644
--- a/modules/video_output/opengl/display.c
+++ b/modules/video_output/opengl/display.c
@@ -231,21 +231,21 @@ static int Control (vout_display_t *vd, int query, va_list ap)
case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED:
case VOUT_DISPLAY_CHANGE_ZOOM:
{
- vout_display_cfg_t cfg = *va_arg(ap, const vout_display_cfg_t *);
+ vout_display_cfg_t cfg = *vd->cfg;
const video_format_t *src = &vd->source;
FlipVerticalAlign(&cfg);
vout_display_PlacePicture(&sys->place, src, &cfg);
sys->place_changed = true;
- vlc_gl_Resize (sys->gl, cfg.display.width, cfg.display.height);
+ vlc_gl_Resize (sys->gl, vd->cfg->display.width, vd->cfg->display.height);
return VLC_SUCCESS;
}
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
{
- vout_display_cfg_t cfg = *va_arg(ap, const vout_display_cfg_t *);
+ vout_display_cfg_t cfg = *vd->cfg;
FlipVerticalAlign(&cfg);
diff --git a/modules/video_output/vulkan/display.c b/modules/video_output/vulkan/display.c
index 226165f2838..6933c874a26 100644
--- a/modules/video_output/vulkan/display.c
+++ b/modules/video_output/vulkan/display.c
@@ -347,8 +347,7 @@ static int Control(vout_display_t *vd, int query, va_list ap)
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
case VOUT_DISPLAY_CHANGE_ZOOM: {
- vout_display_cfg_t cfg = *va_arg (ap, const vout_display_cfg_t *);
- vout_display_PlacePicture(&sys->place, &vd->source, &cfg);
+ vout_display_PlacePicture(&sys->place, &vd->source, vd->cfg);
return VLC_SUCCESS;
}
diff --git a/modules/video_output/wayland/shm.c b/modules/video_output/wayland/shm.c
index 77acabdd0c2..483dc0117c7 100644
--- a/modules/video_output/wayland/shm.c
+++ b/modules/video_output/wayland/shm.c
@@ -160,13 +160,13 @@ static int Control(vout_display_t *vd, int query, va_list ap)
{
case VOUT_DISPLAY_RESET_PICTURES:
{
- const vout_display_cfg_t *cfg = va_arg(ap, const vout_display_cfg_t *);
+ va_arg(ap, const vout_display_cfg_t *);
video_format_t *fmt = va_arg(ap, video_format_t *);
vout_display_place_t place;
video_format_t src;
assert(sys->viewport == NULL);
- vout_display_PlacePicture(&place, &vd->source, cfg);
+ vout_display_PlacePicture(&place, &vd->source, vd->cfg);
video_format_ApplyRotation(&src, &vd->source);
fmt->i_width = src.i_width * place.width
@@ -188,9 +188,8 @@ static int Control(vout_display_t *vd, int query, va_list ap)
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
{
- const vout_display_cfg_t *cfg = va_arg(ap, const vout_display_cfg_t *);
- sys->display_width = cfg->display.width;
- sys->display_height = cfg->display.height;
+ sys->display_width = vd->cfg->display.width;
+ sys->display_height = vd->cfg->display.height;
if (sys->viewport != NULL)
{
@@ -198,7 +197,7 @@ static int Control(vout_display_t *vd, int query, va_list ap)
vout_display_place_t place;
video_format_ApplyRotation(&fmt, &vd->source);
- vout_display_PlacePicture(&place, &vd->source, cfg);
+ vout_display_PlacePicture(&place, &vd->source, vd->cfg);
wp_viewport_set_source(sys->viewport,
wl_fixed_from_int(fmt.i_x_offset),
diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index 60fb4e0f25a..7b6ee4b32a3 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -144,13 +144,13 @@ int CommonControl(vout_display_t *vd, display_win32_area_t *area, vout_display_s
case VOUT_DISPLAY_CHANGE_ZOOM: /* const vout_display_cfg_t *p_cfg */
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP: {
- area->vdcfg = *va_arg(args, const vout_display_cfg_t *);
+ area->vdcfg = *vd->cfg;
CommonPlacePicture(vd, area, sys);
return VLC_SUCCESS;
}
case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE: /* const vout_display_cfg_t *p_cfg */
{ /* Update dimensions */
- area->vdcfg = *va_arg(args, const vout_display_cfg_t *);
+ area->vdcfg = *vd->cfg;
#if !VLC_WINSTORE_APP
if (sys->event != NULL)
{
diff --git a/modules/video_output/xcb/render.c b/modules/video_output/xcb/render.c
index c3e71933f35..0881a5546d6 100644
--- a/modules/video_output/xcb/render.c
+++ b/modules/video_output/xcb/render.c
@@ -265,7 +265,7 @@ static void Display(vout_display_t *vd, picture_t *pic)
(void) pic;
}
-static void CreateBuffers(vout_display_t *vd, const vout_display_cfg_t *cfg)
+static void CreateBuffers(vout_display_t *vd)
{
const video_format_t *fmt = &vd->source;
vout_display_sys_t *sys = vd->sys;
@@ -274,14 +274,14 @@ static void CreateBuffers(vout_display_t *vd, const vout_display_cfg_t *cfg)
xcb_create_pixmap(conn, 32, sys->drawable.crop, sys->root,
fmt->i_visible_width, fmt->i_visible_height);
xcb_create_pixmap(conn, 32, sys->drawable.scale, sys->root,
- cfg->display.width, cfg->display.height);
+ vd->cfg->display.width, vd->cfg->display.height);
xcb_render_create_picture(conn, sys->picture.crop, sys->drawable.crop,
sys->format.argb, 0, NULL);
xcb_render_create_picture(conn, sys->picture.scale, sys->drawable.scale,
sys->format.argb, 0, NULL);
vout_display_place_t *place = &sys->place;
- vout_display_PlacePicture(place, fmt, cfg);
+ vout_display_PlacePicture(place, fmt, vd->cfg);
/* Homogeneous coordinates transform from destination(place)
* to source(fmt) */
@@ -360,18 +360,15 @@ static int Control(vout_display_t *vd, int query, va_list ap)
case VOUT_DISPLAY_CHANGE_ZOOM:
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP: {
- const vout_display_cfg_t *cfg = va_arg(ap,
- const vout_display_cfg_t *);
-
/* Update the window size */
uint32_t mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
const uint32_t values[] = {
- cfg->display.width, cfg->display.height
+ vd->cfg->display.width, vd->cfg->display.height
};
xcb_configure_window(sys->conn, sys->drawable.dest, mask, values);
DeleteBuffers(vd);
- CreateBuffers(vd, cfg);
+ CreateBuffers(vd);
xcb_flush(sys->conn);
return VLC_SUCCESS;
}
@@ -680,7 +677,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
sys->format.argb, 0, NULL);
xcb_render_create_picture(conn, sys->picture.dest, sys->drawable.dest,
sys->format.argb, 0, NULL);
- CreateBuffers(vd, cfg);
+ CreateBuffers(vd);
xcb_map_window(conn, sys->drawable.dest);
sys->spu_chromas[0] = fmtp->i_chroma;
diff --git a/modules/video_output/xcb/x11.c b/modules/video_output/xcb/x11.c
index 05e012f3897..0aebfd81591 100644
--- a/modules/video_output/xcb/x11.c
+++ b/modules/video_output/xcb/x11.c
@@ -145,12 +145,11 @@ static int Control(vout_display_t *vd, int query, va_list ap)
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
{
- const vout_display_cfg_t *cfg = va_arg(ap, const vout_display_cfg_t *);
video_format_t src, *fmt = &sys->fmt;
vout_display_place_t place;
int ret = VLC_SUCCESS;
- vout_display_PlacePicture(&place, &vd->source, cfg);
+ vout_display_PlacePicture(&place, &vd->source, vd->cfg);
uint32_t mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y;
const uint32_t values[] = {
--
2.26.2
More information about the vlc-devel
mailing list