Commit 2f81dcb1 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vout: add thread control for display window size

parent 4f5c052c
...@@ -86,6 +86,7 @@ bool vout_AreDisplayPicturesInvalid(vout_display_t *); ...@@ -86,6 +86,7 @@ bool vout_AreDisplayPicturesInvalid(vout_display_t *);
bool vout_ManageDisplay(vout_display_t *, bool allow_reset_pictures); 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_SetDisplayFilled(vout_display_t *, bool is_filled);
void vout_SetDisplayZoom(vout_display_t *, unsigned num, unsigned den); void vout_SetDisplayZoom(vout_display_t *, unsigned num, unsigned den);
void vout_SetDisplayAspect(vout_display_t *, unsigned num, unsigned den); void vout_SetDisplayAspect(vout_display_t *, unsigned num, unsigned den);
......
...@@ -777,17 +777,9 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures) ...@@ -777,17 +777,9 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
#endif #endif
/* */ /* */
if (ch_display_size) { if (ch_display_size)
#if defined(_WIN32) || defined(__OS2__) vout_SetDisplaySize(vd, display_width, display_height);
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;
vout_display_Control(vd, VOUT_DISPLAY_CHANGE_DISPLAY_SIZE,
&osys->cfg);
}
/* */ /* */
if (osys->is_display_filled != osys->cfg.is_display_filled) { if (osys->is_display_filled != osys->cfg.is_display_filled) {
osys->cfg.is_display_filled = osys->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 ...@@ -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) void vout_SetDisplayFilled(vout_display_t *vd, bool is_filled)
{ {
vout_display_owner_sys_t *osys = vd->owner.sys; vout_display_owner_sys_t *osys = vd->owner.sys;
......
...@@ -489,6 +489,18 @@ void vout_ControlChangeWindowState(vout_thread_t *vout, unsigned st) ...@@ -489,6 +489,18 @@ void vout_ControlChangeWindowState(vout_thread_t *vout, unsigned st)
{ {
vout_control_PushInteger(&vout->p->control, VOUT_CONTROL_WINDOW_STATE, 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) void vout_ControlChangeDisplayFilled(vout_thread_t *vout, bool is_filled)
{ {
vout_control_PushBool(&vout->p->control, VOUT_CONTROL_DISPLAY_FILLED, vout_control_PushBool(&vout->p->control, VOUT_CONTROL_DISPLAY_FILLED,
...@@ -1396,6 +1408,12 @@ static void ThreadTranslateMouseState(vout_thread_t *vout, ...@@ -1396,6 +1408,12 @@ static void ThreadTranslateMouseState(vout_thread_t *vout,
vout_SendDisplayEventMouse(vout, &vid_mouse); 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) static void ThreadChangeDisplayFilled(vout_thread_t *vout, bool is_filled)
{ {
vout_SetDisplayFilled(vout->p->display.vd, 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) ...@@ -1710,6 +1728,9 @@ static int ThreadControl(vout_thread_t *vout, vout_control_cmd_t cmd)
case VOUT_CONTROL_MOUSE_STATE: case VOUT_CONTROL_MOUSE_STATE:
ThreadTranslateMouseState(vout, &cmd.mouse); ThreadTranslateMouseState(vout, &cmd.mouse);
break; break;
case VOUT_CONTROL_DISPLAY_SIZE:
ThreadChangeDisplaySize(vout, cmd.window.width, cmd.window.height);
break;
case VOUT_CONTROL_DISPLAY_FILLED: case VOUT_CONTROL_DISPLAY_FILLED:
ThreadChangeDisplayFilled(vout, cmd.boolean); ThreadChangeDisplayFilled(vout, cmd.boolean);
break; break;
......
...@@ -190,6 +190,8 @@ static inline void vout_CloseAndRelease( vout_thread_t *p_vout ) ...@@ -190,6 +190,8 @@ static inline void vout_CloseAndRelease( vout_thread_t *p_vout )
/* TODO to move them to vlc_vout.h */ /* TODO to move them to vlc_vout.h */
void vout_ControlChangeFullscreen(vout_thread_t *, bool fullscreen); void vout_ControlChangeFullscreen(vout_thread_t *, bool fullscreen);
void vout_ControlChangeWindowState(vout_thread_t *, unsigned state); 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_ControlChangeDisplayFilled(vout_thread_t *, bool is_filled);
void vout_ControlChangeZoom(vout_thread_t *, int num, int den); void vout_ControlChangeZoom(vout_thread_t *, int num, int den);
void vout_ControlChangeSampleAspectRatio(vout_thread_t *, unsigned num, unsigned den); void vout_ControlChangeSampleAspectRatio(vout_thread_t *, unsigned num, unsigned den);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment