[vlc-devel] [PATCH 11/24] vout: kms: refactor for next changes

Thomas Guillem thomas at gllm.fr
Wed Oct 31 17:50:06 CET 2018


vd->fmt and vd->cfg will be removed.
fmt and cfg will be passed by Open() and controls.
---
 modules/video_output/kms.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/modules/video_output/kms.c b/modules/video_output/kms.c
index 0848500841..80733c576a 100644
--- a/modules/video_output/kms.c
+++ b/modules/video_output/kms.c
@@ -703,13 +703,15 @@ static void Close(vlc_object_t *object)
 static int Open(vlc_object_t *object)
 {
     vout_display_t *vd = (vout_display_t *)object;
+    const vout_display_cfg_t *cfg = vd->cfg;
+    video_format_t *fmtp = &vd->fmt;
     vout_display_sys_t *sys;
     vlc_fourcc_t local_vlc_chroma;
     uint32_t local_drm_chroma;
     video_format_t fmt = {};
     char *chroma;
 
-    if (vout_display_IsWindowed(vd))
+    if (vout_display_cfg_IsWindowed(cfg))
         return VLC_EGENERIC;
 
     /*
@@ -727,14 +729,14 @@ static int Open(vlc_object_t *object)
             sys->vlc_fourcc = local_vlc_chroma;
             msg_Dbg(vd, "Forcing VLC to use chroma '%4s'", chroma);
          } else {
-            sys->vlc_fourcc = vd->fmt.i_chroma;
+            sys->vlc_fourcc = fmtp->i_chroma;
             msg_Dbg(vd, "Chroma %4s invalid, using default", chroma);
          }
 
         free(chroma);
         chroma = NULL;
     } else {
-        sys->vlc_fourcc = vd->fmt.i_chroma;
+        sys->vlc_fourcc = fmtp->i_chroma;
         msg_Dbg(vd, "Chroma %4s invalid, using default", chroma);
     }
 
@@ -760,19 +762,19 @@ static int Open(vlc_object_t *object)
         return VLC_EGENERIC;
     }
 
-    video_format_ApplyRotation(&fmt, &vd->fmt);
+    video_format_ApplyRotation(&fmt, fmtp);
 
     fmt.i_width = fmt.i_visible_width  = sys->width;
     fmt.i_height = fmt.i_visible_height = sys->height;
     fmt.i_chroma = sys->vlc_fourcc;
+    *fmtp = fmt;
 
-    vd->fmt     = fmt;
     vd->pool    = Pool;
     vd->prepare = NULL;
     vd->display = Display;
     vd->control = Control;
 
-    vout_window_ReportSize(vd->cfg->window, sys->width, sys->height);
+    vout_window_ReportSize(cfg->window, sys->width, sys->height);
     return VLC_SUCCESS;
 }
 
-- 
2.19.1



More information about the vlc-devel mailing list