[vlc-devel] [PATCH 03/15] display: make vd->source a const pointer
Thomas Guillem
thomas at gllm.fr
Thu Sep 3 10:08:26 CEST 2020
Yes, I like it.
On Thu, Sep 3, 2020, at 07:52, Steve Lhomme wrote:
> This will prevent display modules from modifying it.
>
> Only osys->source can be modified and sent to the display.
> ---
> include/vlc_vout_display.h | 2 +-
> modules/hw/mmal/vout.c | 8 +--
> modules/hw/vdpau/display.c | 6 +--
> modules/video_output/android/display.c | 4 +-
> modules/video_output/caca.c | 8 +--
> modules/video_output/caopengllayer.m | 2 +-
> modules/video_output/decklink.cpp | 4 +-
> modules/video_output/ios.m | 2 +-
> modules/video_output/kva.c | 6 +--
> modules/video_output/macosx.m | 6 +--
> modules/video_output/opengl/display.c | 5 +-
> modules/video_output/splitter.c | 2 +-
> modules/video_output/vulkan/display.c | 12 ++---
> modules/video_output/wayland/shm.c | 8 +--
> modules/video_output/win32/common.c | 8 +--
> modules/video_output/win32/direct3d11.c | 40 +++++++-------
> modules/video_output/win32/direct3d9.c | 72 ++++++++++++-------------
> modules/video_output/win32/glwin32.c | 6 +--
> modules/video_output/win32/wingdi.c | 14 ++---
> modules/video_output/xcb/render.c | 6 +--
> modules/video_output/xcb/x11.c | 6 +--
> modules/video_output/yuv.c | 10 ++--
> src/video_output/display.c | 50 +++++++++--------
> src/video_output/video_output.c | 14 ++---
> src/video_output/vout_wrapper.c | 2 +-
> 25 files changed, 150 insertions(+), 153 deletions(-)
>
> diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
> index 4c64186788d..d5fc96a9193 100644
> --- a/include/vlc_vout_display.h
> +++ b/include/vlc_vout_display.h
> @@ -287,7 +287,7 @@ struct vout_display_t {
> * \note
> * Cropping is not requested while in the open function.
> */
> - video_format_t source;
> + const video_format_t *source;
>
> /**
> * Picture format.
> diff --git a/modules/hw/mmal/vout.c b/modules/hw/mmal/vout.c
> index e0eeeb0513b..d471971461f 100644
> --- a/modules/hw/mmal/vout.c
> +++ b/modules/hw/mmal/vout.c
> @@ -557,7 +557,7 @@ static int configure_display(vout_display_t *vd,
> const vout_display_cfg_t *cfg,
> return -EINVAL;
> }
> } else {
> - fmt = &vd->source;
> + fmt = vd->source;
> }
>
> if (!cfg)
> @@ -710,7 +710,7 @@ static int vd_control(vout_display_t *vd, int
> query, va_list args)
>
> case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
> case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
> - if (configure_display(vd, NULL, &vd->source) >= 0)
> + if (configure_display(vd, NULL, vd->source) >= 0)
> ret = VLC_SUCCESS;
> break;
>
> @@ -719,7 +719,7 @@ static int vd_control(vout_display_t *vd, int
> query, va_list args)
> msg_Warn(vd, "Reset Pictures");
> kill_pool(sys);
> video_format_t *fmt = va_arg(args, video_format_t *);
> - *fmt = vd->source; // Take (nearly) whatever source wants
> to give us
> + *fmt = *vd->source; // Take (nearly) whatever source wants
> to give us
> fmt->i_chroma = req_chroma(fmt); // Adjust chroma to
> something we can actually deal with
> ret = VLC_SUCCESS;
> break;
> @@ -1209,7 +1209,7 @@ static int OpenMmalVout(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> sys->display_height = vd->cfg->display.height;
> }
>
> - place_dest(sys, vd->cfg, &vd->source); // Sets sys->dest_rect
> + place_dest(sys, vd->cfg, vd->source); // Sets sys->dest_rect
>
> display_region.hdr.id = MMAL_PARAMETER_DISPLAYREGION;
> display_region.hdr.size = sizeof(MMAL_DISPLAYREGION_T);
> diff --git a/modules/hw/vdpau/display.c b/modules/hw/vdpau/display.c
> index 5963be63718..31e1164b4a7 100644
> --- a/modules/hw/vdpau/display.c
> +++ b/modules/hw/vdpau/display.c
> @@ -233,7 +233,7 @@ static int Control(vout_display_t *vd, int query,
> va_list ap)
> {
> const vout_display_cfg_t *cfg = 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;
> + const video_format_t *src= vd->source;
> vout_display_place_t place;
>
> msg_Dbg(vd, "resetting pictures");
> @@ -259,7 +259,7 @@ static int Control(vout_display_t *vd, int query,
> va_list ap)
> 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, cfg);
> if (place.width != vd->fmt.i_visible_width
> || place.height != vd->fmt.i_visible_height)
> return VLC_EGENERIC;
> @@ -427,7 +427,7 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> };
> vout_display_place_t place;
>
> - vout_display_PlacePicture(&place, &vd->source, cfg);
> + vout_display_PlacePicture(&place, vd->source, cfg);
> sys->window = xcb_generate_id(sys->conn);
>
> xcb_void_cookie_t c =
> diff --git a/modules/video_output/android/display.c
> b/modules/video_output/android/display.c
> index ba7947b7624..297ac18c2f5 100644
> --- a/modules/video_output/android/display.c
> +++ b/modules/video_output/android/display.c
> @@ -906,9 +906,9 @@ static int Control(vout_display_t *vd, int query,
> va_list args)
> msg_Dbg(vd, "change source crop/aspect");
>
> if (query == VOUT_DISPLAY_CHANGE_SOURCE_CROP) {
> - video_format_CopyCrop(&sys->p_window->fmt, &vd->source);
> + video_format_CopyCrop(&sys->p_window->fmt, vd->source);
> } else
> - CopySourceAspect(&sys->p_window->fmt, &vd->source);
> + CopySourceAspect(&sys->p_window->fmt, vd->source);
>
> UpdateVideoSize(sys, &sys->p_window->fmt);
> FixSubtitleFormat(sys);
> diff --git a/modules/video_output/caca.c b/modules/video_output/caca.c
> index 21fbd53e6ea..079d72e65ab 100644
> --- a/modules/video_output/caca.c
> +++ b/modules/video_output/caca.c
> @@ -131,8 +131,8 @@ static void Prepare(vout_display_t *vd, picture_t *picture,
> if (!sys->dither) {
> /* Create the libcaca dither object */
> sys->dither = cucul_create_dither(32,
> - vd->source.i_visible_width,
> - vd->source.i_visible_height,
> + vd->source->i_visible_width,
> + vd->source->i_visible_height,
> picture->p[0].i_pitch,
> picture->format.i_rmask,
> picture->format.i_gmask,
> @@ -148,8 +148,8 @@ static void Prepare(vout_display_t *vd, picture_t *picture,
> cucul_set_color_ansi(sys->cv, CUCUL_COLOR_DEFAULT, CUCUL_COLOR_BLACK);
> cucul_clear_canvas(sys->cv);
>
> - const int crop_offset = vd->source.i_y_offset *
> picture->p->i_pitch +
> - vd->source.i_x_offset *
> picture->p->i_pixel_pitch;
> + const int crop_offset = vd->source->i_y_offset *
> picture->p->i_pitch +
> + vd->source->i_x_offset *
> picture->p->i_pixel_pitch;
> cucul_dither_bitmap(sys->cv, sys->place.x, sys->place.y,
> sys->place.width, sys->place.height,
> sys->dither,
> diff --git a/modules/video_output/caopengllayer.m
> b/modules/video_output/caopengllayer.m
> index 0dafcec000a..8b76c0b6d1d 100644
> --- a/modules/video_output/caopengllayer.m
> +++ b/modules/video_output/caopengllayer.m
> @@ -326,7 +326,7 @@ static int Control (vout_display_t *vd, int query,
> va_list ap)
> cfg_tmp.align.vertical = VLC_VIDEO_ALIGN_TOP;
>
> vout_display_place_t place;
> - vout_display_PlacePicture(&place, &vd->source, &cfg_tmp);
> + vout_display_PlacePicture(&place, vd->source, &cfg_tmp);
> if (unlikely(OpenglLock(sys->gl)))
> // don't return an error or we need to handle
> VOUT_DISPLAY_RESET_PICTURES
> return VLC_SUCCESS;
> diff --git a/modules/video_output/decklink.cpp
> b/modules/video_output/decklink.cpp
> index d5049e826e3..cfe069c34ff 100644
> --- a/modules/video_output/decklink.cpp
> +++ b/modules/video_output/decklink.cpp
> @@ -510,7 +510,7 @@ static int OpenDecklink(vout_display_t *vd,
> decklink_sys_t *sys, video_format_t
> CHECK("Could not set video output connection");
>
> p_display_mode =
> Decklink::Helper::MatchDisplayMode(VLC_OBJECT(vd), sys->p_output,
> - &vd->source, wanted_mode_id);
> + vd->source, wanted_mode_id);
> if(p_display_mode == NULL)
> {
> msg_Err(vd, "Could not negociate a compatible display mode");
> @@ -567,7 +567,7 @@ static int OpenDecklink(vout_display_t *vd,
> decklink_sys_t *sys, video_format_t
> result = sys->p_output->EnableVideoOutput(mode_id, flags);
> CHECK("Could not enable video output");
>
> - video_format_Copy(fmt, &vd->source);
> + video_format_Copy(fmt, vd->source);
> fmt->i_width = fmt->i_visible_width = p_display_mode->GetWidth();
> fmt->i_height = fmt->i_visible_height = p_display_mode->GetHeight();
> fmt->i_x_offset = 0;
> diff --git a/modules/video_output/ios.m b/modules/video_output/ios.m
> index 80b75147c7e..9ba5dd42466 100644
> --- a/modules/video_output/ios.m
> +++ b/modules/video_output/ios.m
> @@ -645,7 +645,7 @@ static void GLESSwap(vlc_gl_t *gl)
> cfg.display.width = _viewSize.width * _scaleFactor;
> cfg.display.height = _viewSize.height * _scaleFactor;
>
> - vout_display_PlacePicture(place, &_voutDisplay->source, &cfg);
> + vout_display_PlacePicture(place, _voutDisplay->source, &cfg);
> }
>
> - (void)reshape
> diff --git a/modules/video_output/kva.c b/modules/video_output/kva.c
> index 185e8269600..821dcc46b3d 100644
> --- a/modules/video_output/kva.c
> +++ b/modules/video_output/kva.c
> @@ -433,7 +433,7 @@ static int Control( vout_display_t *vd, int query,
> va_list args )
> case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
> {
> vout_display_place_t place;
> - vout_display_PlacePicture(&place, &vd->source, vd->cfg);
> + vout_display_PlacePicture(&place, vd->source, vd->cfg);
>
> sys->kvas.ulAspectWidth = place.width;
> sys->kvas.ulAspectHeight = place.height;
> @@ -444,7 +444,7 @@ static int Control( vout_display_t *vd, int query,
> va_list args )
> case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
> {
> video_format_t src_rot;
> - video_format_ApplyRotation(&src_rot, &vd->source);
> + video_format_ApplyRotation(&src_rot, vd->source);
>
> sys->kvas.rclSrcRect.xLeft = src_rot.i_x_offset;
> sys->kvas.rclSrcRect.yTop = src_rot.i_y_offset;
> @@ -938,7 +938,7 @@ static MRESULT EXPENTRY WndProc( HWND hwnd, ULONG
> msg, MPARAM mp1, MPARAM mp2 )
> i_movie_height = movie_rect.yTop - movie_rect.yBottom;
>
> vout_display_place_t place;
> - vout_display_PlacePicture(&place, &vd->source, vd->cfg);
> + vout_display_PlacePicture(&place, vd->source, vd->cfg);
>
> int x = ( i_mouse_x - movie_rect.xLeft ) *
> place.width / i_movie_width + place.x;
> diff --git a/modules/video_output/macosx.m
> b/modules/video_output/macosx.m
> index 15d0c305772..b4d0921eaec 100644
> --- a/modules/video_output/macosx.m
> +++ b/modules/video_output/macosx.m
> @@ -321,7 +321,7 @@ static void PictureDisplay (vout_display_t *vd,
> picture_t *pic)
> {
> if (@available(macOS 10.14, *)) {
> vout_display_place_t place;
> - vout_display_PlacePicture(&place, &vd->source, &sys->cfg);
> + vout_display_PlacePicture(&place, vd->source, &sys->cfg);
> vout_display_opengl_Viewport(vd->sys->vgl, place.x,
> sys->cfg.display.height -
> (place.y + place.height),
> place.width, place.height);
> @@ -364,7 +364,7 @@ static int Control (vout_display_t *vd, int query,
> va_list ap)
> cfg_tmp.align.vertical = VLC_VIDEO_ALIGN_TOP;
>
> vout_display_place_t place;
> - vout_display_PlacePicture(&place, &vd->source, &cfg_tmp);
> + vout_display_PlacePicture(&place, vd->source, &cfg_tmp);
> @synchronized (sys->glView) {
> sys->cfg = *cfg;
> }
> @@ -627,7 +627,7 @@ static void OpenglSwap (vlc_gl_t *gl)
> sys->cfg.display.width = bounds.size.width;
> sys->cfg.display.height = bounds.size.height;
>
> - vout_display_PlacePicture(&place, &vd->source, &sys->cfg);
> + vout_display_PlacePicture(&place, vd->source, &sys->cfg);
> // FIXME: this call leads to a fatal mutex locking error
> in vout_ChangeDisplaySize()
> // vout_window_ReportSize(sys->embed, bounds.size.width,
> bounds.size.height);
> }
> diff --git a/modules/video_output/opengl/display.c
> b/modules/video_output/opengl/display.c
> index 2db08ccc03b..da7351a4428 100644
> --- a/modules/video_output/opengl/display.c
> +++ b/modules/video_output/opengl/display.c
> @@ -232,11 +232,10 @@ static int Control (vout_display_t *vd, int
> query, va_list ap)
> case VOUT_DISPLAY_CHANGE_ZOOM:
> {
> vout_display_cfg_t cfg = *va_arg(ap, const vout_display_cfg_t
> *);
> - const video_format_t *src = &vd->source;
>
> FlipVerticalAlign(&cfg);
>
> - vout_display_PlacePicture(&sys->place, src, &cfg);
> + vout_display_PlacePicture(&sys->place, vd->source, &cfg);
> sys->place_changed = true;
> vlc_gl_Resize (sys->gl, cfg.display.width, cfg.display.height);
> return VLC_SUCCESS;
> @@ -249,7 +248,7 @@ static int Control (vout_display_t *vd, int query,
> va_list ap)
>
> FlipVerticalAlign(&cfg);
>
> - vout_display_PlacePicture(&sys->place, &vd->source, &cfg);
> + vout_display_PlacePicture(&sys->place, vd->source, &cfg);
> sys->place_changed = true;
> return VLC_SUCCESS;
> }
> diff --git a/modules/video_output/splitter.c b/modules/video_output/splitter.c
> index 71ceda46748..cc165a03de6 100644
> --- a/modules/video_output/splitter.c
> +++ b/modules/video_output/splitter.c
> @@ -242,7 +242,7 @@ static int vlc_vidsplit_Open(vout_display_t *vd,
> video_splitter_t *splitter = &sys->splitter;
>
> vlc_mutex_init(&sys->lock);
> - video_format_Copy(&splitter->fmt, &vd->source);
> + video_format_Copy(&splitter->fmt, vd->source);
>
> splitter->p_module = module_need(splitter, "video splitter", name,
> true);
> free(name);
> diff --git a/modules/video_output/vulkan/display.c
> b/modules/video_output/vulkan/display.c
> index 226165f2838..56825b325eb 100644
> --- a/modules/video_output/vulkan/display.c
> +++ b/modules/video_output/vulkan/display.c
> @@ -103,11 +103,11 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> goto error;
>
> // Attempt using the input format as the display format
> - if (vlc_placebo_FormatSupported(gpu, vd->source.i_chroma)) {
> - fmt->i_chroma = vd->source.i_chroma;
> + if (vlc_placebo_FormatSupported(gpu, vd->source->i_chroma)) {
> + fmt->i_chroma = vd->source->i_chroma;
> } else {
> const vlc_fourcc_t *fcc;
> - for (fcc = vlc_fourcc_GetFallback(vd->source.i_chroma); *fcc;
> fcc++) {
> + for (fcc = vlc_fourcc_GetFallback(vd->source->i_chroma); *fcc;
> fcc++) {
> if (vlc_placebo_FormatSupported(gpu, *fcc)) {
> fmt->i_chroma = *fcc;
> break;
> @@ -192,8 +192,8 @@ static void PictureRender(vout_display_t *vd,
> picture_t *pic,
> .num_planes = pic->i_planes,
> .width = pic->format.i_visible_width,
> .height = pic->format.i_visible_height,
> - .color = vlc_placebo_ColorSpace(&vd->source),
> - .repr = vlc_placebo_ColorRepr(&vd->source),
> + .color = vlc_placebo_ColorSpace(vd->source),
> + .repr = vlc_placebo_ColorRepr(vd->source),
> .src_rect = {
> .x0 = pic->format.i_x_offset,
> .y0 = pic->format.i_y_offset,
> @@ -348,7 +348,7 @@ static int Control(vout_display_t *vd, int query,
> va_list ap)
> 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, &cfg);
> return VLC_SUCCESS;
> }
>
> diff --git a/modules/video_output/wayland/shm.c
> b/modules/video_output/wayland/shm.c
> index 77acabdd0c2..1d84ec27fe0 100644
> --- a/modules/video_output/wayland/shm.c
> +++ b/modules/video_output/wayland/shm.c
> @@ -166,8 +166,8 @@ static int Control(vout_display_t *vd, int query,
> va_list ap)
> video_format_t src;
> assert(sys->viewport == NULL);
>
> - vout_display_PlacePicture(&place, &vd->source, cfg);
> - video_format_ApplyRotation(&src, &vd->source);
> + vout_display_PlacePicture(&place, vd->source, cfg);
> + video_format_ApplyRotation(&src, vd->source);
>
> fmt->i_width = src.i_width * place.width
> / src.i_visible_width;
> @@ -197,8 +197,8 @@ static int Control(vout_display_t *vd, int query,
> va_list ap)
> video_format_t fmt;
> vout_display_place_t place;
>
> - video_format_ApplyRotation(&fmt, &vd->source);
> - vout_display_PlacePicture(&place, &vd->source, cfg);
> + video_format_ApplyRotation(&fmt, vd->source);
> + vout_display_PlacePicture(&place, vd->source, 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 110ce8ac623..b8454793c26 100644
> --- a/modules/video_output/win32/common.c
> +++ b/modules/video_output/win32/common.c
> @@ -100,7 +100,7 @@ void CommonPlacePicture(vout_display_t *vd,
> display_win32_area_t *area, vout_dis
> vout_display_cfg_t place_cfg = area->vdcfg;
>
> vout_display_place_t before_place = area->place;
> - vout_display_PlacePicture(&area->place, &vd->source, &place_cfg);
> + vout_display_PlacePicture(&area->place, vd->source, &place_cfg);
>
> /* Signal the change in size/position */
> if (!vout_display_PlaceEquals(&before_place, &area->place))
> @@ -109,9 +109,9 @@ void CommonPlacePicture(vout_display_t *vd,
> display_win32_area_t *area, vout_dis
>
> #ifndef NDEBUG
> msg_Dbg(vd, "UpdateRects source offset: %i,%i visible: %ix%i
> decoded: %ix%i",
> - vd->source.i_x_offset, vd->source.i_y_offset,
> - vd->source.i_visible_width, vd->source.i_visible_height,
> - vd->source.i_width, vd->source.i_height);
> + vd->source->i_x_offset, vd->source->i_y_offset,
> + vd->source->i_visible_width, vd->source->i_visible_height,
> + vd->source->i_width, vd->source->i_height);
> msg_Dbg(vd, "UpdateRects image_dst coords: %i,%i %ix%i",
> area->place.x, area->place.y, area->place.width,
> area->place.height);
> #endif
> diff --git a/modules/video_output/win32/direct3d11.c
> b/modules/video_output/win32/direct3d11.c
> index 1e9ae1e733b..f67b677d201 100644
> --- a/modules/video_output/win32/direct3d11.c
> +++ b/modules/video_output/win32/direct3d11.c
> @@ -269,15 +269,15 @@ static void UpdateSize(vout_display_t *vd)
> D3D11_UpdateViewport( &sys->picQuad, &rect_dst,
> sys->display.pixelFormat );
>
> RECT source_rect = {
> - .left = vd->source.i_x_offset,
> - .right = vd->source.i_x_offset + vd->source.i_visible_width,
> - .top = vd->source.i_y_offset,
> - .bottom = vd->source.i_y_offset + vd->source.i_visible_height,
> + .left = vd->source->i_x_offset,
> + .right = vd->source->i_x_offset + vd->source->i_visible_width,
> + .top = vd->source->i_y_offset,
> + .bottom = vd->source->i_y_offset + vd->source->i_visible_height,
> };
> d3d11_device_lock( sys->d3d_dev );
>
> D3D11_UpdateQuadPosition(vd, sys->d3d_dev, &sys->picQuad, &source_rect,
> - vd->source.orientation);
> + vd->source->orientation);
>
> D3D11_UpdateViewpoint( vd, sys->d3d_dev, &sys->picQuad,
> &sys->area.vdcfg.viewpoint,
> (float) sys->area.vdcfg.display.width /
> sys->area.vdcfg.display.height );
> @@ -330,7 +330,7 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> if (cfg->window->type == VOUT_WINDOW_TYPE_HWND)
> {
> if (CommonWindowInit(vd, &sys->area, &sys->sys,
> - vd->source.projection_mode !=
> PROJECTION_MODE_RECTANGULAR))
> + vd->source->projection_mode !=
> PROJECTION_MODE_RECTANGULAR))
> goto error;
> }
>
> @@ -353,7 +353,7 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> }
>
> #if !VLC_WINSTORE_APP
> - if (vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR &&
> sys->sys.hvideownd)
> + if (vd->source->projection_mode != PROJECTION_MODE_RECTANGULAR &&
> sys->sys.hvideownd)
> sys->p_sensors = HookWindowsSensors(vd, sys->sys.hvideownd);
> #endif // !VLC_WINSTORE_APP
>
> @@ -561,7 +561,7 @@ static void PreparePicture(vout_display_t *vd,
> picture_t *picture, subpicture_t
> renderSrc = p_sys->renderSrc;
> }
> D3D11_RenderQuad(sys->d3d_dev, &sys->picQuad,
> - vd->source.projection_mode ==
> PROJECTION_MODE_RECTANGULAR ? &sys->flatVShader :
> &sys->projectionVShader,
> + vd->source->projection_mode ==
> PROJECTION_MODE_RECTANGULAR ? &sys->flatVShader :
> &sys->projectionVShader,
> renderSrc, SelectRenderPlane, sys);
>
> if (subpicture) {
> @@ -689,22 +689,22 @@ static int Direct3D11Open(vout_display_t *vd,
> video_format_t *fmtp, vlc_video_co
> {
> vout_display_sys_t *sys = vd->sys;
> video_format_t fmt;
> - video_format_Copy(&fmt, &vd->source);
> + video_format_Copy(&fmt, vd->source);
> int err = SetupOutputFormat(vd, &fmt, vctx);
> if (err != VLC_SUCCESS)
> {
> - if (!is_d3d11_opaque(vd->source.i_chroma)
> + if (!is_d3d11_opaque(vd->source->i_chroma)
> #if !VLC_WINSTORE_APP
> && vd->obj.force
> #endif
> )
> {
> - const vlc_fourcc_t *list =
> vlc_fourcc_IsYUV(vd->source.i_chroma) ?
> - vlc_fourcc_GetYUVFallback(vd->source.i_chroma)
> :
> - vlc_fourcc_GetRGBFallback(vd->source.i_chroma);
> + const vlc_fourcc_t *list =
> vlc_fourcc_IsYUV(vd->source->i_chroma) ?
> +
> vlc_fourcc_GetYUVFallback(vd->source->i_chroma) :
> +
> vlc_fourcc_GetRGBFallback(vd->source->i_chroma);
> for (unsigned i = 0; list[i] != 0; i++) {
> fmt.i_chroma = list[i];
> - if (fmt.i_chroma == vd->source.i_chroma)
> + if (fmt.i_chroma == vd->source->i_chroma)
> continue;
> err = SetupOutputFormat(vd, &fmt, NULL);
> if (err == VLC_SUCCESS)
> @@ -964,13 +964,13 @@ static int
> Direct3D11CreateFormatResources(vout_display_t *vd, const video_forma
> return VLC_EGENERIC;
> }
>
> - if (D3D11_AllocateQuad(vd, sys->d3d_dev,
> vd->source.projection_mode, &sys->picQuad) != VLC_SUCCESS)
> + if (D3D11_AllocateQuad(vd, sys->d3d_dev,
> vd->source->projection_mode, &sys->picQuad) != VLC_SUCCESS)
> {
> msg_Err(vd, "Could not allocate quad buffers.");
> return VLC_EGENERIC;
> }
>
> - if (D3D11_SetupQuad( vd, sys->d3d_dev, &vd->source, &sys->picQuad,
> &sys->display) != VLC_SUCCESS)
> + if (D3D11_SetupQuad( vd, sys->d3d_dev, vd->source, &sys->picQuad,
> &sys->display) != VLC_SUCCESS)
> {
> msg_Err(vd, "Could not Create the main quad picture.");
> return VLC_EGENERIC;
> @@ -982,14 +982,14 @@ static int
> Direct3D11CreateFormatResources(vout_display_t *vd, const video_forma
> .top = fmt->i_y_offset,
> .bottom = fmt->i_y_offset + fmt->i_visible_height,
> };
> - if (!D3D11_UpdateQuadPosition(vd, sys->d3d_dev, &sys->picQuad,
> &source_rect, vd->source.orientation))
> + if (!D3D11_UpdateQuadPosition(vd, sys->d3d_dev, &sys->picQuad,
> &source_rect, vd->source->orientation))
> {
> msg_Err(vd, "Could not set quad picture position.");
> return VLC_EGENERIC;
> }
>
> - if ( vd->source.projection_mode == PROJECTION_MODE_EQUIRECTANGULAR
> ||
> - vd->source.projection_mode ==
> PROJECTION_MODE_CUBEMAP_LAYOUT_STANDARD )
> + if ( vd->source->projection_mode ==
> PROJECTION_MODE_EQUIRECTANGULAR ||
> + vd->source->projection_mode ==
> PROJECTION_MODE_CUBEMAP_LAYOUT_STANDARD )
> D3D11_UpdateViewpoint( vd, sys->d3d_dev, &sys->picQuad,
> &sys->area.vdcfg.viewpoint,
> (float) sys->area.vdcfg.display.width /
> sys->area.vdcfg.display.height );
>
> @@ -1007,7 +1007,7 @@ static int
> Direct3D11CreateFormatResources(vout_display_t *vd, const video_forma
> {
> /* we need a staging texture */
> ID3D11Texture2D *textures[D3D11_MAX_SHADER_VIEW] = {0};
> - video_format_t texture_fmt = vd->source;
> + video_format_t texture_fmt = *vd->source;
> texture_fmt.i_width = sys->picQuad.i_width;
> texture_fmt.i_height = sys->picQuad.i_height;
> if (!is_d3d11_opaque(fmt->i_chroma))
> diff --git a/modules/video_output/win32/direct3d9.c
> b/modules/video_output/win32/direct3d9.c
> index 93cd6472874..01581ed0f7f 100644
> --- a/modules/video_output/win32/direct3d9.c
> +++ b/modules/video_output/win32/direct3d9.c
> @@ -372,16 +372,16 @@ static int Direct3D9ImportPicture(vout_display_t
> *vd,
> /* Copy picture surface into texture surface
> * color space conversion happen here */
> RECT source_visible_rect = {
> - .left = vd->source.i_x_offset,
> - .right = vd->source.i_x_offset +
> vd->source.i_visible_width,
> - .top = vd->source.i_y_offset,
> - .bottom = vd->source.i_y_offset +
> vd->source.i_visible_height,
> + .left = vd->source->i_x_offset,
> + .right = vd->source->i_x_offset +
> vd->source->i_visible_width,
> + .top = vd->source->i_y_offset,
> + .bottom = vd->source->i_y_offset +
> vd->source->i_visible_height,
> };
> RECT texture_visible_rect = {
> .left = 0,
> - .right = vd->source.i_visible_width,
> + .right = vd->source->i_visible_width,
> .top = 0,
> - .bottom = vd->source.i_visible_height,
> + .bottom = vd->source->i_visible_height,
> };
> // On nVidia & AMD, StretchRect will fail if the visible size
> isn't even.
> // When copying the entire buffer, the margin end up being
> blended in the actual picture
> @@ -413,9 +413,9 @@ static int Direct3D9ImportPicture(vout_display_t
> *vd,
> region->texture = sys->sceneTexture;
> RECT texture_rect = {
> .left = 0,
> - .right = vd->source.i_width,
> + .right = vd->source->i_width,
> .top = 0,
> - .bottom = vd->source.i_height,
> + .bottom = vd->source->i_height,
> };
> RECT rect_in_display = {
> .left = sys->area.place.x,
> @@ -424,13 +424,13 @@ static int Direct3D9ImportPicture(vout_display_t
> *vd,
> .bottom = sys->area.place.y + sys->area.place.height,
> };
> RECT texture_visible_rect = {
> - .left = vd->source.i_x_offset,
> - .right = vd->source.i_x_offset + vd->source.i_visible_width,
> - .top = vd->source.i_y_offset,
> - .bottom = vd->source.i_y_offset + vd->source.i_visible_height,
> + .left = vd->source->i_x_offset,
> + .right = vd->source->i_x_offset + vd->source->i_visible_width,
> + .top = vd->source->i_y_offset,
> + .bottom = vd->source->i_y_offset +
> vd->source->i_visible_height,
> };
> Direct3D9SetupVertices(region->vertex, &texture_rect,
> &texture_visible_rect,
> - &rect_in_display, 255,
> vd->source.orientation);
> + &rect_in_display, 255,
> vd->source->orientation);
> return VLC_SUCCESS;
> }
>
> @@ -1442,10 +1442,10 @@ static void SetupProcessorInput(vout_display_t
> *vd, const video_format_t *fmt, c
> DXVAHD_STREAM_STATE_SOURCE_RECT_DATA srcRect;
> srcRect.Enable = TRUE;
> srcRect.SourceRect = (RECT) {
> - .left = vd->source.i_x_offset,
> - .right = vd->source.i_x_offset + vd->source.i_visible_width,
> - .top = vd->source.i_y_offset,
> - .bottom = vd->source.i_y_offset + vd->source.i_visible_height,
> + .left = vd->source->i_x_offset,
> + .right = vd->source->i_x_offset + vd->source->i_visible_width,
> + .top = vd->source->i_y_offset,
> + .bottom = vd->source->i_y_offset +
> vd->source->i_visible_height,
> };;
> hr = IDXVAHD_VideoProcessor_SetVideoProcessStreamState(
> sys->processor.proc, 0, DXVAHD_STREAM_STATE_SOURCE_RECT,
> sizeof(srcRect), &srcRect );
>
> @@ -1453,9 +1453,9 @@ static void SetupProcessorInput(vout_display_t
> *vd, const video_format_t *fmt, c
> dstRect.Enable = TRUE;
> dstRect.TargetRect = (RECT) {
> .left = 0,
> - .right = vd->source.i_visible_width,
> + .right = vd->source->i_visible_width,
> .top = 0,
> - .bottom = vd->source.i_visible_height,
> + .bottom = vd->source->i_visible_height,
> };
> hr = IDXVAHD_VideoProcessor_SetVideoProcessBltState(
> sys->processor.proc, DXVAHD_BLT_STATE_TARGET_RECT, sizeof(dstRect),
> &dstRect);
> }
> @@ -1502,12 +1502,12 @@ static int InitRangeProcessor(vout_display_t
> *vd, const d3d9_format_t *d3dfmt,
>
> DXVAHD_CONTENT_DESC desc;
> desc.InputFrameFormat = DXVAHD_FRAME_FORMAT_PROGRESSIVE;
> - GetFrameRate( &desc.InputFrameRate, &vd->source );
> - desc.InputWidth = vd->source.i_visible_width;
> - desc.InputHeight = vd->source.i_visible_height;
> + GetFrameRate( &desc.InputFrameRate, vd->source );
> + desc.InputWidth = vd->source->i_visible_width;
> + desc.InputHeight = vd->source->i_visible_height;
> desc.OutputFrameRate = desc.InputFrameRate;
> - desc.OutputWidth = vd->source.i_visible_width;
> - desc.OutputHeight = vd->source.i_visible_height;
> + desc.OutputWidth = vd->source->i_visible_width;
> + desc.OutputHeight = vd->source->i_visible_height;
>
> hr = CreateDevice(sys->d3d9_device->d3ddev.devex, &desc,
> DXVAHD_DEVICE_USAGE_PLAYBACK_NORMAL, NULL, &hd_device);
> if (FAILED(hr))
> @@ -1590,7 +1590,7 @@ static int InitRangeProcessor(vout_display_t *vd,
> const d3d9_format_t *d3dfmt,
> }
> IDXVAHD_Device_Release( hd_device );
>
> - SetupProcessorInput(vd, &vd->source, d3dfmt);
> + SetupProcessorInput(vd, vd->source, d3dfmt);
>
> DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE_DATA colorspace;
> colorspace.Usage = 0; // playback
> @@ -1618,7 +1618,7 @@ static int Direct3D9Open(vout_display_t *vd,
> video_format_t *fmt, vlc_video_cont
> vout_display_sys_t *sys = vd->sys;
>
> libvlc_video_output_cfg_t render_out;
> - if (UpdateOutput(vd, &vd->source, &render_out) != VLC_SUCCESS)
> + if (UpdateOutput(vd, vd->source, &render_out) != VLC_SUCCESS)
> return VLC_EGENERIC;
>
> sys->BufferFormat = render_out.d3d9_format;
> @@ -1629,15 +1629,15 @@ static int Direct3D9Open(vout_display_t *vd,
> video_format_t *fmt, vlc_video_cont
> /* Find the appropriate D3DFORMAT for the render chroma, the
> format will be the closest to
> * the requested chroma which is usable by the hardware in an
> offscreen surface, as they
> * typically support more formats than textures */
> - const d3d9_format_t *d3dfmt = Direct3DFindFormat(vd, &vd->source,
> vctx);
> + const d3d9_format_t *d3dfmt = Direct3DFindFormat(vd, vd->source,
> vctx);
> if (!d3dfmt) {
> - msg_Err(vd, "unsupported source pixel format %4.4s", (const
> char*)&vd->source.i_chroma);
> + msg_Err(vd, "unsupported source pixel format %4.4s", (const
> char*)&vd->source->i_chroma);
> goto error;
> }
> - msg_Dbg(vd, "found input surface format %s for source %4.4s",
> d3dfmt->name, (const char *)&vd->source.i_chroma);
> + msg_Dbg(vd, "found input surface format %s for source %4.4s",
> d3dfmt->name, (const char *)&vd->source->i_chroma);
>
> bool force_dxva_hd = var_InheritBool(vd, "direct3d9-dxvahd");
> - if (force_dxva_hd || (dst_format && vd->source.color_range !=
> COLOR_RANGE_FULL && dst_format->rmask && !d3dfmt->rmask &&
> + if (force_dxva_hd || (dst_format && vd->source->color_range !=
> COLOR_RANGE_FULL && dst_format->rmask && !d3dfmt->rmask &&
> sys->d3d9_device->d3ddev.identifier.VendorId
> == GPU_MANUFACTURER_NVIDIA))
> {
> // NVIDIA bug, YUV to RGB internal conversion in StretchRect
> always converts from limited to limited range
> @@ -1662,7 +1662,7 @@ static int Direct3D9Open(vout_display_t *vd,
> video_format_t *fmt, vlc_video_cont
> }
>
> /* */
> - *fmt = vd->source;
> + *fmt = *vd->source;
> fmt->i_chroma = d3dfmt->fourcc;
> fmt->i_rmask = d3dfmt->rmask;
> fmt->i_gmask = d3dfmt->gmask;
> @@ -1768,10 +1768,10 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> {
> vout_display_sys_t *sys;
>
> - if ( !vd->obj.force && vd->source.projection_mode !=
> PROJECTION_MODE_RECTANGULAR)
> + if ( !vd->obj.force && vd->source->projection_mode !=
> PROJECTION_MODE_RECTANGULAR)
> return VLC_EGENERIC; /* let a module who can handle it do it */
>
> - if ( !vd->obj.force && vd->source.mastering.max_luminance != 0)
> + if ( !vd->obj.force && vd->source->mastering.max_luminance != 0)
> return VLC_EGENERIC; /* let a module who can handle it do it */
>
> /* do not use D3D9 on XP unless forced */
> @@ -1827,11 +1827,11 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> }
>
>
> - if ( vd->source.i_visible_width >
> sys->d3d9_device->d3ddev.caps.MaxTextureWidth ||
> - vd->source.i_visible_height >
> sys->d3d9_device->d3ddev.caps.MaxTextureHeight )
> + if ( vd->source->i_visible_width >
> sys->d3d9_device->d3ddev.caps.MaxTextureWidth ||
> + vd->source->i_visible_height >
> sys->d3d9_device->d3ddev.caps.MaxTextureHeight )
> {
> msg_Err(vd, "Textures too large %ux%u max possible: %lx%lx",
> - vd->source.i_visible_width,
> vd->source.i_visible_height,
> + vd->source->i_visible_width,
> vd->source->i_visible_height,
> sys->d3d9_device->d3ddev.caps.MaxTextureWidth,
> sys->d3d9_device->d3ddev.caps.MaxTextureHeight);
> goto error;
> diff --git a/modules/video_output/win32/glwin32.c
> b/modules/video_output/win32/glwin32.c
> index 7b4e0d9c951..a0f486bffe7 100644
> --- a/modules/video_output/win32/glwin32.c
> +++ b/modules/video_output/win32/glwin32.c
> @@ -122,10 +122,10 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> /* */
> CommonInit(&sys->area, cfg);
> if (CommonWindowInit(vd, &sys->area, &sys->sys,
> - vd->source.projection_mode !=
> PROJECTION_MODE_RECTANGULAR))
> + vd->source->projection_mode !=
> PROJECTION_MODE_RECTANGULAR))
> goto error;
>
> - if (vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR)
> + if (vd->source->projection_mode != PROJECTION_MODE_RECTANGULAR)
> sys->p_sensors = HookWindowsSensors(vd, sys->sys.hvideownd);
>
> vout_window_SetTitle(cfg->window, VOUT_TITLE " (OpenGL output)");
> @@ -217,7 +217,7 @@ static void Prepare(vout_display_t *vd, picture_t
> *picture, subpicture_t *subpic
> else if (place_cfg.align.vertical == VLC_VIDEO_ALIGN_BOTTOM)
> place_cfg.align.vertical = VLC_VIDEO_ALIGN_TOP;
>
> - vout_display_PlacePicture(&place, &vd->source, &place_cfg);
> + vout_display_PlacePicture(&place, vd->source, &place_cfg);
>
> const int width = place.width;
> const int height = place.height;
> diff --git a/modules/video_output/win32/wingdi.c
> b/modules/video_output/win32/wingdi.c
> index 3d09d84fa2a..c1e39dc9f9d 100644
> --- a/modules/video_output/win32/wingdi.c
> +++ b/modules/video_output/win32/wingdi.c
> @@ -109,7 +109,7 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> {
> vout_display_sys_t *sys;
>
> - if ( !vd->obj.force && vd->source.projection_mode !=
> PROJECTION_MODE_RECTANGULAR)
> + if ( !vd->obj.force && vd->source->projection_mode !=
> PROJECTION_MODE_RECTANGULAR)
> return VLC_EGENERIC; /* let a module who can handle it do it */
>
> vd->sys = sys = calloc(1, sizeof(*sys));
> @@ -170,22 +170,22 @@ static void Display(vout_display_t *vd, picture_t
> *picture)
>
> SelectObject(sys->off_dc, sys->off_bitmap);
>
> - if (sys->area.place.width != vd->source.i_visible_width ||
> - sys->area.place.height != vd->source.i_visible_height) {
> + if (sys->area.place.width != vd->source->i_visible_width ||
> + sys->area.place.height != vd->source->i_visible_height) {
> SetStretchBltMode(hdc, COLORONCOLOR);
>
> StretchBlt(hdc, sys->area.place.x, sys->area.place.y,
> sys->area.place.width, sys->area.place.height,
> sys->off_dc,
> - vd->source.i_x_offset, vd->source.i_y_offset,
> - vd->source.i_x_offset + vd->source.i_visible_width,
> - vd->source.i_y_offset + vd->source.i_visible_height,
> + vd->source->i_x_offset, vd->source->i_y_offset,
> + vd->source->i_x_offset + vd->source->i_visible_width,
> + vd->source->i_y_offset + vd->source->i_visible_height,
> SRCCOPY);
> } else {
> BitBlt(hdc, sys->area.place.x, sys->area.place.y,
> sys->area.place.width, sys->area.place.height,
> sys->off_dc,
> - vd->source.i_x_offset, vd->source.i_y_offset,
> + vd->source->i_x_offset, vd->source->i_y_offset,
> SRCCOPY);
> }
>
> diff --git a/modules/video_output/xcb/render.c
> b/modules/video_output/xcb/render.c
> index c3e71933f35..16197f65db5 100644
> --- a/modules/video_output/xcb/render.c
> +++ b/modules/video_output/xcb/render.c
> @@ -183,7 +183,7 @@ static void RenderRegion(vout_display_t *vd, const
> subpicture_t *subpic,
> static void Prepare(vout_display_t *vd, picture_t *pic, subpicture_t
> *subpic,
> vlc_tick_t date)
> {
> - const video_format_t *fmt = &vd->source;
> + const video_format_t *fmt = vd->source;
> vout_display_sys_t *sys = vd->sys;
> xcb_connection_t *conn = sys->conn;
>
> @@ -267,7 +267,7 @@ static void Display(vout_display_t *vd, picture_t *pic)
>
> static void CreateBuffers(vout_display_t *vd, const vout_display_cfg_t *cfg)
> {
> - const video_format_t *fmt = &vd->source;
> + const video_format_t *fmt = vd->source;
> vout_display_sys_t *sys = vd->sys;
> xcb_connection_t *conn = sys->conn;
>
> @@ -671,7 +671,7 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> xcb_create_colormap(conn, XCB_COLORMAP_ALLOC_NONE, cmap,
> screen->root,
> visual);
> xcb_create_pixmap(conn, 32, sys->drawable.source, screen->root,
> - vd->source.i_width, vd->source.i_height);
> + 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,
> 0, 0, cfg->display.width, cfg->display.height, 0,
> diff --git a/modules/video_output/xcb/x11.c
> b/modules/video_output/xcb/x11.c
> index 05e012f3897..c18831615df 100644
> --- a/modules/video_output/xcb/x11.c
> +++ b/modules/video_output/xcb/x11.c
> @@ -150,7 +150,7 @@ static int Control(vout_display_t *vd, int query,
> va_list ap)
> vout_display_place_t place;
> int ret = VLC_SUCCESS;
>
> - vout_display_PlacePicture(&place, &vd->source, cfg);
> + vout_display_PlacePicture(&place, vd->source, cfg);
>
> uint32_t mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y;
> const uint32_t values[] = {
> @@ -167,7 +167,7 @@ static int Control(vout_display_t *vd, int query,
> va_list ap)
> /* Move the picture within the window */
> xcb_configure_window(sys->conn, sys->window, mask, values);
>
> - video_format_ApplyRotation(&src, &vd->source);
> + video_format_ApplyRotation(&src, vd->source);
> fmt->i_width = src.i_width * place.width / src.i_visible_width;
> fmt->i_height = src.i_height * place.height / src.i_visible_height;
>
> @@ -313,7 +313,7 @@ static int Open (vout_display_t *vd, const
> vout_display_cfg_t *cfg,
> };
> vout_display_place_t place;
>
> - vout_display_PlacePicture(&place, &vd->source, cfg);
> + vout_display_PlacePicture(&place, vd->source, cfg);
> sys->window = xcb_generate_id (conn);
> sys->gc = xcb_generate_id (conn);
>
> diff --git a/modules/video_output/yuv.c b/modules/video_output/yuv.c
> index c20b93d133b..6667a63fe05 100644
> --- a/modules/video_output/yuv.c
> +++ b/modules/video_output/yuv.c
> @@ -177,15 +177,15 @@ static void Display(vout_display_t *vd, picture_t
> *picture)
> /* */
> video_format_t fmt = vd->fmt;
>
> - if (ORIENT_IS_SWAP(vd->source.orientation))
> + if (ORIENT_IS_SWAP(vd->source->orientation))
> {
> - fmt.i_sar_num = vd->source.i_sar_den;
> - fmt.i_sar_den = vd->source.i_sar_num;
> + fmt.i_sar_num = vd->source->i_sar_den;
> + fmt.i_sar_den = vd->source->i_sar_num;
> }
> else
> {
> - fmt.i_sar_num = vd->source.i_sar_num;
> - fmt.i_sar_den = vd->source.i_sar_den;
> + fmt.i_sar_num = vd->source->i_sar_num;
> + fmt.i_sar_den = vd->source->i_sar_den;
> }
>
> /* */
> diff --git a/src/video_output/display.c b/src/video_output/display.c
> index 85a84ddba2d..a394ad30e27 100644
> --- a/src/video_output/display.c
> +++ b/src/video_output/display.c
> @@ -208,7 +208,7 @@ void
> vout_display_TranslateMouseState(vout_display_t *vd, vlc_mouse_t *video,
> vout_display_place_t place;
>
> /* Translate window coordinates to video coordinates */
> - vout_display_PlacePicture(&place, &vd->source, vd->cfg);
> + vout_display_PlacePicture(&place, vd->source, vd->cfg);
>
> if (place.width <= 0 || place.height <= 0) {
> memset(video, 0, sizeof (*video));
> @@ -218,7 +218,7 @@ void
> vout_display_TranslateMouseState(vout_display_t *vd, vlc_mouse_t *video,
> const int wx = window->i_x, wy = window->i_y;
> int x, y;
>
> - switch (vd->source.orientation) {
> + switch (vd->source->orientation) {
> case ORIENT_TOP_LEFT:
> x = wx;
> y = wy;
> @@ -255,10 +255,10 @@ void
> vout_display_TranslateMouseState(vout_display_t *vd, vlc_mouse_t *video,
> vlc_assert_unreachable();
> }
>
> - video->i_x = vd->source.i_x_offset
> - + (int64_t)(x - place.x) * vd->source.i_visible_width /
> place.width;
> - video->i_y = vd->source.i_y_offset
> - + (int64_t)(y - place.y) * vd->source.i_visible_height /
> place.height;
> + video->i_x = vd->source->i_x_offset
> + + (int64_t)(x - place.x) * vd->source->i_visible_width /
> place.width;
> + video->i_y = vd->source->i_y_offset
> + + (int64_t)(y - place.y) * vd->source->i_visible_height /
> place.height;
> video->i_pressed = window->i_pressed;
> video->b_double_click = window->b_double_click;
> }
> @@ -297,7 +297,7 @@ static int vout_display_start(void *func, bool
> forced, va_list ap)
> vlc_video_context *context = osys->src_vctx;
>
> /* Picture buffer does not have the concept of aspect ratio */
> - video_format_Copy(&vd->fmt, &vd->source);
> + video_format_Copy(&vd->fmt, vd->source);
> vd->fmt.i_sar_num = 0;
> vd->fmt.i_sar_den = 0;
> vd->obj.force = forced; /* TODO: pass to activate() instead? */
> @@ -334,7 +334,7 @@ static int VoutDisplayCreateRender(vout_display_t *vd)
> if (unlikely(osys->converters == NULL))
> return -1;
>
> - video_format_t v_src = vd->source;
> + video_format_t v_src = osys->source;
> v_src.i_sar_num = 0;
> v_src.i_sar_den = 0;
>
> @@ -477,16 +477,14 @@ static void vout_display_Reset(vout_display_t *vd)
> static int vout_UpdateSourceCrop(vout_display_t *vd)
> {
> vout_display_priv_t *osys = container_of(vd, vout_display_priv_t, display);
> + video_format_t fmt = osys->source;
> unsigned crop_num = osys->crop.num;
> unsigned crop_den = osys->crop.den;
>
> if (crop_num != 0 && crop_den != 0) {
> - video_format_t fmt = osys->source;
> - fmt.i_sar_num = vd->source.i_sar_num;
> - fmt.i_sar_den = vd->source.i_sar_den;
> VoutDisplayCropRatio(&osys->crop.left, &osys->crop.top,
> &osys->crop.right, &osys->crop.bottom,
> - &fmt, crop_num, crop_den);
> + &osys->source, crop_num, crop_den);
> }
>
> const int right_max = osys->source.i_x_offset
> @@ -511,12 +509,12 @@ static int vout_UpdateSourceCrop(vout_display_t *vd)
> bottom = (int)osys->source.i_y_offset + osys->crop.bottom;
> bottom = VLC_CLIP(bottom, top + 1, bottom_max);
>
> - vd->source.i_x_offset = left;
> - vd->source.i_y_offset = top;
> - vd->source.i_visible_width = right - left;
> - vd->source.i_visible_height = bottom - top;
> - video_format_Print(VLC_OBJECT(vd), "SOURCE ", &osys->source);
> - video_format_Print(VLC_OBJECT(vd), "CROPPED", &vd->source);
> + osys->source.i_x_offset = left;
> + osys->source.i_y_offset = top;
> + osys->source.i_visible_width = right - left;
> + osys->source.i_visible_height = bottom - top;
> + video_format_Print(VLC_OBJECT(vd), "SOURCE ", &fmt);
> + video_format_Print(VLC_OBJECT(vd), "CROPPED ", &osys->source);
>
> int ret = vout_display_Control(vd, VOUT_DISPLAY_CHANGE_SOURCE_CROP,
> &osys->cfg);
> @@ -539,11 +537,11 @@ static int vout_SetSourceAspect(vout_display_t *vd,
> int ret = 0;
>
> if (sar_num > 0 && sar_den > 0) {
> - vd->source.i_sar_num = sar_num;
> - vd->source.i_sar_den = sar_den;
> + osys->source.i_sar_num = sar_num;
> + osys->source.i_sar_den = sar_den;
> } else {
> - vd->source.i_sar_num = osys->source.i_sar_num;
> - vd->source.i_sar_den = osys->source.i_sar_den;
> + osys->source.i_sar_num = osys->source.i_sar_num;
> + osys->source.i_sar_den = osys->source.i_sar_den;
> }
>
> if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_SOURCE_ASPECT,
> @@ -725,7 +723,7 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
>
> osys->pool = NULL;
>
> - osys->source = *source;
> + video_format_Copy(&osys->source, source);
> osys->crop.left = 0;
> osys->crop.top = 0;
> osys->crop.right = 0;
> @@ -738,7 +736,7 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
>
> /* */
> vout_display_t *vd = &osys->display;
> - video_format_Copy(&vd->source, source);
> + vd->source = &osys->source;
> vd->owner = &osys->display_owner;
> vd->info = (vout_display_info_t){ };
> vd->cfg = &osys->cfg;
> @@ -773,7 +771,7 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
> }
> return vd;
> error:
> - video_format_Clean(&vd->source);
> + video_format_Clean(&osys->source);
> vlc_object_delete(vd);
> return NULL;
> }
> @@ -798,7 +796,7 @@ void vout_display_Delete(vout_display_t *vd)
> vd->close(vd);
> vlc_objres_clear(VLC_OBJECT(vd));
>
> - video_format_Clean(&vd->source);
> + video_format_Clean(&osys->source);
> video_format_Clean(&vd->fmt);
> vlc_object_delete(vd);
> }
> diff --git a/src/video_output/video_output.c
> b/src/video_output/video_output.c
> index b973712735f..1f2e3243887 100644
> --- a/src/video_output/video_output.c
> +++ b/src/video_output/video_output.c
> @@ -1270,20 +1270,20 @@ static int
> ThreadDisplayRenderPicture(vout_thread_sys_t *vout, bool is_forced)
> vd->info.subpicture_chromas &&
> *vd->info.subpicture_chromas != 0;
>
> - //FIXME: Denying do_early_spu if vd->source.orientation != ORIENT_NORMAL
> + //FIXME: Denying do_early_spu if vd->source->orientation != ORIENT_NORMAL
> //will have the effect that snapshots miss the subpictures. We do this
> //because there is currently no way to transform subpictures to match
> //the source format.
> const bool do_early_spu = !do_dr_spu &&
> - vd->source.orientation == ORIENT_NORMAL;
> + vd->source->orientation == ORIENT_NORMAL;
>
> const vlc_fourcc_t *subpicture_chromas;
> video_format_t fmt_spu;
> if (do_dr_spu) {
> vout_display_place_t place;
> - vout_display_PlacePicture(&place, &vd->source, vd->cfg);
> + vout_display_PlacePicture(&place, vd->source, vd->cfg);
>
> - fmt_spu = vd->source;
> + fmt_spu = *vd->source;
> if (fmt_spu.i_width * fmt_spu.i_height < place.width *
> place.height) {
> fmt_spu.i_sar_num = vd->cfg->display.sar.num;
> fmt_spu.i_sar_den = vd->cfg->display.sar.den;
> @@ -1295,7 +1295,7 @@ static int
> ThreadDisplayRenderPicture(vout_thread_sys_t *vout, bool is_forced)
> subpicture_chromas = vd->info.subpicture_chromas;
> } else {
> if (do_early_spu) {
> - fmt_spu = vd->source;
> + fmt_spu = *vd->source;
> } else {
> fmt_spu = vd->fmt;
> fmt_spu.i_sar_num = vd->cfg->display.sar.num;
> @@ -1322,7 +1322,7 @@ static int
> ThreadDisplayRenderPicture(vout_thread_sys_t *vout, bool is_forced)
> subpicture_t *subpic = !sys->spu ? NULL :
> spu_Render(sys->spu,
> subpicture_chromas, &fmt_spu_rot,
> - &vd->source, system_now,
> + vd->source, system_now,
> render_subtitle_date,
> do_snapshot,
> vd->info.can_scale_spu);
> /*
> @@ -1368,7 +1368,7 @@ static int
> ThreadDisplayRenderPicture(vout_thread_sys_t *vout, bool is_forced)
> if (do_snapshot)
> {
> assert(snap_pic);
> - vout_snapshot_Set(sys->snapshot, &vd->source, snap_pic);
> + vout_snapshot_Set(sys->snapshot, vd->source, snap_pic);
> if (snap_pic != todisplay)
> picture_Release(snap_pic);
> }
> diff --git a/src/video_output/vout_wrapper.c
> b/src/video_output/vout_wrapper.c
> index 6445f99b7a2..78c6ec8f27a 100644
> --- a/src/video_output/vout_wrapper.c
> +++ b/src/video_output/vout_wrapper.c
> @@ -102,7 +102,7 @@ vout_display_t *vout_OpenWrapper(vout_thread_t
> *vout, vout_thread_private_t *sys
> sys->private_pool = picture_pool_Reserve(display_pool,
> private_picture);
> } else {
> sys->private_pool =
> - picture_pool_NewFromFormat(&vd->source,
> + picture_pool_NewFromFormat(vd->source,
> __MAX(VOUT_MAX_PICTURES,
> reserved_picture -
> DISPLAY_PICTURE_COUNT));
> }
> --
> 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