display: no need to pass the video_format_t for CROP/ASPECT_RATIO changes
authorSteve Lhomme <robux4@videolabs.io>
Wed, 2 Aug 2017 07:33:37 +0000 (09:33 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Fri, 4 Aug 2017 15:54:38 +0000 (18:54 +0300)
It's always found in vd->source.

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
include/vlc_vout_display.h
modules/hw/mmal/vout.c
modules/video_output/android/display.c
modules/video_output/evas.c
modules/video_output/kva.c
modules/video_output/opengl/display.c
modules/video_output/sdl.c
modules/video_output/wayland/shm.c
modules/video_output/win32/common.c
modules/video_output/xcb/xvideo.c
src/video_output/display.c

index 38dbded..f02272a 100644 (file)
@@ -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 */
index 4043f73..24a4cf7 100644 (file)
@@ -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;
 
index 7dce996..eb4d89f 100644 (file)
@@ -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);
index 880c9e4..a6116af 100644 (file)
@@ -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
index eb9aed4..df8803a 100644 (file)
@@ -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;
index 63376f1..e72e160 100644 (file)
@@ -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);
index 1fe55d6..51c935c 100644 (file)
@@ -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);
         }
index 8de51a3..03e2836 100644 (file)
@@ -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),
index cc6fac0..e734316 100644 (file)
@@ -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
index 2f1801b..387c768 100644 (file)
@@ -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;
 
index 3d89b9a..0e89906 100644 (file)
@@ -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;