[vlc-commits] [Git][videolan/vlc][master] 2 commits: vlc_vout_display: replace the CHANGE_DISPLAY_SIZE by an operations callback
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Jun 12 11:32:44 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
79107e76 by Steve Lhomme at 2025-06-11T13:21:07+02:00
vlc_vout_display: replace the CHANGE_DISPLAY_SIZE by an operations callback
And pass the immutable dimensions explicitly.
- - - - -
c107a43e by Steve Lhomme at 2025-06-11T13:21:07+02:00
libplacebo: fix indentation
- - - - -
25 changed files:
- include/vlc_vout_display.h
- modules/hw/mmal/vout.c
- modules/video_output/android/display.c
- modules/video_output/apple/VLCSampleBufferDisplay.m
- modules/video_output/caca.c
- modules/video_output/caopengllayer.m
- modules/video_output/decklink.cpp
- modules/video_output/drm/display.c
- modules/video_output/flaschen.c
- modules/video_output/kva.c
- modules/video_output/libplacebo/display.c
- modules/video_output/macosx.m
- modules/video_output/opengl/display.c
- modules/video_output/splitter.c
- modules/video_output/vdummy.c
- modules/video_output/vmem.c
- modules/video_output/wayland/shm.c
- modules/video_output/win32/direct3d11.cpp
- modules/video_output/win32/direct3d9.c
- modules/video_output/win32/glwin32.c
- modules/video_output/win32/wingdi.c
- modules/video_output/xcb/render.c
- modules/video_output/xcb/x11.c
- modules/video_output/yuv.c
- src/video_output/display.c
Changes:
=====================================
include/vlc_vout_display.h
=====================================
@@ -142,15 +142,6 @@ typedef struct {
* Control query for vout_display_t
*/
enum vout_display_query {
- /**
- * Notifies a change in display size.
- *
- * \retval VLC_SUCCESS if the display handled the change
- * \retval VLC_EGENERIC if a \ref vlc_display_operations::reset_pictures
- * request is necessary
- */
- VOUT_DISPLAY_CHANGE_DISPLAY_SIZE,
-
/**
* Notifies a change of the sample aspect ratio.
*
@@ -277,6 +268,17 @@ struct vlc_display_operations
*/
void (*display)(vout_display_t *, picture_t *pic);
+ /**
+ * Let the display module know the display size has changed.
+ *
+ * \return VLC_SUCCESS if the size is accepted.
+ * \return an error if the size is not accepted and
+ * \ref vlc_display_operations::reset_pictures "reset_pictures" needs to be called.
+ *
+ * When the callback is NULL, it is considered as returning VLC_SUCCESS.
+ */
+ int (*set_display_size)(vout_display_t *, unsigned width, unsigned height);
+
/**
* Performs a control request (mandatory).
*
@@ -288,8 +290,7 @@ struct vlc_display_operations
/**
* Reset the picture format handled by the module.
- * This occurs after a
- * \ref VOUT_DISPLAY_CHANGE_DISPLAY_SIZE,
+ * This occurs after an error in \ref vlc_display_operations::set_display_size,
* \ref VOUT_DISPLAY_CHANGE_SOURCE_ASPECT,
* \ref VOUT_DISPLAY_CHANGE_SOURCE_CROP or
* \ref VOUT_DISPLAY_CHANGE_SOURCE_PLACE
=====================================
modules/hw/mmal/vout.c
=====================================
@@ -536,6 +536,12 @@ static int configure_display(vout_display_t *vd)
return VLC_SUCCESS;
}
+static int SetDisplaySize(vout_display_t *vd, unsigned width, unsigned height)
+{
+ VLC_UNUSED(width); VLC_UNUSED(height);
+ return configure_display(vd);
+}
+
static void vd_display(vout_display_t *vd, picture_t *p_pic)
{
vout_display_sys_t * const sys = vd->sys;
@@ -642,7 +648,6 @@ static int vd_reset_pictures(vout_display_t *vd, video_format_t *fmt)
static int vd_control(vout_display_t *vd, int query)
{
switch (query) {
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
@@ -980,6 +985,7 @@ static const struct vlc_display_operations ops = {
.close = CloseMmalVout,
.prepare = vd_prepare,
.display = vd_display,
+ .set_display_size = SetDisplaySize,
.control = vd_control,
.reset_pictures = vd_reset_pictures,
};
=====================================
modules/video_output/android/display.c
=====================================
@@ -67,6 +67,14 @@ struct sys
struct subpicture sub;
};
+static void subpicture_SetDisplaySize(vout_display_t *vd, unsigned width, unsigned height)
+{
+ struct sys *sys = vd->sys;
+ struct subpicture *sub = &sys->sub;
+ vlc_gl_Resize(sub->gl, width, height);
+ sub->place_changed = true;
+}
+
static int subpicture_Control(vout_display_t *vd, int query)
{
struct sys *sys = vd->sys;
@@ -74,9 +82,6 @@ static int subpicture_Control(vout_display_t *vd, int query)
switch (query)
{
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
- vlc_gl_Resize(sub->gl, vd->cfg->display.width, vd->cfg->display.height);
- // fallthrough
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
{
sub->place_changed = true;
@@ -392,6 +397,16 @@ static void SetVideoLayout(vout_display_t *vd)
rot_fmt.i_sar_num, rot_fmt.i_sar_den);
}
+static int SetDisplaySize(vout_display_t *vd, unsigned width, unsigned height)
+{
+ struct sys *sys = vd->sys;
+ if (sys->sub.window != NULL)
+ subpicture_SetDisplaySize(vd, width, height);
+
+ msg_Dbg(vd, "change display size: %dx%d", width, height);
+ return VLC_SUCCESS;
+}
+
static int Control(vout_display_t *vd, int query)
{
struct sys *sys = vd->sys;
@@ -413,12 +428,6 @@ static int Control(vout_display_t *vd, int query)
SetVideoLayout(vd);
return VLC_SUCCESS;
}
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
- {
- msg_Dbg(vd, "change display size: %dx%d", vd->cfg->display.width,
- vd->cfg->display.height);
- return VLC_SUCCESS;
- }
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
return VLC_SUCCESS;
default:
@@ -502,6 +511,7 @@ static int Open(vout_display_t *vd,
.close = Close,
.prepare = Prepare,
.display = Display,
+ .set_display_size = SetDisplaySize,
.control = Control,
.set_viewpoint = NULL,
};
=====================================
modules/video_output/apple/VLCSampleBufferDisplay.m
=====================================
@@ -1053,7 +1053,6 @@ static int Control (vout_display_t *vd, int query)
switch (query)
{
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
=====================================
modules/video_output/caca.c
=====================================
@@ -199,7 +199,6 @@ static int Control(vout_display_t *vd, int query)
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
sys->update_dither = true;
return VLC_SUCCESS;
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
return VLC_SUCCESS;
=====================================
modules/video_output/caopengllayer.m
=====================================
@@ -405,9 +405,6 @@ static int Control (vout_display_t *vd, int query)
switch (query)
{
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
- return VLC_SUCCESS;
-
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
=====================================
modules/video_output/decklink.cpp
=====================================
@@ -764,7 +764,6 @@ static int ControlVideo(vout_display_t *vd, int query)
(void) vd;
switch (query) {
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
=====================================
modules/video_output/drm/display.c
=====================================
@@ -76,7 +76,6 @@ static int Control(vout_display_t *vd, int query)
(void) vd;
switch (query) {
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
=====================================
modules/video_output/flaschen.c
=====================================
@@ -232,7 +232,6 @@ static void Display(vout_display_t *vd, picture_t *picture)
static int Control(vout_display_t *vd, int query)
{
switch (query) {
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
=====================================
modules/video_output/kva.c
=====================================
@@ -109,6 +109,7 @@ typedef struct vout_display_sys_t
*****************************************************************************/
static void Display(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int);
+static int SetDisplaySize( vout_display_t *, unsigned width, unsigned height )
static int OpenDisplay ( vout_display_t *, video_format_t * );
static void CloseDisplay( vout_display_t * );
@@ -158,6 +159,7 @@ static const struct vlc_display_operations ops = {
.close = Close,
.prepare = Prepare,
.display = Display,
+ .set_display_size = SetDisplaySize,
.control = Control,
};
@@ -389,6 +391,15 @@ static void Display( vout_display_t *vd, picture_t *picture )
WinPostMsg( sys->client, WM_VLC_MANAGE, 0, 0 );
}
+static int SetDisplaySize( vout_display_t *vd, unsigned width, unsigned height )
+{
+ vout_display_sys_t *sys = vd->sys;
+ WinPostMsg( sys->client, WM_VLC_SIZE_CHANGE,
+ MPFROMLONG( width ),
+ MPFROMLONG( height ));
+ return VLC_SUCCESS;
+}
+
/*****************************************************************************
* Control: control facility for the vout
*****************************************************************************/
@@ -398,14 +409,6 @@ static int Control( vout_display_t *vd, int query )
switch (query)
{
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
- {
- WinPostMsg( sys->client, WM_VLC_SIZE_CHANGE,
- MPFROMLONG( vd->cfg->display.width ),
- MPFROMLONG( vd->cfg->display.height ));
- return VLC_SUCCESS;
- }
-
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
{
=====================================
modules/video_output/libplacebo/display.c
=====================================
@@ -82,6 +82,7 @@ typedef struct vout_display_sys_t
static void PictureRender(vout_display_t *, picture_t *, const vlc_render_subpicture *, vlc_tick_t);
static void PictureDisplay(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int);
+static int SetDisplaySize(vout_display_t *, unsigned width, unsigned height);
static void Close(vout_display_t *);
static void UpdateParams(vout_display_t *);
static void UpdateColorspaceHint(vout_display_t *, const video_format_t *);
@@ -91,6 +92,7 @@ static const struct vlc_display_operations ops = {
.close = Close,
.prepare = PictureRender,
.display = PictureDisplay,
+ .set_display_size = SetDisplaySize,
.control = Control,
.set_icc_profile = UpdateIccProfile,
};
@@ -517,38 +519,38 @@ static void UpdateIccProfile(vout_display_t *vd, const vlc_icc_profile_t *prof)
(void) prof; /* we get the current value from vout_display_cfg_t */
}
-static int Control(vout_display_t *vd, int query)
+static int SetDisplaySize(vout_display_t *vd, unsigned width_, unsigned height_)
{
vout_display_sys_t *sys = vd->sys;
+ /* The following resize should be automatic on most platforms but can
+ * trigger bugs on some platform with some drivers, that have been seen
+ * on Windows in particular. Doing it right now enforces the correct
+ * behavior and prevents these bugs.
+ * In addition, platforms like Wayland need the call as the size of the
+ * window is defined by the size of the content, and not the opposite.
+ * The swapchain creation won't be done twice with this call. */
+ int width = (int) width_;
+ int height = (int) height_;
+ if (vlc_placebo_MakeCurrent(sys->pl) != VLC_SUCCESS)
+ return VLC_SUCCESS; // ignore errors
+
+ pl_swapchain_resize(sys->pl->swapchain, &width, &height);
+ vlc_placebo_ReleaseCurrent(sys->pl);
+
+ /* NOTE: We currently ignore resizing failures that are transient
+ * on X11. Maybe improving resizing might fix that, but we don't
+ * implement reset_pictures anyway.
+ if (width != (int) width_ || height != (int) height_)
+ return VLC_EGENERIC;
+ */
+ return VLC_SUCCESS;
+}
+
+static int Control(vout_display_t *vd, int query)
+{
switch (query)
{
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
- /* The following resize should be automatic on most platforms but can
- * trigger bugs on some platform with some drivers, that have been seen
- * on Windows in particular. Doing it right now enforces the correct
- * behavior and prevents these bugs.
- * In addition, platforms like Wayland need the call as the size of the
- * window is defined by the size of the content, and not the opposite.
- * The swapchain creation won't be done twice with this call. */
- {
- int width = (int) vd->cfg->display.width;
- int height = (int) vd->cfg->display.height;
- if (vlc_placebo_MakeCurrent(sys->pl) != VLC_SUCCESS)
- return VLC_SUCCESS; // ignore errors
-
- pl_swapchain_resize(sys->pl->swapchain, &width, &height);
- vlc_placebo_ReleaseCurrent(sys->pl);
-
- /* NOTE: We currently ignore resizing failures that are transient
- * on X11. Maybe improving resizing might fix that, but we don't
- * implement reset_pictures anyway.
- if (width != (int) vd->cfg->display.width
- || height != (int) vd->cfg->display.height)
- return VLC_EGENERIC;
- */
- }
- return VLC_SUCCESS;
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
=====================================
modules/video_output/macosx.m
=====================================
@@ -135,7 +135,7 @@ static int SetViewpoint(vout_display_t *vd, const vlc_viewpoint_t *vp)
}
static const struct vlc_display_operations ops = {
- Close, PictureRender, PictureDisplay, Control, NULL, SetViewpoint, NULL,
+ Close, PictureRender, PictureDisplay, NULL, Control, NULL, SetViewpoint, NULL,
};
static int Open (vout_display_t *vd,
@@ -348,10 +348,6 @@ static int Control (vout_display_t *vd, int query)
@autoreleasepool {
switch (query)
{
- /* We handle the resizing ourselves, nothing to report either. */
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
- return VLC_SUCCESS;
-
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
=====================================
modules/video_output/opengl/display.c
=====================================
@@ -163,6 +163,15 @@ static void PlacePicture(vout_display_t *vd, vout_display_place_t *place,
assert(sys->gl->orientation != ORIENT_NORMAL || place->y == (int)(vd->cfg->display.height - (vd->place->y + vd->place->height)));
}
+static int SetDisplaySize(vout_display_t *vd, unsigned width, unsigned height)
+{
+ vout_display_sys_t *sys = vd->sys;
+
+ PlacePicture(vd, &sys->place, vd->cfg->display);
+ vlc_gl_Resize (sys->gl, width, height);
+ return VLC_SUCCESS;
+}
+
static int ChangeSourceProjection(vout_display_t *vd, video_projection_mode_t projection)
{
vout_display_sys_t *sys = vd->sys;
@@ -184,6 +193,7 @@ static const struct vlc_display_operations ops = {
.close = Close,
.prepare = PictureRender,
.display = PictureDisplay,
+ .set_display_size = SetDisplaySize,
.control = Control,
.set_viewpoint = SetViewpoint,
.update_format = UpdateFormat,
@@ -356,11 +366,6 @@ static int Control (vout_display_t *vd, int query)
switch (query)
{
-
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
- PlacePicture(vd, &sys->place, vd->cfg->display);
- 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:
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
=====================================
modules/video_output/splitter.c
=====================================
@@ -101,7 +101,6 @@ static int vlc_vidsplit_Control(vout_display_t *vd, int query)
(void) vd;
switch (query) {
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
=====================================
modules/video_output/vdummy.c
=====================================
@@ -138,7 +138,6 @@ static int Control(vout_display_t *vd, int query)
(void) vd;
switch (query) {
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
=====================================
modules/video_output/vmem.c
=====================================
@@ -251,7 +251,6 @@ static int Control(vout_display_t *vd, int query)
(void) vd;
switch (query) {
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
=====================================
modules/video_output/wayland/shm.c
=====================================
@@ -192,13 +192,18 @@ static int UpdateViewport(vout_display_t *vd)
return VLC_SUCCESS;
}
+static int SetDisplaySize(vout_display_t *vd, unsigned width, unsigned height)
+{
+ VLC_UNUSED(width); VLC_UNUSED(height);
+ return UpdateViewport(vd);
+}
+
static int Control(vout_display_t *vd, int query)
{
vout_display_sys_t *sys = vd->sys;
switch (query)
{
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
@@ -259,6 +264,7 @@ static const struct vlc_display_operations ops = {
.close = Close,
.prepare = Prepare,
.display = Display,
+ .set_display_size = SetDisplaySize,
.control = Control,
.reset_pictures = ResetPictures,
};
=====================================
modules/video_output/win32/direct3d11.cpp
=====================================
@@ -197,7 +197,7 @@ static void Direct3D11DeleteRegions(int, picture_t **);
static int Direct3D11MapSubpicture(vout_display_t *, int *, picture_t ***, const vlc_render_subpicture *);
static int Control(vout_display_t *, int);
-
+static int SetDisplaySize(vout_display_t *, unsigned width, unsigned height);
static int UpdateDisplayFormat(vout_display_t *vd, const video_format_t *fmt)
{
@@ -525,11 +525,12 @@ static int ChangeSourceProjection(vout_display_t *vd, video_projection_mode_t pr
return Direct3D11CreateFormatResources(vd, vd->source);
}
-static const auto ops = []{
+static constexpr const auto ops = []{
struct vlc_display_operations ops {};
ops.close = Close;
ops.prepare = Prepare;
ops.display = Display;
+ ops.set_display_size = SetDisplaySize;
ops.control = Control;
ops.set_viewpoint = SetViewpoint;
ops.change_source_projection = ChangeSourceProjection;
@@ -672,6 +673,56 @@ static void Close(vout_display_t *vd)
Direct3D11Close(vd);
delete sys;
}
+
+static int SetDisplaySize(vout_display_t *vd, unsigned width, unsigned height)
+{
+ vout_display_sys_t *sys = static_cast<vout_display_sys_t *>(vd->sys);
+
+ bool use_scaler = false;
+ if (sys->upscaleMode == upscale_VideoProcessor || sys->upscaleMode == upscale_SuperResolution)
+ {
+ D3D11_UpscalerUpdate(VLC_OBJECT(vd), sys->scaleProc, sys->d3d_dev,
+ vd->source, &sys->picQuad.quad_fmt,
+ width, height,
+ vd->place);
+
+ if (sys->scaleProc && D3D11_UpscalerUsed(sys->scaleProc))
+ {
+ D3D11_UpscalerGetSize(sys->scaleProc, &sys->picQuad.quad_fmt.i_width, &sys->picQuad.quad_fmt.i_height);
+
+ sys->picQuad.quad_fmt.i_x_offset = 0;
+ sys->picQuad.quad_fmt.i_y_offset = 0;
+ sys->picQuad.quad_fmt.i_visible_width = sys->picQuad.quad_fmt.i_width;
+ sys->picQuad.quad_fmt.i_visible_height = sys->picQuad.quad_fmt.i_height;
+
+ sys->picQuad.generic.i_width = sys->picQuad.quad_fmt.i_width;
+ sys->picQuad.generic.i_height = sys->picQuad.quad_fmt.i_height;
+
+ use_scaler = true;
+ }
+ }
+
+ if (!use_scaler)
+ {
+ sys->picQuad.quad_fmt.i_sar_num = vd->source->i_sar_num;
+ sys->picQuad.quad_fmt.i_sar_den = vd->source->i_sar_den;
+ sys->picQuad.quad_fmt.i_x_offset = vd->source->i_x_offset;
+ sys->picQuad.quad_fmt.i_y_offset = vd->source->i_y_offset;
+ sys->picQuad.quad_fmt.i_visible_width = vd->source->i_visible_width;
+ sys->picQuad.quad_fmt.i_visible_height = vd->source->i_visible_height;
+ }
+
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+ CommonDisplaySizeChanged(sys->video_wnd);
+#endif /* WINAPI_PARTITION_DESKTOP */
+
+ if ( sys->place_changed )
+ {
+ UpdateSize(vd);
+ }
+ return VLC_SUCCESS;
+}
+
static int Control(vout_display_t *vd, int query)
{
vout_display_sys_t *sys = static_cast<vout_display_sys_t *>(vd->sys);
@@ -711,11 +762,6 @@ static int Control(vout_display_t *vd, int query)
}
switch (query) {
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- CommonDisplaySizeChanged(sys->video_wnd);
-#endif /* WINAPI_PARTITION_DESKTOP */
- break;
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
sys->place_changed = true;
// fallthrough
=====================================
modules/video_output/win32/direct3d9.c
=====================================
@@ -1647,13 +1647,18 @@ static void Direct3D9Close(vout_display_t *vd)
Direct3D9DestroyResources(vd);
}
+static int SetDisplaySize(vout_display_t *vd, unsigned width, unsigned height)
+{
+ VLC_UNUSED(width); VLC_UNUSED(height);
+ vout_display_sys_t *sys = vd->sys;
+ CommonDisplaySizeChanged(sys->video_wnd);
+ return VLC_SUCCESS;
+}
+
static int Control(vout_display_t *vd, int query)
{
vout_display_sys_t *sys = vd->sys;
switch (query) {
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
- CommonDisplaySizeChanged(sys->video_wnd);
- break;
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
sys->place_changed = true;
break;
@@ -1734,6 +1739,7 @@ static const struct vlc_display_operations ops = {
.close = Close,
.prepare = Prepare,
.display = Display,
+ .set_display_size = SetDisplaySize,
.control = Control,
};
=====================================
modules/video_output/win32/glwin32.c
=====================================
@@ -83,13 +83,18 @@ static int SetViewpoint(vout_display_t *vd, const vlc_viewpoint_t *vp)
return VLC_SUCCESS;
}
+static int SetDisplaySize(vout_display_t *vd, unsigned width, unsigned height)
+{
+ VLC_UNUSED(width); VLC_UNUSED(height);
+ vout_display_sys_t *sys = vd->sys;
+ CommonDisplaySizeChanged(sys->video_wnd);
+ return VLC_SUCCESS;
+}
+
static int Control(vout_display_t *vd, int query)
{
vout_display_sys_t *sys = vd->sys;
switch (query) {
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
- CommonDisplaySizeChanged(sys->video_wnd);
- break;
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
sys->place_changed = true;
break;
@@ -148,6 +153,7 @@ static const struct vlc_display_operations ops = {
.close = Close,
.prepare = Prepare,
.display = Display,
+ .set_display_size = SetDisplaySize,
.control = Control,
.set_viewpoint = SetViewpoint,
.update_format = UpdateFormat,
=====================================
modules/video_output/win32/wingdi.c
=====================================
@@ -154,14 +154,18 @@ static void Prepare(vout_display_t *vd, picture_t *picture,
plane_CopyPixels(&sys->pic_buf, picture->p);
}
+static int SetDisplaySize(vout_display_t *vd, unsigned width, unsigned height)
+{
+ VLC_UNUSED(width); VLC_UNUSED(height);
+ vout_display_sys_t *sys = vd->sys;
+ CommonDisplaySizeChanged(sys->video_wnd);
+ return VLC_SUCCESS;
+}
+
static int Control(vout_display_t *vd, int query)
{
vout_display_sys_t *sys = vd->sys;
switch (query) {
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
- CommonDisplaySizeChanged(sys->video_wnd);
- sys->size_changed = true;
- break;
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
sys->place_changed = true;
break;
@@ -176,6 +180,7 @@ static const struct vlc_display_operations ops = {
.close = Close,
.prepare = Prepare,
.display = Display,
+ .set_display_size = SetDisplaySize,
.control = Control,
};
=====================================
modules/video_output/xcb/render.c
=====================================
@@ -391,10 +391,20 @@ static int UpdateOutput(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
+ DeleteBuffers(vd);
+ CreateBuffers(vd);
+ xcb_flush(sys->conn);
+ return VLC_SUCCESS;
+}
+
+static int SetDisplaySize(vout_display_t *vd, unsigned width, unsigned height)
+{
+ vout_display_sys_t *sys = vd->sys;
+
/* Update the window size */
uint32_t mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
const uint32_t values[] = {
- vd->cfg->display.width, vd->cfg->display.height
+ width, height
};
xcb_configure_window(sys->conn, sys->drawable.dest, mask, values);
@@ -409,7 +419,6 @@ static int Control(vout_display_t *vd, int query)
vout_display_sys_t *sys = vd->sys;
switch (query) {
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
@@ -594,6 +603,7 @@ static const struct vlc_display_operations ops = {
.close = Close,
.prepare = Prepare,
.display = Display,
+ .set_display_size = SetDisplaySize,
.control = Control,
};
=====================================
modules/video_output/xcb/x11.c
=====================================
@@ -210,15 +210,6 @@ static int Control(vout_display_t *vd, int query)
vout_display_sys_t *sys = vd->sys;
switch (query) {
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE: {
- uint32_t mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
- const uint32_t values[] = {
- vd->cfg->display.width, vd->cfg->display.height,
- };
-
- xcb_configure_window(sys->conn, sys->window, mask, values);
- }
- /* fall through */
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
@@ -236,6 +227,24 @@ static int Control(vout_display_t *vd, int query)
}
}
+static int SetDisplaySize(vout_display_t *vd, unsigned width, unsigned height)
+{
+ vout_display_sys_t *sys = vd->sys;
+
+ uint32_t mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
+ const uint32_t values[] = {
+ width, height,
+ };
+
+ xcb_configure_window(sys->conn, sys->window, mask, values);
+
+ if (vd->place->width != sys->fmt.i_visible_width ||
+ vd->place->height != sys->fmt.i_visible_height)
+ return VLC_EGENERIC;
+
+ return VLC_SUCCESS;
+}
+
/**
* Disconnect from the X server.
*/
@@ -299,6 +308,7 @@ static const struct vlc_display_operations ops = {
.close = Close,
.prepare = Prepare,
.display = Display,
+ .set_display_size = SetDisplaySize,
.control = Control,
.reset_pictures = ResetPictures,
};
=====================================
modules/video_output/yuv.c
=====================================
@@ -252,7 +252,6 @@ static int Control(vout_display_t *vd, int query)
(void) vd;
switch (query) {
- case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
=====================================
src/video_output/display.c
=====================================
@@ -612,7 +612,8 @@ void vout_display_SetSize(vout_display_t *vd, unsigned width, unsigned height)
bool place_changed = PlaceVideoInDisplay(osys);
- err2 = vout_display_Control(vd, VOUT_DISPLAY_CHANGE_DISPLAY_SIZE);
+ err2 = vd->ops->set_display_size == NULL ? VLC_SUCCESS :
+ vd->ops->set_display_size(vd, vd->cfg->display.width, vd->cfg->display.height);
if (err2 != VLC_SUCCESS)
err1 = err2;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/52ed25426cf7307d046a4ca696ca58572dae9fa9...c107a43e0f282d0f5cb89f702cb837e9263d617c
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/52ed25426cf7307d046a4ca696ca58572dae9fa9...c107a43e0f282d0f5cb89f702cb837e9263d617c
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list