[vlc-commits] display: no need to pass the video_format_t for CROP/ASPECT_RATIO changes

Steve Lhomme git at videolan.org
Fri Aug 4 17:57:30 CEST 2017


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Wed Aug  2 09:33:37 2017 +0200| [d9e1ff011ef0ebd262219df8e9ba3948afb7825f] | committer: Rémi Denis-Courmont

display: no need to pass the video_format_t for CROP/ASPECT_RATIO changes

It's always found in vd->source.

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 include/vlc_vout_display.h             | 4 ++--
 modules/hw/mmal/vout.c                 | 4 +---
 modules/video_output/android/display.c | 5 ++---
 modules/video_output/evas.c            | 5 +----
 modules/video_output/kva.c             | 6 ++----
 modules/video_output/opengl/display.c  | 3 +--
 modules/video_output/sdl.c             | 5 +----
 modules/video_output/wayland/shm.c     | 7 ++-----
 modules/video_output/win32/common.c    | 8 +++-----
 modules/video_output/xcb/xvideo.c      | 5 +----
 src/video_output/display.c             | 4 ++--
 11 files changed, 18 insertions(+), 38 deletions(-)

diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index 38dbded17d..f02272a3d7 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -167,13 +167,13 @@ enum {
 
     /* Ask the module to acknowledge/refuse source aspect ratio after being
      * requested externally */
-    VOUT_DISPLAY_CHANGE_SOURCE_ASPECT, /* const video_format_t *p_source */
+    VOUT_DISPLAY_CHANGE_SOURCE_ASPECT,
 
     /* Ask the module to acknowledge/refuse source crop change after being
      * requested externally.
      * The cropping requested is stored by video_format_t::i_x/y_offset and
      * video_format_t::i_visible_width/height */
-    VOUT_DISPLAY_CHANGE_SOURCE_CROP,   /* const video_format_t *p_source */
+    VOUT_DISPLAY_CHANGE_SOURCE_CROP,
 
     /* Ask the module to acknowledge/refuse VR/360° viewing direction after
      * being requested externally */
diff --git a/modules/hw/mmal/vout.c b/modules/hw/mmal/vout.c
index 4043f73d31..24a4cf73c3 100644
--- a/modules/hw/mmal/vout.c
+++ b/modules/hw/mmal/vout.c
@@ -610,7 +610,6 @@ static int vd_control(vout_display_t *vd, int query, va_list args)
     vout_display_sys_t *sys = vd->sys;
     vout_display_cfg_t cfg;
     const vout_display_cfg_t *tmp_cfg;
-    const video_format_t *tmp_fmt;
     int ret = VLC_EGENERIC;
 
     switch (query) {
@@ -632,8 +631,7 @@ static int vd_control(vout_display_t *vd, int query, va_list args)
 
         case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
         case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
-            tmp_fmt = va_arg(args, const video_format_t *);
-            if (configure_display(vd, NULL, tmp_fmt) >= 0)
+            if (configure_display(vd, NULL, &vd->source) >= 0)
                 ret = VLC_SUCCESS;
             break;
 
diff --git a/modules/video_output/android/display.c b/modules/video_output/android/display.c
index 7dce996311..eb4d89fbca 100644
--- a/modules/video_output/android/display.c
+++ b/modules/video_output/android/display.c
@@ -1185,13 +1185,12 @@ static int Control(vout_display_t *vd, int query, va_list args)
     case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
     {
         msg_Dbg(vd, "change source crop/aspect");
-        const video_format_t *source = va_arg(args, const video_format_t *);
 
         if (query == VOUT_DISPLAY_CHANGE_SOURCE_CROP) {
-            video_format_CopyCrop(&sys->p_window->fmt, source);
+            video_format_CopyCrop(&sys->p_window->fmt, &vd->source);
             AndroidWindow_UpdateCrop(sys, sys->p_window);
         } else
-            CopySourceAspect(&sys->p_window->fmt, source);
+            CopySourceAspect(&sys->p_window->fmt, &vd->source);
 
         UpdateVideoSize(sys, &sys->p_window->fmt, sys->p_window->b_use_priv);
         FixSubtitleFormat(sys);
diff --git a/modules/video_output/evas.c b/modules/video_output/evas.c
index 880c9e413a..a6116af0a9 100644
--- a/modules/video_output/evas.c
+++ b/modules/video_output/evas.c
@@ -744,15 +744,12 @@ Control( vout_display_t *vd, int i_query, va_list ap )
     {
     case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
     {
-        const video_format_t *p_source;
         vout_display_place_t place;
         video_format_t fmt;
 
         msg_Dbg( vd, "VOUT_DISPLAY_CHANGE_SOURCE_ASPECT" );
 
-        p_source = va_arg( ap, const video_format_t * );
-
-        video_format_ApplyRotation( &fmt, p_source );
+        video_format_ApplyRotation( &fmt, &vd->source );
         vout_display_PlacePicture( &place, &fmt, vd->cfg, false );
 
         if( place.width != (unsigned) sys->i_width
diff --git a/modules/video_output/kva.c b/modules/video_output/kva.c
index eb9aed4a99..df8803ad88 100644
--- a/modules/video_output/kva.c
+++ b/modules/video_output/kva.c
@@ -466,12 +466,10 @@ static int Control( vout_display_t *vd, int query, va_list args )
     case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
     case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
     {
-        const video_format_t *src = va_arg(args, const video_format_t *);
-
         if( query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT )
         {
             vout_display_place_t place;
-            vout_display_PlacePicture(&place, src, vd->cfg, false);
+            vout_display_PlacePicture(&place, &vd->source, vd->cfg, false);
 
             sys->kvas.ulAspectWidth  = place.width;
             sys->kvas.ulAspectHeight = place.height;
@@ -479,7 +477,7 @@ static int Control( vout_display_t *vd, int query, va_list args )
         else
         {
             video_format_t src_rot;
-            video_format_ApplyRotation(&src_rot, src);
+            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;
diff --git a/modules/video_output/opengl/display.c b/modules/video_output/opengl/display.c
index 63376f1cd8..e72e16005d 100644
--- a/modules/video_output/opengl/display.c
+++ b/modules/video_output/opengl/display.c
@@ -234,10 +234,9 @@ static int Control (vout_display_t *vd, int query, va_list ap)
       case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
       {
         const vout_display_cfg_t *cfg = vd->cfg;
-        const video_format_t *src = va_arg (ap, const video_format_t *);
         vout_display_place_t place;
 
-        vout_display_PlacePicture (&place, src, cfg, false);
+        vout_display_PlacePicture (&place, &vd->source, cfg, false);
         if (vlc_gl_MakeCurrent (sys->gl) != VLC_SUCCESS)
             return VLC_EGENERIC;
         vout_display_opengl_SetWindowAspectRatio(sys->vgl, (float)place.width / place.height);
diff --git a/modules/video_output/sdl.c b/modules/video_output/sdl.c
index 1fe55d64f3..51c935cbe0 100644
--- a/modules/video_output/sdl.c
+++ b/modules/video_output/sdl.c
@@ -518,20 +518,17 @@ static int Control(vout_display_t *vd, int query, va_list args)
     case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED:
     case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT: {
         const vout_display_cfg_t *cfg;
-        const video_format_t *source;
 
         if (query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT) {
-            source = va_arg(args, const video_format_t *);
             cfg = vd->cfg;
         } else {
-            source = &vd->source;
             cfg = va_arg(args, const vout_display_cfg_t *);
         }
         if (sys->overlay) {
             sys->display = SDL_SetVideoMode(cfg->display.width, cfg->display.height,
                                             sys->display_bpp, sys->display_flags);
 
-            vout_display_PlacePicture(&sys->place, source, cfg, !sys->overlay);
+            vout_display_PlacePicture(&sys->place, &vd->source, cfg, !sys->overlay);
         } else {
             vout_display_SendEventPicturesInvalid(vd);
         }
diff --git a/modules/video_output/wayland/shm.c b/modules/video_output/wayland/shm.c
index 8de51a3e34..03e28362c1 100644
--- a/modules/video_output/wayland/shm.c
+++ b/modules/video_output/wayland/shm.c
@@ -294,17 +294,14 @@ static int Control(vout_display_t *vd, int query, va_list ap)
         case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
         {
             const vout_display_cfg_t *cfg;
-            const video_format_t *src;
 
             if (query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT
              || query == VOUT_DISPLAY_CHANGE_SOURCE_CROP)
             {
-                src = va_arg(ap, const video_format_t *);
                 cfg = vd->cfg;
             }
             else
             {
-                src = &vd->source;
                 cfg = va_arg(ap, const vout_display_cfg_t *);
             }
 
@@ -314,7 +311,7 @@ static int Control(vout_display_t *vd, int query, va_list ap)
             sys->x += place.width / 2;
             sys->y += place.height / 2;
 
-            vout_display_PlacePicture(&place, src, cfg, false);
+            vout_display_PlacePicture(&place, &vd->source, cfg, false);
             sys->x -= place.width / 2;
             sys->y -= place.height / 2;
 
@@ -322,7 +319,7 @@ static int Control(vout_display_t *vd, int query, va_list ap)
             {
                 video_format_t fmt;
 
-                video_format_ApplyRotation(&fmt, src);
+                video_format_ApplyRotation(&fmt, &vd->source);
                 wp_viewport_set_source(sys->viewport,
                                 wl_fixed_from_int(fmt.i_x_offset),
                                 wl_fixed_from_int(fmt.i_y_offset),
diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index cc6fac08a2..e734316431 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -652,19 +652,17 @@ int CommonControl(vout_display_t *vd, int query, va_list args)
     switch (query) {
     case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED: /* const vout_display_cfg_t *p_cfg */
     case VOUT_DISPLAY_CHANGE_ZOOM:           /* const vout_display_cfg_t *p_cfg */
-    case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:  /* const video_format_t *p_source */
-    case VOUT_DISPLAY_CHANGE_SOURCE_CROP: {  /* const video_format_t *p_source */
+    case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
+    case VOUT_DISPLAY_CHANGE_SOURCE_CROP: {
         const vout_display_cfg_t *cfg;
 
         if (query == VOUT_DISPLAY_CHANGE_SOURCE_CROP ||
             query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT) {
-            const video_format_t *source = va_arg(args, const video_format_t *);
             cfg    = vd->cfg;
-            UpdateRects(vd, cfg, source, true);
         } else {
             cfg    = va_arg(args, const vout_display_cfg_t *);
-            UpdateRects(vd, cfg, NULL, true);
         }
+        UpdateRects(vd, cfg, NULL, true);
         return VLC_SUCCESS;
     }
 #if !VLC_WINSTORE_APP
diff --git a/modules/video_output/xcb/xvideo.c b/modules/video_output/xcb/xvideo.c
index 2f1801b2f3..387c768d28 100644
--- a/modules/video_output/xcb/xvideo.c
+++ b/modules/video_output/xcb/xvideo.c
@@ -724,22 +724,19 @@ static int Control (vout_display_t *vd, int query, va_list ap)
     case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
     {
         const vout_display_cfg_t *cfg;
-        const video_format_t *source;
 
         if (query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT
          || query == VOUT_DISPLAY_CHANGE_SOURCE_CROP)
         {
-            source = va_arg(ap, const video_format_t *);
             cfg = vd->cfg;
         }
         else
         {
-            source = &vd->source;
             cfg = va_arg(ap, const vout_display_cfg_t *);
         }
 
         vout_display_place_t place;
-        vout_display_PlacePicture (&place, source, cfg, false);
+        vout_display_PlacePicture (&place, &vd->source, cfg, false);
         p_sys->width  = place.width;
         p_sys->height = place.height;
 
diff --git a/src/video_output/display.c b/src/video_output/display.c
index 3d89b9a6d0..0e899065dd 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -956,7 +956,7 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
                 vd->source.i_sar_den = osys->source.i_sar_den;
             }
 
-            if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_SOURCE_ASPECT, &vd->source)) {
+            if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_SOURCE_ASPECT)) {
                 /* There nothing much we can do. The only reason a vout display
                  * does not support it is because it need the core to add black border
                  * to the video for it.
@@ -1017,7 +1017,7 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
             vd->source.i_visible_height = bottom - top;
             video_format_Print(VLC_OBJECT(vd), "SOURCE ", &osys->source);
             video_format_Print(VLC_OBJECT(vd), "CROPPED", &vd->source);
-            if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_SOURCE_CROP, &vd->source)) {
+            if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_SOURCE_CROP)) {
                 msg_Err(vd, "Failed to change source crop TODO implement crop at core");
 
                 vd->source.i_x_offset       = i_x_offset;



More information about the vlc-commits mailing list