[vlc-commits] vout: notify window of A/R, crop and zoom changes

Rémi Denis-Courmont git at videolan.org
Sun Sep 2 16:26:30 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Oct 22 22:53:55 2014 +0300| [d3d1a139167458e584fa31e728404bd648df7650] | committer: Rémi Denis-Courmont

vout: notify window of A/R, crop and zoom changes

...before updating the display. This is necessary to (attempt to) fit
the window before changing the display and render.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d3d1a139167458e584fa31e728404bd648df7650
---

 src/video_output/video_output.c | 25 +++++++++++++++++++++++--
 src/video_output/window.c       |  5 +++++
 src/video_output/window.h       |  2 ++
 3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 0abc33368c..22a0cb4de6 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -541,6 +541,14 @@ void vout_ControlChangeWindowState(vout_thread_t *vout, unsigned st)
     vlc_mutex_unlock(&vout->p->window_lock);
 }
 
+static void vout_ControlUpdateWindowSize(vout_thread_t *vout)
+{
+    vlc_mutex_lock(&vout->p->window_lock);
+    if (vout->p->window != NULL)
+        vout_display_window_UpdateSize(vout->p->window, &vout->p->original);
+    vlc_mutex_unlock(&vout->p->window_lock);
+}
+
 void vout_ControlChangeDisplaySize(vout_thread_t *vout,
                                    unsigned width, unsigned height)
 {
@@ -558,47 +566,60 @@ void vout_ControlChangeDisplayFilled(vout_thread_t *vout, bool is_filled)
     vout_control_PushBool(&vout->p->control, VOUT_CONTROL_DISPLAY_FILLED,
                           is_filled);
 }
+
 void vout_ControlChangeZoom(vout_thread_t *vout, int num, int den)
 {
+    vout_ControlUpdateWindowSize(vout);
     vout_control_PushPair(&vout->p->control, VOUT_CONTROL_ZOOM,
                           num, den);
 }
+
 void vout_ControlChangeSampleAspectRatio(vout_thread_t *vout,
                                          unsigned num, unsigned den)
 {
+    vout_ControlUpdateWindowSize(vout);
     vout_control_PushPair(&vout->p->control, VOUT_CONTROL_ASPECT_RATIO,
                           num, den);
 }
+
 void vout_ControlChangeCropRatio(vout_thread_t *vout,
                                  unsigned num, unsigned den)
 {
+    vout_ControlUpdateWindowSize(vout);
     vout_control_PushPair(&vout->p->control, VOUT_CONTROL_CROP_RATIO,
                           num, den);
 }
+
 void vout_ControlChangeCropWindow(vout_thread_t *vout,
                                   int x, int y, int width, int height)
 {
     vout_control_cmd_t cmd;
+
+    vout_ControlUpdateWindowSize(vout);
+
     vout_control_cmd_Init(&cmd, VOUT_CONTROL_CROP_WINDOW);
     cmd.window.x      = __MAX(x, 0);
     cmd.window.y      = __MAX(y, 0);
     cmd.window.width  = __MAX(width, 0);
     cmd.window.height = __MAX(height, 0);
-
     vout_control_Push(&vout->p->control, &cmd);
 }
+
 void vout_ControlChangeCropBorder(vout_thread_t *vout,
                                   int left, int top, int right, int bottom)
 {
     vout_control_cmd_t cmd;
+
+    vout_ControlUpdateWindowSize(vout);
+
     vout_control_cmd_Init(&cmd, VOUT_CONTROL_CROP_BORDER);
     cmd.border.left   = __MAX(left, 0);
     cmd.border.top    = __MAX(top, 0);
     cmd.border.right  = __MAX(right, 0);
     cmd.border.bottom = __MAX(bottom, 0);
-
     vout_control_Push(&vout->p->control, &cmd);
 }
+
 void vout_ControlChangeFilters(vout_thread_t *vout, const char *filters)
 {
     vout_control_PushString(&vout->p->control, VOUT_CONTROL_CHANGE_FILTERS,
diff --git a/src/video_output/window.c b/src/video_output/window.c
index 6f4835d0c0..570393e20f 100644
--- a/src/video_output/window.c
+++ b/src/video_output/window.c
@@ -289,6 +289,11 @@ vout_window_t *vout_display_window_New(vout_thread_t *vout,
     return window;
 }
 
+void vout_display_window_UpdateSize(vout_window_t *window,
+                                    const video_format_t *restrict fmt)
+{
+}
+
 /**
  * Destroys a video window.
  * \note The window must be detached.
diff --git a/src/video_output/window.h b/src/video_output/window.h
index a3272caef8..e9f2707769 100644
--- a/src/video_output/window.h
+++ b/src/video_output/window.h
@@ -20,4 +20,6 @@
 
 vout_window_t *vout_display_window_New(vout_thread_t *,
                                        const vout_window_cfg_t *);
+void vout_display_window_UpdateSize(vout_window_t *,
+                                    const struct video_format_t *);
 void vout_display_window_Delete(vout_window_t *);



More information about the vlc-commits mailing list