Browse Source

vlc_vout_display: replace the CHANGE_DISPLAY_SIZE by an operations callback

And pass the immutable dimensions explicitly.
pull/182/head
Steve Lhomme 2 years ago
parent
commit
79107e7646
  1. 23
      include/vlc_vout_display.h
  2. 8
      modules/hw/mmal/vout.c
  3. 28
      modules/video_output/android/display.c
  4. 1
      modules/video_output/apple/VLCSampleBufferDisplay.m
  5. 1
      modules/video_output/caca.c
  6. 3
      modules/video_output/caopengllayer.m
  7. 1
      modules/video_output/decklink.cpp
  8. 1
      modules/video_output/drm/display.c
  9. 1
      modules/video_output/flaschen.c
  10. 19
      modules/video_output/kva.c
  11. 20
      modules/video_output/libplacebo/display.c
  12. 6
      modules/video_output/macosx.m
  13. 15
      modules/video_output/opengl/display.c
  14. 1
      modules/video_output/splitter.c
  15. 1
      modules/video_output/vdummy.c
  16. 1
      modules/video_output/vmem.c
  17. 8
      modules/video_output/wayland/shm.c
  18. 60
      modules/video_output/win32/direct3d11.cpp
  19. 12
      modules/video_output/win32/direct3d9.c
  20. 12
      modules/video_output/win32/glwin32.c
  21. 13
      modules/video_output/win32/wingdi.c
  22. 14
      modules/video_output/xcb/render.c
  23. 28
      modules/video_output/xcb/x11.c
  24. 1
      modules/video_output/yuv.c
  25. 3
      src/video_output/display.c

23
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

8
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,
};

28
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,
};

1
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:

1
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;

3
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:

1
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:

1
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:

1
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:

19
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:
{

20
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,13 +519,10 @@ 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;
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
@ -532,8 +531,8 @@ static int Control(vout_display_t *vd, int query)
* 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;
int width = (int) width_;
int height = (int) height_;
if (vlc_placebo_MakeCurrent(sys->pl) != VLC_SUCCESS)
return VLC_SUCCESS; // ignore errors
@ -543,12 +542,17 @@ static int Control(vout_display_t *vd, int query)
/* 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)
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_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:

6
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:

15
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:

1
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:

1
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:

1
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:

8
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,
};

60
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

12
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,
};

12
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,

13
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,
};

14
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,
};

28
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,
};

1
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:

3
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;

Loading…
Cancel
Save