[vlc-devel] [PATCH 14/15] vout: use vd->cfg with VOUT_DISPLAY_CHANGE_xxx controls
Thomas Guillem
thomas at gllm.fr
Thu Sep 3 10:14:44 CEST 2020
LGTM
On Thu, Sep 3, 2020, at 07:52, Steve Lhomme wrote:
> The passed pointer is always vd->cfg. Not need to go through varargs for that.
> ---
> modules/hw/mmal/vout.c | 3 +--
> modules/hw/vdpau/display.c | 3 +--
> modules/video_output/android/display.c | 6 ++----
> modules/video_output/caopengllayer.m | 5 +----
> modules/video_output/ios.m | 7 ++-----
> modules/video_output/kva.c | 6 ++----
> modules/video_output/macosx.m | 7 ++-----
> modules/video_output/opengl/display.c | 4 ++--
> modules/video_output/vulkan/display.c | 3 +--
> modules/video_output/wayland/shm.c | 7 +++----
> modules/video_output/win32/common.c | 10 +++++-----
> modules/video_output/xcb/render.c | 7 ++-----
> modules/video_output/xcb/x11.c | 3 +--
> 13 files changed, 25 insertions(+), 46 deletions(-)
>
> diff --git a/modules/hw/mmal/vout.c b/modules/hw/mmal/vout.c
> index d96328fc63d..e06a24a5da4 100644
> --- a/modules/hw/mmal/vout.c
> +++ b/modules/hw/mmal/vout.c
> @@ -702,8 +702,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 3a2ed1d344a..ec4416ff1e3 100644
> --- a/modules/hw/vdpau/display.c
> +++ b/modules/hw/vdpau/display.c
> @@ -255,10 +255,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 297ac18c2f5..2024122c05e 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 8b76c0b6d1d..dd4d9ae0625 100644
> --- a/modules/video_output/caopengllayer.m
> +++ b/modules/video_output/caopengllayer.m
> @@ -308,11 +308,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 *);
> -
> /* 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 9ba5dd42466..9bfb145a841 100644
> --- a/modules/video_output/ios.m
> +++ b/modules/video_output/ios.m
> @@ -261,12 +261,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 *);
> + assert(vd->cfg);
>
> - 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 fb7d289e20d..8a07fa65c1b 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 b4d0921eaec..77d8222c232 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)
> diff --git a/modules/video_output/opengl/display.c
> b/modules/video_output/opengl/display.c
> index 464be2cebf2..e8f073c3bac 100644
> --- a/modules/video_output/opengl/display.c
> +++ b/modules/video_output/opengl/display.c
> @@ -231,7 +231,7 @@ 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;
>
> FlipVerticalAlign(&cfg);
>
> @@ -244,7 +244,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:
> {
> - 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 56825b325eb..1d58b3a4763 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 5c1118f62b9..27b26955cb5 100644
> --- a/modules/video_output/wayland/shm.c
> +++ b/modules/video_output/wayland/shm.c
> @@ -187,9 +187,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)
> {
> @@ -197,7 +196,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 b8454793c26..88c1fc4a9a7 100644
> --- a/modules/video_output/win32/common.c
> +++ b/modules/video_output/win32/common.c
> @@ -132,17 +132,17 @@ void CommonWindowClean(vout_display_sys_win32_t
> *sys)
> int CommonControl(vout_display_t *vd, display_win32_area_t *area,
> vout_display_sys_win32_t *sys, int query, va_list args)
> {
> switch (query) {
> - case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED: /* const
> vout_display_cfg_t *p_cfg */
> - case VOUT_DISPLAY_CHANGE_ZOOM: /* const
> vout_display_cfg_t *p_cfg */
> + case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED:
> + case VOUT_DISPLAY_CHANGE_ZOOM:
> 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 */
> + case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
> { /* 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 16197f65db5..14eaa06c3dc 100644
> --- a/modules/video_output/xcb/render.c
> +++ b/modules/video_output/xcb/render.c
> @@ -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, vd->cfg);
> xcb_flush(sys->conn);
> return VLC_SUCCESS;
> }
> diff --git a/modules/video_output/xcb/x11.c
> b/modules/video_output/xcb/x11.c
> index 4e57eea9872..eee5c666519 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
>
> _______________________________________________
> 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