[vlc-commits] vout: add thread control for display window size
Rémi Denis-Courmont
git at videolan.org
Sun May 20 19:51:41 CEST 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri May 18 20:35:57 2018 +0300| [2f81dcb184824874813471a2810362e1d62c2cf1] | committer: Rémi Denis-Courmont
vout: add thread control for display window size
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2f81dcb184824874813471a2810362e1d62c2cf1
---
include/vlc_vout_wrapper.h | 1 +
src/video_output/display.c | 25 +++++++++++++++----------
src/video_output/video_output.c | 21 +++++++++++++++++++++
src/video_output/vout_internal.h | 2 ++
4 files changed, 39 insertions(+), 10 deletions(-)
diff --git a/include/vlc_vout_wrapper.h b/include/vlc_vout_wrapper.h
index fec72efd8c..a307aacf9d 100644
--- a/include/vlc_vout_wrapper.h
+++ b/include/vlc_vout_wrapper.h
@@ -86,6 +86,7 @@ bool vout_AreDisplayPicturesInvalid(vout_display_t *);
bool vout_ManageDisplay(vout_display_t *, bool allow_reset_pictures);
+void vout_SetDisplaySize(vout_display_t *, unsigned width, unsigned height);
void vout_SetDisplayFilled(vout_display_t *, bool is_filled);
void vout_SetDisplayZoom(vout_display_t *, unsigned num, unsigned den);
void vout_SetDisplayAspect(vout_display_t *, unsigned num, unsigned den);
diff --git a/src/video_output/display.c b/src/video_output/display.c
index 9b02e90137..7d2201044e 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -777,17 +777,9 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
#endif
/* */
- if (ch_display_size) {
-#if defined(_WIN32) || defined(__OS2__)
- osys->width_saved = osys->cfg.display.width;
- osys->height_saved = osys->cfg.display.height;
-#endif
- osys->cfg.display.width = display_width;
- osys->cfg.display.height = display_height;
+ if (ch_display_size)
+ vout_SetDisplaySize(vd, display_width, display_height);
- vout_display_Control(vd, VOUT_DISPLAY_CHANGE_DISPLAY_SIZE,
- &osys->cfg);
- }
/* */
if (osys->is_display_filled != osys->cfg.is_display_filled) {
osys->cfg.is_display_filled = osys->is_display_filled;
@@ -982,6 +974,19 @@ void vout_UpdateDisplaySourceProperties(vout_display_t *vd, const video_format_t
}
}
+void vout_SetDisplaySize(vout_display_t *vd, unsigned width, unsigned height)
+{
+ vout_display_owner_sys_t *osys = vd->owner.sys;
+
+#if defined(_WIN32) || defined(__OS2__)
+ osys->width_saved = osys->cfg.display.width;
+ osys->height_saved = osys->cfg.display.height;
+#endif
+ osys->cfg.display.width = width;
+ osys->cfg.display.height = height;
+ vout_display_Control(vd, VOUT_DISPLAY_CHANGE_DISPLAY_SIZE, &osys->cfg);
+}
+
void vout_SetDisplayFilled(vout_display_t *vd, bool is_filled)
{
vout_display_owner_sys_t *osys = vd->owner.sys;
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 0a49390c3e..bfb8847643 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -489,6 +489,18 @@ void vout_ControlChangeWindowState(vout_thread_t *vout, unsigned st)
{
vout_control_PushInteger(&vout->p->control, VOUT_CONTROL_WINDOW_STATE, st);
}
+void vout_ControlChangeDisplaySize(vout_thread_t *vout,
+ unsigned width, unsigned height)
+{
+ vout_control_cmd_t cmd;
+
+ vout_control_cmd_Init(&cmd, VOUT_CONTROL_DISPLAY_SIZE);
+ cmd.window.x = 0;
+ cmd.window.y = 0;
+ cmd.window.width = width;
+ cmd.window.height = height;
+ vout_control_Push(&vout->p->control, &cmd);
+}
void vout_ControlChangeDisplayFilled(vout_thread_t *vout, bool is_filled)
{
vout_control_PushBool(&vout->p->control, VOUT_CONTROL_DISPLAY_FILLED,
@@ -1396,6 +1408,12 @@ static void ThreadTranslateMouseState(vout_thread_t *vout,
vout_SendDisplayEventMouse(vout, &vid_mouse);
}
+static void ThreadChangeDisplaySize(vout_thread_t *vout,
+ unsigned width, unsigned height)
+{
+ vout_SetDisplaySize(vout->p->display.vd, width, height);
+}
+
static void ThreadChangeDisplayFilled(vout_thread_t *vout, bool is_filled)
{
vout_SetDisplayFilled(vout->p->display.vd, is_filled);
@@ -1710,6 +1728,9 @@ static int ThreadControl(vout_thread_t *vout, vout_control_cmd_t cmd)
case VOUT_CONTROL_MOUSE_STATE:
ThreadTranslateMouseState(vout, &cmd.mouse);
break;
+ case VOUT_CONTROL_DISPLAY_SIZE:
+ ThreadChangeDisplaySize(vout, cmd.window.width, cmd.window.height);
+ break;
case VOUT_CONTROL_DISPLAY_FILLED:
ThreadChangeDisplayFilled(vout, cmd.boolean);
break;
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index ce57fc71e8..9a6083ca7d 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -190,6 +190,8 @@ static inline void vout_CloseAndRelease( vout_thread_t *p_vout )
/* TODO to move them to vlc_vout.h */
void vout_ControlChangeFullscreen(vout_thread_t *, bool fullscreen);
void vout_ControlChangeWindowState(vout_thread_t *, unsigned state);
+void vout_ControlChangeDisplaySize(vout_thread_t *,
+ unsigned width, unsigned height);
void vout_ControlChangeDisplayFilled(vout_thread_t *, bool is_filled);
void vout_ControlChangeZoom(vout_thread_t *, int num, int den);
void vout_ControlChangeSampleAspectRatio(vout_thread_t *, unsigned num, unsigned den);
More information about the vlc-commits
mailing list