[vlc-commits] [Git][videolan/vlc][master] 22 commits: direct3d11: use a common function to update the video placement
Steve Lhomme (@robUx4)
gitlab at videolan.org
Wed Apr 1 09:38:56 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
198caf25 by Steve Lhomme at 2026-04-01T09:14:08+00:00
direct3d11: use a common function to update the video placement
- - - - -
1f48a4c1 by Steve Lhomme at 2026-04-01T09:14:08+00:00
macosx: use functions to handle VOUT_DISPLAY_CHANGE controls
Then we can switch to callbacks.
- - - - -
421f0384 by Steve Lhomme at 2026-04-01T09:14:08+00:00
kva: use functions to handle VOUT_DISPLAY_CHANGE controls
Then we can switch to callbacks.
- - - - -
13966eed by Steve Lhomme at 2026-04-01T09:14:08+00:00
caopengllayer: use functions to handle VOUT_DISPLAY_CHANGE controls
Then we can switch to callbacks.
- - - - -
43771f43 by Steve Lhomme at 2026-04-01T09:14:08+00:00
caca: use functions to handle VOUT_DISPLAY_CHANGE controls
Then we can switch to callbacks.
- - - - -
dd614bf4 by Steve Lhomme at 2026-04-01T09:14:08+00:00
x11: use functions to handle VOUT_DISPLAY_CHANGE controls
Then we can switch to callbacks.
- - - - -
ab7594dc by Steve Lhomme at 2026-04-01T09:14:08+00:00
xcb/render: use functions to handle VOUT_DISPLAY_CHANGE controls
Then we can switch to callbacks.
- - - - -
8ef3cc80 by Steve Lhomme at 2026-04-01T09:14:08+00:00
wayland/shm: use functions to handle VOUT_DISPLAY_CHANGE controls
Then we can switch to callbacks.
- - - - -
d0eb7fb4 by Steve Lhomme at 2026-04-01T09:14:08+00:00
opengl: use functions to handle VOUT_DISPLAY_CHANGE controls
Then we can switch to callbacks.
- - - - -
238eadc6 by Steve Lhomme at 2026-04-01T09:14:08+00:00
android/display: use functions to handle VOUT_DISPLAY_CHANGE controls
Then we can switch to callbacks.
- - - - -
6622bf47 by Steve Lhomme at 2026-04-01T09:14:08+00:00
mmal/vout: use functions to handle VOUT_DISPLAY_CHANGE controls
Then we can switch to callbacks.
- - - - -
a8e939e1 by Steve Lhomme at 2026-04-01T09:14:08+00:00
wingdi: use functions to handle VOUT_DISPLAY_CHANGE controls
Then we can switch to callbacks.
- - - - -
c34c85cd by Steve Lhomme at 2026-04-01T09:14:08+00:00
glwin32: use functions to handle VOUT_DISPLAY_CHANGE controls
Then we can switch to callbacks.
- - - - -
d8e807d7 by Steve Lhomme at 2026-04-01T09:14:08+00:00
direct3d9: use functions to handle VOUT_DISPLAY_CHANGE controls
Then we can switch to callbacks.
- - - - -
668f2f51 by Steve Lhomme at 2026-04-01T09:14:08+00:00
direct3d11: use functions to handle VOUT_DISPLAY_CHANGE controls
Then we can switch to callbacks.
- - - - -
1db3f8c1 by Steve Lhomme at 2026-04-01T09:14:08+00:00
vout: add default in control switch/case
This will make it easier to remove controls gradually.
No functional changes.
- - - - -
8e355178 by Steve Lhomme at 2026-04-01T09:14:08+00:00
vlc_vout_display: replace the CHANGE_SOURCE_PLACE by an operations callback
- - - - -
fd02dba6 by Steve Lhomme at 2026-04-01T09:14:08+00:00
video_output: replace VOUT_DISPLAY_CHANGE_SOURCE_ASPECT with a callback
It may be NULL.
- - - - -
9c76ee9a by Steve Lhomme at 2026-04-01T09:14:08+00:00
video_output: replace VOUT_DISPLAY_CHANGE_SOURCE_CROP with a callback
It may be NULL.
- - - - -
eb26b239 by Steve Lhomme at 2026-04-01T09:14:08+00:00
vlc_vout_display: remove unused vout_display_query enum
- - - - -
301d3b6d by Steve Lhomme at 2026-04-01T09:14:08+00:00
video_output: remove unused control callback
- - - - -
1d4eec21 by Steve Lhomme at 2026-04-01T09:14:08+00:00
video_output: factorize implementation when aspect/crop code matches placement code
It's easier to tell which implementation has (subtle) differences.
- - - - -
27 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
- test/src/input/decoder/input_decoder.c
- test/src/video_output/video_output.c
Changes:
=====================================
include/vlc_vout_display.h
=====================================
@@ -138,41 +138,6 @@ typedef struct {
const vlc_fourcc_t *subpicture_chromas; /* List of supported chromas for subpicture rendering. */
} vout_display_info_t;
-/**
- * Control query for vout_display_t
- */
-enum vout_display_query {
- /**
- * Notifies a change of the sample aspect ratio.
- *
- * \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_SOURCE_ASPECT,
-
- /**
- * Notifies a change of the source cropping.
- *
- * The cropping requested is stored by source \ref video_format_t `i_x`/`y_offset`
- * and `i_visible_width`/`height`
- *
- * \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_SOURCE_CROP,
-
- /**
- * Notified when the source placement in the display has changed
- *
- * \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_SOURCE_PLACE,
-};
-
/**
* Vout owner structures
*/
@@ -215,6 +180,8 @@ typedef int (*vout_display_open_cb)(vout_display_t *vd,
} \
set_capability( "vout display", priority )
+struct vout_display_place_t;
+
struct vlc_display_operations
{
/**
@@ -279,22 +246,13 @@ struct vlc_display_operations
*/
int (*set_display_size)(vout_display_t *, unsigned width, unsigned height);
- /**
- * Performs a control request (mandatory).
- *
- * \param query request type
- *
- * See \ref vout_display_query for the list of request types.
- */
- int (*control)(vout_display_t *, int query);
-
/**
* Reset the picture format handled by the module.
* 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
- * control query returns an error.
+ * \ref vlc_display_operations::set_source_aspect,
+ * \ref vlc_display_operations::set_source_crop or
+ * \ref vlc_display_operations::video_place_changed
+ * calls returns an error.
*
* \param ftmp video format that the module expects as input
*/
@@ -351,6 +309,50 @@ struct vlc_display_operations
* \retval VLC_EGENERIC if the display handled the change was not handled
*/
int (*set_stereo)(vout_display_t *, vlc_stereoscopic_mode_t);
+
+ /**
+ * Let the display module know the placement of the video in the display changed.
+ *
+ * May be NULL.
+ *
+ * This is always called from the same thread as prepare/display.
+ *
+ * \return VLC_SUCCESS if the placement change is accepted.
+ * \return an error if the placement 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 (*video_place_changed)(vout_display_t *, const struct vout_display_place_t *);
+
+ /**
+ * Notifies a change of the sample aspect ratio.
+ *
+ * May be NULL.
+ *
+ * \return VLC_SUCCESS on success, another value on error
+ * \return VLC_EGENERIC if a \ref vlc_display_operations::reset_pictures
+ * request is necessary
+ *
+ * When the callback is NULL, it is considered as returning VLC_SUCCESS.
+ */
+ int (*set_source_aspect)(vout_display_t *, const video_format_t *);
+
+ /**
+ * Notifies a change of the video crop values.
+ *
+ * The cropping requested is stored by source \ref video_format_t `i_x`/`y_offset`
+ * and `i_visible_width`/`height`
+ *
+ * May be NULL.
+ *
+ * \return VLC_SUCCESS on success, another value on error
+ * \return VLC_EGENERIC if a \ref vlc_display_operations::reset_pictures
+ * request is necessary
+ *
+ * When the callback is NULL, it is considered as returning VLC_SUCCESS.
+ */
+ int (*set_source_crop)(vout_display_t *, const video_format_t *);
};
/**
=====================================
modules/hw/mmal/vout.c
=====================================
@@ -645,20 +645,16 @@ static int vd_reset_pictures(vout_display_t *vd, video_format_t *fmt)
return VLC_SUCCESS;
}
-static int vd_control(vout_display_t *vd, int query)
+static int vd_video_place_changed(vout_display_t *vd, const vout_display_place_t *place)
{
- switch (query) {
- case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
- case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
- return configure_display(vd);
-
- default:
- msg_Warn(vd, "Unknown control query %d", query);
- break;
- }
+ VLC_UNUSED(place);
+ return configure_display(vd);
+}
- return VLC_EGENERIC;
+static int vd_aspect_changed(vout_display_t *vd, const video_format_t *source)
+{
+ VLC_UNUSED(source);
+ return vd_video_place_changed(vd, NULL);
}
static int attach_subpics(vout_display_t * const vd, vout_display_sys_t * const sys,
@@ -986,8 +982,10 @@ static const struct vlc_display_operations ops = {
.prepare = vd_prepare,
.display = vd_display,
.set_display_size = SetDisplaySize,
- .control = vd_control,
.reset_pictures = vd_reset_pictures,
+ .video_place_changed = vd_video_place_changed,
+ .set_source_aspect = vd_aspect_changed,
+ .set_source_crop = vd_aspect_changed,
};
static int OpenMmalVout(vout_display_t *vd,
=====================================
modules/video_output/android/display.c
=====================================
@@ -144,6 +144,16 @@ static void subpicture_SetDisplaySize(vout_display_t *vd, unsigned width, unsign
sub->place_changed = true;
}
+static int subpicture_PlacementChanged(vout_display_t *vd, const vout_display_place_t *place)
+{
+ struct sys *sys = vd->sys;
+ struct subpicture *sub = &sys->sub;
+ VLC_UNUSED(place);
+
+ sub->place_changed = true;
+ return VLC_SUCCESS;
+}
+
static int subpicture_Control(vout_display_t *vd, int query)
{
struct sys *sys = vd->sys;
@@ -151,15 +161,6 @@ static int subpicture_Control(vout_display_t *vd, int query)
switch (query)
{
- case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
- {
- sub->place_changed = true;
- return VLC_SUCCESS;
- }
-
- case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
- return VLC_SUCCESS;
default:
break;
}
@@ -588,39 +589,35 @@ static int SetDisplaySize(vout_display_t *vd, unsigned width, unsigned height)
return VLC_SUCCESS;
}
-static int Control(vout_display_t *vd, int query)
+static int PlacementChanged(vout_display_t *vd, const vout_display_place_t *place)
{
struct sys *sys = vd->sys;
+ msg_Dbg(vd, "change source place: %dx%d @ %ux%u",
+ place->x, place->y,
+ place->width, place->height);
if (sys->sub.window != NULL)
- subpicture_Control(vd, query);
+ subpicture_PlacementChanged(vd, place);
- switch (query) {
- case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
- case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
- {
- if (query == VOUT_DISPLAY_CHANGE_SOURCE_PLACE)
- msg_Dbg(vd, "change source place: %dx%d @ %ux%u",
- vd->place->x, vd->place->y,
- vd->place->width, vd->place->height);
- else
- msg_Dbg(vd, "change source crop: %ux%u @ %ux%u aspect: %u/%u",
- vd->source->i_x_offset, vd->source->i_y_offset,
- vd->source->i_visible_width,
- vd->source->i_visible_height,
- vd->source->i_sar_num,
- vd->source->i_sar_den);
- if (sys->asc.sc != NULL)
- UpdateASCGeometry(vd);
- else
- SetVideoLayout(vd);
- return VLC_SUCCESS;
- }
- default:
- msg_Warn(vd, "Unknown request in android-display: %d", query);
- return VLC_EGENERIC;
- }
+ if (sys->asc.sc != NULL)
+ UpdateASCGeometry(vd);
+ else
+ SetVideoLayout(vd);
+ return VLC_SUCCESS;
+}
+
+static int AspectChanged(vout_display_t *vd, const video_format_t *source)
+{
+ struct sys *sys = vd->sys;
+ msg_Dbg(vd, "change source crop: %ux%u @ %ux%u aspect: %u/%u",
+ source->i_x_offset, source->i_y_offset,
+ source->i_visible_width, source->i_visible_height,
+ source->i_sar_num, source->i_sar_den);
+ if (sys->asc.sc != NULL)
+ UpdateASCGeometry(vd);
+ else
+ SetVideoLayout(vd);
+ return VLC_SUCCESS;
}
static void Close(vout_display_t *vd)
@@ -769,7 +766,9 @@ static int Open(vout_display_t *vd,
.prepare = PrepareWithASC,
.display = DisplayWithASC,
.set_display_size = SetDisplaySize,
- .control = Control,
+ .video_place_changed = PlacementChanged,
+ .set_source_aspect = AspectChanged,
+ .set_source_crop = AspectChanged,
};
vd->ops = &ops;
}
@@ -780,7 +779,9 @@ static int Open(vout_display_t *vd,
.prepare = Prepare,
.display = Display,
.set_display_size = SetDisplaySize,
- .control = Control,
+ .video_place_changed = PlacementChanged,
+ .set_source_aspect = AspectChanged,
+ .set_source_crop = AspectChanged,
};
vd->ops = &ops;
}
=====================================
modules/video_output/apple/VLCSampleBufferDisplay.m
=====================================
@@ -1045,25 +1045,6 @@ static void Display(vout_display_t *vd, picture_t *pic)
// kept as the core is not properly pacing the calls to Prepare without this callback
}
-static int Control (vout_display_t *vd, int query)
-{
- VLCSampleBufferDisplay *sys;
- sys = (__bridge VLCSampleBufferDisplay*)vd->sys;
-
- switch (query)
- {
- case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
- case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
- break;
- default:
- msg_Err (vd, "Unhandled request %d", query);
- return VLC_EGENERIC;
- }
-
- return VLC_SUCCESS;
-}
-
static pip_controller_t * CreatePipController( vout_display_t *vd, void *cbs_opaque )
{
pip_controller_t *pip_controller = vlc_object_create(vd, sizeof(pip_controller_t));
@@ -1154,7 +1135,6 @@ static int Open (vout_display_t *vd,
.close = Close,
.prepare = Prepare,
.display = Display,
- .control = Control,
.update_format = UpdateFormat,
};
=====================================
modules/video_output/caca.c
=====================================
@@ -187,25 +187,18 @@ static void PictureDisplay(vout_display_t *vd, picture_t *picture)
VLC_UNUSED(picture);
}
-/**
- * Control for vout display
- */
-static int Control(vout_display_t *vd, int query)
+static int PlacementChanged(vout_display_t *vd, const vout_display_place_t *place)
{
vout_display_sys_t *sys = vd->sys;
+ VLC_UNUSED(place);
+ sys->update_dither = true;
+ return VLC_SUCCESS;
+}
- switch (query) {
- case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
- case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
- sys->update_dither = true;
- return VLC_SUCCESS;
- case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- return VLC_SUCCESS;
-
- default:
- msg_Err(vd, "Unsupported query in vout display caca");
- return VLC_EGENERIC;
- }
+static int CropChanged(vout_display_t *vd, const video_format_t *source)
+{
+ VLC_UNUSED(source);
+ return PlacementChanged(vd, NULL);
}
/* */
@@ -389,7 +382,8 @@ static const struct vlc_display_operations ops = {
.close = Close,
.prepare = Prepare,
.display = PictureDisplay,
- .control = Control,
+ .video_place_changed = PlacementChanged,
+ .set_source_crop = CropChanged,
};
/**
=====================================
modules/video_output/caopengllayer.m
=====================================
@@ -393,48 +393,66 @@ static void PictureDisplay (vout_display_t *vd, picture_t *pic)
[layer displayFromVout];
}
-static int Control (vout_display_t *vd, int query)
+static int PlacementChanged(vout_display_t *vd, const vout_display_place_t *place)
{
vout_display_sys_t *sys = vd->sys;
+ VLC_UNUSED(place);
- if (!vd->sys)
+ if (!sys)
return VLC_EGENERIC;
VLCVideoLayerView *view = (__bridge VLCVideoLayerView *)sys->gl->sys;
VLCCAOpenGLLayer *layer = (VLCCAOpenGLLayer *)[view layer];
- switch (query)
+ @synchronized(layer)
{
- case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
- case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
- {
- @synchronized(layer)
- {
- vout_display_cfg_t cfg = *vd->cfg;
- cfg.display.width = sys->cfg.display.width;
- cfg.display.height = sys->cfg.display.height;
+ vout_display_cfg_t cfg = *vd->cfg;
+ cfg.display.width = sys->cfg.display.width;
+ cfg.display.height = sys->cfg.display.height;
- sys->cfg = cfg;
+ sys->cfg = cfg;
- vout_display_PlacePicture(&sys->place, vd->source, &cfg.display);
- // Reverse vertical alignment as the GL tex are Y inverted
- sys->place.y = cfg.display.height - (sys->place.y + sys->place.height);
- }
+ vout_display_PlacePicture(&sys->place, vd->source, &cfg.display);
+ // Reverse vertical alignment as the GL tex are Y inverted
+ sys->place.y = cfg.display.height - (sys->place.y + sys->place.height);
+ }
- // Note!
- // No viewport or aspect ratio is set here, as that needs to be set
- // when rendering. The viewport is always set to match the layer
- // size by the OS right before the OpenGL render callback, so
- // setting it here has no effect.
- return VLC_SUCCESS;
- }
+ // Note!
+ // No viewport or aspect ratio is set here, as that needs to be set
+ // when rendering. The viewport is always set to match the layer
+ // size by the OS right before the OpenGL render callback, so
+ // setting it here has no effect.
+ return VLC_SUCCESS;
+}
- default:
- msg_Err (vd, "Unhandled request %d", query);
- return VLC_EGENERIC;
+static int AspectChanged(vout_display_t *vd, const video_format_t *source)
+{
+ vout_display_sys_t *sys = vd->sys;
+
+ if (!sys)
+ return VLC_EGENERIC;
+
+ VLCVideoLayerView *view = (__bridge VLCVideoLayerView *)sys->gl->sys;
+ VLCCAOpenGLLayer *layer = (VLCCAOpenGLLayer *)[view layer];
+
+ @synchronized(layer)
+ {
+ vout_display_cfg_t cfg = *vd->cfg;
+ cfg.display.width = sys->cfg.display.width;
+ cfg.display.height = sys->cfg.display.height;
+
+ sys->cfg = cfg;
+
+ vout_display_PlacePicture(&sys->place, source, &cfg.display);
+ // Reverse vertical alignment as the GL tex are Y inverted
+ sys->place.y = cfg.display.height - (sys->place.y + sys->place.height);
}
+ // Note!
+ // No viewport or aspect ratio is set here, as that needs to be set
+ // when rendering. The viewport is always set to match the layer
+ // size by the OS right before the OpenGL render callback, so
+ // setting it here has no effect.
return VLC_SUCCESS;
}
@@ -554,9 +572,11 @@ static int Open (vout_display_t *vd,
.close = Close,
.prepare = PictureRender,
.display = PictureDisplay,
- .control = Control,
.set_viewpoint = SetViewpoint,
.change_source_projection = ChangeSourceProjection,
+ .video_place_changed = PlacementChanged,
+ .set_source_aspect = AspectChanged,
+ .set_source_crop = AspectChanged,
};
vd->ops = &ops;
=====================================
modules/video_output/decklink.cpp
=====================================
@@ -759,24 +759,10 @@ end:
pDLVideoFrame->Release();
}
-static int ControlVideo(vout_display_t *vd, int query)
-{
- (void) vd;
-
- switch (query) {
- case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
- case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
- return VLC_SUCCESS;
- }
- return VLC_EGENERIC;
-}
-
static const auto ops = []{
struct vlc_display_operations ops {};
ops.close = CloseVideo;
ops.prepare = PrepareVideo;
- ops.control = ControlVideo;
return ops;
}();
=====================================
modules/video_output/drm/display.c
=====================================
@@ -71,19 +71,6 @@ typedef struct vout_display_sys_t {
uint32_t plane_id;
} vout_display_sys_t;
-static int Control(vout_display_t *vd, int query)
-{
- (void) vd;
-
- switch (query) {
- case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
- case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
- return VLC_SUCCESS;
- }
- return VLC_EGENERIC;
-}
-
static void Prepare(vout_display_t *vd, picture_t *pic,
const struct vlc_render_subpicture *subpic,
vlc_tick_t date)
@@ -142,7 +129,6 @@ static const struct vlc_display_operations ops = {
.close = Close,
.prepare = Prepare,
.display = Display,
- .control = Control,
};
/**
=====================================
modules/video_output/flaschen.c
=====================================
@@ -90,12 +90,10 @@ typedef struct vout_display_sys_t {
int fd;
} vout_display_sys_t;
static void Display(vout_display_t *, picture_t *);
-static int Control(vout_display_t *, int);
static const struct vlc_display_operations ops = {
.close = Close,
.display = Display,
- .control = Control,
};
/*****************************************************************************
@@ -225,20 +223,3 @@ static void Display(vout_display_t *vd, picture_t *picture)
msg_Err(vd, "sendmsg only sent %d bytes in vout display flaschen", result);
/* we might want to drop some frames? */
}
-
-/**
- * Control for vout display
- */
-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:
- return VLC_SUCCESS;
-
- default:
- msg_Err(vd, "Unsupported query in vout display flaschen");
- return VLC_EGENERIC;
- }
-}
=====================================
modules/video_output/kva.c
=====================================
@@ -108,7 +108,6 @@ typedef struct vout_display_sys_t
* Local prototypes
*****************************************************************************/
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 * );
@@ -155,12 +154,45 @@ static void Prepare(vout_display_t *vd, picture_t *pic,
}
}
+static int PlacementChanged(vout_display_t *vd, const vout_display_place_t *place)
+{
+ vout_display_sys_t *sys = vd->sys;
+ sys->kvas.ulAspectWidth = place->width;
+ sys->kvas.ulAspectHeight = place->height;
+ kvaSetup( &sys->kvas );
+ return VLC_SUCCESS;
+}
+
+static int AspectChanged(vout_display_t *vd, const video_format_t *source)
+{
+ VLC_UNUSED(source);
+ return PlacementChanged(vd, vd->place);
+}
+
+static int CropChanged(vout_display_t *vd, const video_format_t *source)
+{
+ vout_display_sys_t *sys = vd->sys;
+ video_format_t src_rot;
+ video_format_ApplyRotation(&src_rot, source);
+
+ sys->kvas.rclSrcRect.xLeft = src_rot.i_x_offset;
+ sys->kvas.rclSrcRect.yTop = src_rot.i_y_offset;
+ sys->kvas.rclSrcRect.xRight = src_rot.i_x_offset +
+ src_rot.i_visible_width;
+ sys->kvas.rclSrcRect.yBottom = src_rot.i_y_offset +
+ src_rot.i_visible_height;
+ kvaSetup( &sys->kvas );
+ return VLC_SUCCESS;
+}
+
static const struct vlc_display_operations ops = {
.close = Close,
.prepare = Prepare,
.display = Display,
.set_display_size = SetDisplaySize,
- .control = Control,
+ .video_place_changed = PlacementChanged,
+ .set_source_aspect = AspectChanged,
+ .set_source_crop = CropChanged,
};
static void PMThread( void *arg )
@@ -400,44 +432,6 @@ static int SetDisplaySize( vout_display_t *vd, unsigned width, unsigned height )
return VLC_SUCCESS;
}
-/*****************************************************************************
- * Control: control facility for the vout
- *****************************************************************************/
-static int Control( vout_display_t *vd, int query )
-{
- vout_display_sys_t *sys = vd->sys;
-
- switch (query)
- {
- case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
- {
- sys->kvas.ulAspectWidth = vd->place->width;
- sys->kvas.ulAspectHeight = vd->place->height;
- kvaSetup( &sys->kvas );
- return VLC_SUCCESS;
- }
-
- case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
- {
- video_format_t src_rot;
- 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;
- sys->kvas.rclSrcRect.xRight = src_rot.i_x_offset +
- src_rot.i_visible_width;
- sys->kvas.rclSrcRect.yBottom = src_rot.i_y_offset +
- src_rot.i_visible_height;
- kvaSetup( &sys->kvas );
- return VLC_SUCCESS;
- }
- }
-
- msg_Err(vd, "Unsupported query(=%d) in vout display KVA", query);
- return VLC_EGENERIC;
-}
-
/* following functions are local */
/*****************************************************************************
=====================================
modules/video_output/libplacebo/display.c
=====================================
@@ -81,7 +81,6 @@ typedef struct vout_display_sys_t
// Display callbacks
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 *);
@@ -93,7 +92,6 @@ static const struct vlc_display_operations ops = {
.prepare = PictureRender,
.display = PictureDisplay,
.set_display_size = SetDisplaySize,
- .control = Control,
.set_icc_profile = UpdateIccProfile,
};
@@ -547,22 +545,6 @@ static int SetDisplaySize(vout_display_t *vd, unsigned width_, unsigned height_)
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:
- return VLC_SUCCESS;
-
- default:
- msg_Err (vd, "Unknown request %d", query);
- }
-
- return VLC_EGENERIC;
-}
-
static void LoadCustomLUT(vout_display_sys_t *sys, const char *filepath)
{
if (!filepath || !*filepath) {
=====================================
modules/video_output/macosx.m
=====================================
@@ -59,7 +59,7 @@ static void Close(vout_display_t *vd);
static void PictureRender (vout_display_t *vd, picture_t *pic, const vlc_render_subpicture *subpicture,
vlc_tick_t date);
static void PictureDisplay (vout_display_t *vd, picture_t *pic);
-static int Control (vout_display_t *vd, int query);
+static void UpdatePlace (vout_display_t *vd, const vout_display_cfg_t *cfg);
static void *OurGetProcAddress(vlc_gl_t *, const char *);
@@ -134,12 +134,43 @@ static int SetViewpoint(vout_display_t *vd, const vlc_viewpoint_t *vp)
return vout_display_opengl_SetViewpoint (sys->vgl, vp);
}
+static int PlacementChanged(vout_display_t *vd, const vout_display_place_t *place)
+{
+ vout_display_sys_t *sys = vd->sys;
+ VLC_UNUSED(place);
+
+ if (!sys)
+ return VLC_EGENERIC;
+
+ @autoreleasepool {
+ @synchronized(sys->glView) {
+ vout_display_cfg_t cfg;
+ cfg = *vd->cfg;
+ cfg.display.width = sys->cfg.display.width;
+ cfg.display.height = sys->cfg.display.height;
+ sys->cfg = cfg;
+ UpdatePlace(vd, &cfg);
+ }
+ return VLC_SUCCESS;
+ }
+}
+
+static int AspectChanged(vout_display_t *vd, const video_format_t *source)
+{
+ vout_display_sys_t *sys = vd->sys;
+ VLC_UNUSED(source);
+
+ return PlacementChanged(vd, NULL);
+}
+
static const struct vlc_display_operations ops = {
.close = Close,
.prepare = PictureRender,
.display = PictureDisplay,
- .control = Control,
.set_viewpoint = SetViewpoint,
+ .video_place_changed = PlacementChanged,
+ .set_source_aspect = AspectChanged,
+ .set_source_crop = AspectChanged,
};
static int Open (vout_display_t *vd,
@@ -342,38 +373,6 @@ static void UpdatePlace (vout_display_t *vd, const vout_display_cfg_t *cfg)
sys->place = place;
}
-static int Control (vout_display_t *vd, int query)
-{
- vout_display_sys_t *sys = vd->sys;
-
- if (!vd->sys)
- return VLC_EGENERIC;
-
- @autoreleasepool {
- switch (query)
- {
- case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
- case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
- {
- @synchronized(sys->glView) {
- vout_display_cfg_t cfg;
- cfg = *vd->cfg;
- cfg.display.width = sys->cfg.display.width;
- cfg.display.height = sys->cfg.display.height;
- sys->cfg = cfg;
- UpdatePlace(vd, &cfg);
- }
- return VLC_SUCCESS;
- }
-
- default:
- msg_Err (vd, "Unknown request in Mac OS X vout display");
- return VLC_EGENERIC;
- }
- }
-}
-
/*****************************************************************************
* vout opengl callbacks
*****************************************************************************/
=====================================
modules/video_output/opengl/display.c
=====================================
@@ -94,7 +94,6 @@ typedef struct vout_display_sys_t
/* Display callbacks */
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 SetViewpoint(vout_display_t *vd, const vlc_viewpoint_t *vp)
{
@@ -190,16 +189,33 @@ static int SetStereoMode(vout_display_t *vd, vlc_stereoscopic_mode_t mode)
return VLC_SUCCESS;
}
+static int PlacementChanged(vout_display_t *vd, const vout_display_place_t *place)
+{
+ vout_display_sys_t *sys = vd->sys;
+ VLC_UNUSED(place);
+
+ PlacePicture(vd, &sys->place, vd->cfg->display);
+ return VLC_SUCCESS;
+}
+
+static int AspectChanged(vout_display_t *vd, const video_format_t *source)
+{
+ VLC_UNUSED(source);
+ return PlacementChanged(vd, NULL);
+}
+
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,
.change_source_projection = ChangeSourceProjection,
.set_stereo = SetStereoMode,
+ .video_place_changed = PlacementChanged,
+ .set_source_aspect = AspectChanged,
+ .set_source_crop = AspectChanged,
};
/**
@@ -360,21 +376,3 @@ static void PictureDisplay (vout_display_t *vd, picture_t *pic)
if (sys->is_dirty)
vlc_gl_Swap(sys->gl);
}
-
-static int Control (vout_display_t *vd, int query)
-{
- vout_display_sys_t *sys = vd->sys;
-
- switch (query)
- {
- case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
- case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
- PlacePicture(vd, &sys->place, vd->cfg->display);
- return VLC_SUCCESS;
-
- default:
- msg_Err (vd, "Unknown request %d", query);
- }
- return VLC_EGENERIC;
-}
=====================================
modules/video_output/splitter.c
=====================================
@@ -96,19 +96,6 @@ static void vlc_vidsplit_Display(vout_display_t *vd, picture_t *picture)
(void) picture;
}
-static int vlc_vidsplit_Control(vout_display_t *vd, int query)
-{
- (void) vd;
-
- switch (query) {
- case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
- case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
- return VLC_SUCCESS;
- }
- return VLC_EGENERIC;
-}
-
static void vlc_vidsplit_Close(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
@@ -228,7 +215,6 @@ static const struct vlc_display_operations ops = {
.close = vlc_vidsplit_Close,
.prepare = vlc_vidsplit_Prepare,
.display = vlc_vidsplit_Display,
- .control = vlc_vidsplit_Control,
};
static int vlc_vidsplit_Open(vout_display_t *vd,
=====================================
modules/video_output/vdummy.c
=====================================
@@ -92,7 +92,6 @@ static void Display(vout_display_t *vd, picture_t *picture)
static const struct vlc_display_operations ops_dummy = {
.display = Display,
- .control = Control,
};
static int OpenDummy(vout_display_t *vd,
@@ -106,7 +105,6 @@ static int OpenDummy(vout_display_t *vd,
static const struct vlc_display_operations ops_stats = {
.display = DisplayStat,
- .control = Control,
};
static int OpenStats(vout_display_t *vd,
@@ -132,16 +130,3 @@ static void DisplayStat(vout_display_t *vd, picture_t *picture)
MS_FROM_VLC_TICK(vlc_tick_now() - date));
}
}
-
-static int Control(vout_display_t *vd, int query)
-{
- (void) vd;
-
- switch (query) {
- case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
- case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
- return VLC_SUCCESS;
- }
- return VLC_SUCCESS;
-}
=====================================
modules/video_output/vmem.c
=====================================
@@ -99,13 +99,11 @@ typedef unsigned (*vlc_format_cb)(void **, char *, unsigned *, unsigned *,
static void Prepare(vout_display_t *, picture_t *, const struct vlc_render_subpicture *, vlc_tick_t);
static void Display(vout_display_t *, picture_t *);
-static int Control(vout_display_t *, int);
static const struct vlc_display_operations ops = {
.close = Close,
.prepare = Prepare,
.display = Display,
- .control = Control,
};
/*****************************************************************************
@@ -245,16 +243,3 @@ static void Display(vout_display_t *vd, picture_t *pic)
if (sys->display != NULL)
sys->display(sys->opaque, sys->pic_opaque);
}
-
-static int Control(vout_display_t *vd, int query)
-{
- (void) vd;
-
- switch (query) {
- case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
- case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
- return VLC_SUCCESS;
- }
- return VLC_EGENERIC;
-}
=====================================
modules/video_output/wayland/shm.c
=====================================
@@ -198,21 +198,16 @@ static int SetDisplaySize(vout_display_t *vd, unsigned width, unsigned height)
return UpdateViewport(vd);
}
-static int Control(vout_display_t *vd, int query)
+static int PlacementChanged(vout_display_t *vd, const vout_display_place_t *place)
{
- vout_display_sys_t *sys = vd->sys;
+ VLC_UNUSED(place);
+ return UpdateViewport(vd);
+}
- switch (query)
- {
- case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
- case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
- return UpdateViewport(vd);
- default:
- msg_Err(vd, "unknown request %d", query);
- return VLC_EGENERIC;
- }
- return VLC_SUCCESS;
+static int AspectChanged(vout_display_t *vd, const video_format_t *source)
+{
+ VLC_UNUSED(source);
+ return PlacementChanged(vd, NULL);
}
static void shm_format_cb(void *data, struct wl_shm *shm, uint32_t format)
@@ -265,8 +260,10 @@ static const struct vlc_display_operations ops = {
.prepare = Prepare,
.display = Display,
.set_display_size = SetDisplaySize,
- .control = Control,
.reset_pictures = ResetPictures,
+ .video_place_changed = PlacementChanged,
+ .set_source_aspect = AspectChanged,
+ .set_source_crop = AspectChanged,
};
static int Open(vout_display_t *vd,
=====================================
modules/video_output/win32/direct3d11.cpp
=====================================
@@ -196,7 +196,7 @@ static void Direct3D11DestroyResources(vout_display_t *);
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 UpdateSource(vout_display_t *, bool force_placement);
static int SetDisplaySize(vout_display_t *, unsigned width, unsigned height);
static int UpdateDisplayFormat(vout_display_t *vd, const video_format_t *fmt)
@@ -553,16 +553,30 @@ error:
return err;
}
+static int PlacementChanged(vout_display_t *vd, const vout_display_place_t *place)
+{
+ VLC_UNUSED(place);
+ return UpdateSource(vd, true);
+}
+
+static int AspectChanged(vout_display_t *vd, const video_format_t *source)
+{
+ VLC_UNUSED(source);
+ return UpdateSource(vd, false);
+}
+
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.update_format = UpdateFormat;
ops.set_viewpoint = SetViewpoint;
ops.change_source_projection = ChangeSourceProjection;
+ ops.video_place_changed = PlacementChanged;
+ ops.set_source_aspect = AspectChanged;
+ ops.set_source_crop = AspectChanged;
return ops;
}();
@@ -752,7 +766,7 @@ static int SetDisplaySize(vout_display_t *vd, unsigned width, unsigned height)
return VLC_SUCCESS;
}
-static int Control(vout_display_t *vd, int query)
+static int UpdateSource(vout_display_t *vd, bool force_placement)
{
vout_display_sys_t *sys = static_cast<vout_display_sys_t *>(vd->sys);
@@ -790,12 +804,9 @@ static int Control(vout_display_t *vd, int query)
sys->picQuad.quad_fmt.i_visible_height = vd->source->i_visible_height;
}
- switch (query) {
- case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
+ if (force_placement)
sys->place_changed = true;
- // fallthrough
- case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
+
if (use_scaler)
{
vout_display_place_t before_place = sys->scalePlace;
@@ -804,8 +815,6 @@ static int Control(vout_display_t *vd, int query)
sys->scalePlace.width = sys->picQuad.quad_fmt.i_width;
sys->scalePlace.height = sys->picQuad.quad_fmt.i_height;
sys->place_changed |= !vout_display_PlaceEquals(&before_place, &sys->scalePlace);
- break;
- }
}
if ( sys->place_changed )
=====================================
modules/video_output/win32/direct3d9.c
=====================================
@@ -1659,17 +1659,11 @@ static int SetDisplaySize(vout_display_t *vd, unsigned width, unsigned height)
return VLC_SUCCESS;
}
-static int Control(vout_display_t *vd, int query)
+static int PlacementChanged(vout_display_t *vd, const vout_display_place_t *place)
{
vout_display_sys_t *sys = vd->sys;
- switch (query) {
- case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
- sys->place_changed = true;
- break;
- case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
- break;
- }
+ VLC_UNUSED(place);
+ sys->place_changed = true;
return VLC_SUCCESS;
}
@@ -1744,7 +1738,7 @@ static const struct vlc_display_operations ops = {
.prepare = Prepare,
.display = Display,
.set_display_size = SetDisplaySize,
- .control = Control,
+ .video_place_changed = PlacementChanged,
};
/**
=====================================
modules/video_output/win32/glwin32.c
=====================================
@@ -91,17 +91,11 @@ static int SetDisplaySize(vout_display_t *vd, unsigned width, unsigned height)
return VLC_SUCCESS;
}
-static int Control(vout_display_t *vd, int query)
+static int PlacementChanged(vout_display_t *vd, const vout_display_place_t *place)
{
vout_display_sys_t *sys = vd->sys;
- switch (query) {
- case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
- sys->place_changed = true;
- break;
- case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
- break;
- }
+ VLC_UNUSED(place);
+ sys->place_changed = true;
return VLC_SUCCESS;
}
@@ -154,9 +148,9 @@ static const struct vlc_display_operations ops = {
.prepare = Prepare,
.display = Display,
.set_display_size = SetDisplaySize,
- .control = Control,
.set_viewpoint = SetViewpoint,
.update_format = UpdateFormat,
+ .video_place_changed = PlacementChanged,
};
/**
=====================================
modules/video_output/win32/wingdi.c
=====================================
@@ -158,17 +158,11 @@ static int SetDisplaySize(vout_display_t *vd, unsigned width, unsigned height)
return VLC_SUCCESS;
}
-static int Control(vout_display_t *vd, int query)
+static int PlacementChanged(vout_display_t *vd, const vout_display_place_t *place)
{
vout_display_sys_t *sys = vd->sys;
- switch (query) {
- case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
- sys->place_changed = true;
- break;
- case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
- break;
- }
+ VLC_UNUSED(place);
+ sys->place_changed = true;
return VLC_SUCCESS;
}
@@ -177,7 +171,7 @@ static const struct vlc_display_operations ops = {
.prepare = Prepare,
.display = Display,
.set_display_size = SetDisplaySize,
- .control = Control,
+ .video_place_changed = PlacementChanged,
};
/* */
=====================================
modules/video_output/xcb/render.c
=====================================
@@ -415,18 +415,16 @@ static int SetDisplaySize(vout_display_t *vd, unsigned width, unsigned height)
return VLC_SUCCESS;
}
-static int Control(vout_display_t *vd, int query)
+static int PlacementChanged(vout_display_t *vd, const vout_display_place_t *place)
{
- switch (query) {
- case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
- case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
- return UpdateOutput(vd);
-
- default:
- msg_Err(vd, "Unknown request in XCB RENDER display");
- return VLC_EGENERIC;
- }
+ VLC_UNUSED(place);
+ return UpdateOutput(vd);
+}
+
+static int AspectChanged(vout_display_t *vd, const video_format_t *source)
+{
+ VLC_UNUSED(source);
+ return PlacementChanged(vd, NULL);
}
/**
@@ -603,7 +601,9 @@ static const struct vlc_display_operations ops = {
.prepare = Prepare,
.display = Display,
.set_display_size = SetDisplaySize,
- .control = Control,
+ .video_place_changed = PlacementChanged,
+ .set_source_aspect = AspectChanged,
+ .set_source_crop = AspectChanged,
};
/**
=====================================
modules/video_output/xcb/x11.c
=====================================
@@ -201,24 +201,24 @@ static int ResetPictures(vout_display_t *vd, video_format_t *restrict f)
return VLC_SUCCESS;
}
-static int Control(vout_display_t *vd, int query)
+static int PlacementChanged(vout_display_t *vd, const vout_display_place_t *place)
{
- switch (query) {
- case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
- case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
- {
- if (vd->place->width != vd->fmt->i_visible_width
- || vd->place->height != vd->fmt->i_visible_height)
- return VLC_EGENERIC;
+ VLC_UNUSED(place);
+ if (place->width != vd->fmt->i_visible_width
+ || place->height != vd->fmt->i_visible_height)
+ return VLC_EGENERIC;
- return VLC_SUCCESS;
- }
+ return VLC_SUCCESS;
+}
- default:
- msg_Err (vd, "Unknown request in XCB vout display");
+static int AspectChanged(vout_display_t *vd, const video_format_t *source)
+{
+ VLC_UNUSED(source);
+ if (vd->place->width != vd->fmt->i_visible_width
+ || vd->place->height != vd->fmt->i_visible_height)
return VLC_EGENERIC;
- }
+
+ return VLC_SUCCESS;
}
static int SetDisplaySize(vout_display_t *vd, unsigned width, unsigned height)
@@ -303,8 +303,10 @@ static const struct vlc_display_operations ops = {
.prepare = Prepare,
.display = Display,
.set_display_size = SetDisplaySize,
- .control = Control,
.reset_pictures = ResetPictures,
+ .video_place_changed = PlacementChanged,
+ .set_source_aspect = AspectChanged,
+ .set_source_crop = AspectChanged,
};
/**
=====================================
modules/video_output/yuv.c
=====================================
@@ -74,7 +74,6 @@ vlc_module_end()
/* */
static void Display(vout_display_t *, picture_t *);
-static int Control(vout_display_t *, int);
/*****************************************************************************
* vout_display_sys_t: video output descriptor
@@ -88,7 +87,6 @@ typedef struct vout_display_sys_t {
static const struct vlc_display_operations ops = {
.close = Close,
.display = Display,
- .control = Control,
};
/* */
@@ -246,16 +244,3 @@ static void Display(vout_display_t *vd, picture_t *picture)
}
fflush(sys->f);
}
-
-static int Control(vout_display_t *vd, int query)
-{
- (void) vd;
-
- switch (query) {
- case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
- case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
- return VLC_SUCCESS;
- }
- return VLC_EGENERIC;
-}
=====================================
src/video_output/display.c
=====================================
@@ -45,11 +45,6 @@
static int UpdateSourceSAR(vout_display_t *, const video_format_t *);
-static int vout_display_Control(vout_display_t *vd, int query)
-{
- return vd->ops->control(vd, query);
-}
-
/*****************************************************************************
*
*****************************************************************************/
@@ -513,13 +508,16 @@ static int vout_UpdateSourceCrop(vout_display_t *vd)
bool place_changed = PlaceVideoInDisplay(osys);
- err2 = vout_display_Control(vd, VOUT_DISPLAY_CHANGE_SOURCE_CROP);
- if (err2 != VLC_SUCCESS)
- err1 = err2;
+ if (vd->ops->set_source_crop != NULL)
+ {
+ err2 = vd->ops->set_source_crop(vd, vd->source);
+ if (err2 != VLC_SUCCESS)
+ err1 = err2;
+ }
- if (place_changed)
+ if (place_changed && vd->ops->video_place_changed != NULL)
{
- err2 = vout_display_Control(vd, VOUT_DISPLAY_CHANGE_SOURCE_PLACE);
+ err2 = vd->ops->video_place_changed(vd, vd->place);
if (err2 != VLC_SUCCESS)
err1 = err2;
}
@@ -542,9 +540,12 @@ static int vout_SetSourceAspect(vout_display_t *vd,
bool place_changed = PlaceVideoInDisplay(osys);
- err2 = vout_display_Control(vd, VOUT_DISPLAY_CHANGE_SOURCE_ASPECT);
- if (err2 != VLC_SUCCESS)
- err1 = err2;
+ if (vd->ops->set_source_aspect != NULL)
+ {
+ err2 = vd->ops->set_source_aspect(vd, vd->source);
+ if (err2 != VLC_SUCCESS)
+ err1 = err2;
+ }
/* If a crop ratio is requested, recompute the parameters */
if (osys->crop.mode != VOUT_CROP_NONE)
@@ -554,9 +555,9 @@ static int vout_SetSourceAspect(vout_display_t *vd,
err1 = err2;
}
- if (place_changed)
+ if (place_changed && vd->ops->video_place_changed != NULL)
{
- err2 = vout_display_Control(vd, VOUT_DISPLAY_CHANGE_SOURCE_PLACE);
+ err2 = vd->ops->video_place_changed(vd, vd->place);
if (err2 != VLC_SUCCESS)
err1 = err2;
}
@@ -619,9 +620,9 @@ void vout_display_SetSize(vout_display_t *vd, unsigned width, unsigned height)
if (err2 != VLC_SUCCESS)
err1 = err2;
- if (place_changed)
+ if (place_changed && vd->ops->video_place_changed != NULL)
{
- err2 = vout_display_Control(vd, VOUT_DISPLAY_CHANGE_SOURCE_PLACE);
+ err2 = vd->ops->video_place_changed(vd, vd->place);
if (err2 != VLC_SUCCESS)
err1 = err2;
}
@@ -640,9 +641,9 @@ void vout_SetDisplayFitting(vout_display_t *vd, enum vlc_video_fitting fit)
osys->cfg.display.fitting = fit;
bool place_changed = PlaceVideoInDisplay(osys);
- if (place_changed)
+ if (place_changed && vd->ops->video_place_changed != NULL)
{
- int err1 = vout_display_Control(vd, VOUT_DISPLAY_CHANGE_SOURCE_PLACE);
+ int err1 = vd->ops->video_place_changed(vd, vd->place);
if (err1 != VLC_SUCCESS)
vout_display_Reset(vd);
}
@@ -663,9 +664,9 @@ void vout_SetDisplayZoom(vout_display_t *vd, unsigned num, unsigned den)
return; /* zoom has not changed */
bool place_changed = PlaceVideoInDisplay(osys);
- if (place_changed)
+ if (place_changed && vd->ops->video_place_changed != NULL)
{
- int err1 = vout_display_Control(vd, VOUT_DISPLAY_CHANGE_SOURCE_PLACE);
+ int err1 = vd->ops->video_place_changed(vd, vd->place);
if (err1 != VLC_SUCCESS)
vout_display_Reset(vd);
}
=====================================
test/src/input/decoder/input_decoder.c
=====================================
@@ -224,12 +224,6 @@ static void DisplayPrepare(vout_display_t *vd, picture_t *picture,
scenario->display_prepare(vd, picture);
}
-static int DisplayControl(vout_display_t *vd, int query)
-{
- (void)vd; (void)query;
- return VLC_SUCCESS;
-}
-
static int OpenDisplay(vout_display_t *vd, video_format_t *fmtp, vlc_video_context *context)
{
(void)fmtp; (void)context;
@@ -237,7 +231,6 @@ static int OpenDisplay(vout_display_t *vd, video_format_t *fmtp, vlc_video_conte
struct input_decoder_scenario *scenario = &input_decoder_scenarios[current_scenario];
static const struct vlc_display_operations ops = {
.prepare = DisplayPrepare,
- .control = DisplayControl,
};
vd->ops = &ops;
=====================================
test/src/video_output/video_output.c
=====================================
@@ -170,20 +170,12 @@ static void Display(vout_display_t *vd, picture_t *picture)
(void) picture;
}
-static int Control(vout_display_t *vd, int query)
-{
- (void) vd;
- (void) query;
- return VLC_SUCCESS;
-}
-
static int OpenDisplay(vout_display_t *vd, video_format_t *fmtp,
struct vlc_video_context *vctx)
{
static const struct vlc_display_operations ops =
{
.display = Display,
- .control = Control,
};
vd->ops = &ops;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ff8c4aa9f78037ff4711e29c64b57db815b2e42e...1d4eec210137970680fcb50decd9b365f5e28e4c
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ff8c4aa9f78037ff4711e29c64b57db815b2e42e...1d4eec210137970680fcb50decd9b365f5e28e4c
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list