[vlc-devel] [PATCH] display: rotate the source format rather than temporary output format

Steve Lhomme robux4 at ycbcr.xyz
Mon Sep 7 08:37:25 CEST 2020


The temporary and output format are the same at this stage.

It also shows potential that might need some attention when vd->source changes in push.
---
 modules/video_output/fb.c      | 2 +-
 modules/video_output/kms.c     | 2 +-
 modules/video_output/kva.c     | 2 +-
 modules/video_output/vmem.c    | 2 +-
 modules/video_output/xcb/x11.c | 5 +++--
 modules/video_output/yuv.c     | 2 +-
 6 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/modules/video_output/fb.c b/modules/video_output/fb.c
index c06700377f4..26cbbec773c 100644
--- a/modules/video_output/fb.c
+++ b/modules/video_output/fb.c
@@ -248,7 +248,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
 
     /* */
     video_format_t fmt;
-    video_format_ApplyRotation(&fmt, fmtp);
+    video_format_ApplyRotation(&fmt, vd->source);
 
     if (sys->chroma) {
         fmt.i_chroma = sys->chroma;
diff --git a/modules/video_output/kms.c b/modules/video_output/kms.c
index e74ff5a3dab..afe91126be8 100644
--- a/modules/video_output/kms.c
+++ b/modules/video_output/kms.c
@@ -725,7 +725,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
         return VLC_EGENERIC;
     }
 
-    video_format_ApplyRotation(&fmt, fmtp);
+    video_format_ApplyRotation(&fmt, vd->source);
 
     fmt.i_width = fmt.i_visible_width  = sys->width;
     fmt.i_height = fmt.i_visible_height = sys->height;
diff --git a/modules/video_output/kva.c b/modules/video_output/kva.c
index 8a07fa65c1b..18fcb610980 100644
--- a/modules/video_output/kva.c
+++ b/modules/video_output/kva.c
@@ -169,7 +169,7 @@ static void PMThread( void *arg )
 
     /* */
     video_format_t fmt;
-    video_format_ApplyRotation(&fmt, fmtp);
+    video_format_ApplyRotation(&fmt, vd->source);
 
     /* */
     MorphToPM();
diff --git a/modules/video_output/vmem.c b/modules/video_output/vmem.c
index 2de886284ee..5f7e920f757 100644
--- a/modules/video_output/vmem.c
+++ b/modules/video_output/vmem.c
@@ -133,7 +133,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
 
     /* Define the video format */
     video_format_t fmt;
-    video_format_ApplyRotation(&fmt, fmtp);
+    video_format_ApplyRotation(&fmt, vd->source);
 
     if (setup != NULL) {
         char chroma[5];
diff --git a/modules/video_output/xcb/x11.c b/modules/video_output/xcb/x11.c
index eee5c666519..8dc37cc744d 100644
--- a/modules/video_output/xcb/x11.c
+++ b/modules/video_output/xcb/x11.c
@@ -219,6 +219,7 @@ static xcb_visualid_t DepthToFormat(const xcb_setup_t *setup,
 static xcb_visualid_t ScreenToFormat(const xcb_setup_t *setup,
                                      const xcb_screen_t *screen,
                                      uint8_t *restrict bits,
+                                     const video_format_t *source,
                                      video_format_t *restrict fmtp)
 {
     xcb_visualid_t visual = 0;
@@ -236,7 +237,7 @@ static xcb_visualid_t ScreenToFormat(const xcb_setup_t *setup,
         if (depth->depth <= *bits)
             continue; /* no better than earlier depth */
 
-        video_format_ApplyRotation(&fmt, fmtp);
+        video_format_ApplyRotation(&fmt, source);
         vid = DepthToFormat(setup, depth, &fmt);
         if (vid != 0)
         {
@@ -273,7 +274,7 @@ static int Open (vout_display_t *vd, const vout_display_cfg_t *cfg,
     const xcb_setup_t *setup = xcb_get_setup (conn);
 
     /* Determine our pixel format */
-    xcb_visualid_t vid = ScreenToFormat(setup, scr, &sys->depth, fmtp);
+    xcb_visualid_t vid = ScreenToFormat(setup, scr, &sys->depth, vd->source, fmtp);
     if (vid == 0) {
         msg_Err(vd, "no supported visual & pixel format");
         goto error;
diff --git a/modules/video_output/yuv.c b/modules/video_output/yuv.c
index f5789cce28e..62df5406f3c 100644
--- a/modules/video_output/yuv.c
+++ b/modules/video_output/yuv.c
@@ -143,7 +143,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
 
     /* */
     video_format_t fmt;
-    video_format_ApplyRotation(&fmt, fmtp);
+    video_format_ApplyRotation(&fmt, vd->source);
     fmt.i_chroma = chroma;
     video_format_FixRgb(&fmt);
 
-- 
2.26.2



More information about the vlc-devel mailing list