[vlc-commits] video_output: fix the user Aspect Ratio reset right after it's set

Steve Lhomme git at videolan.org
Tue Oct 13 13:15:32 CEST 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Oct 12 15:07:57 2020 +0200| [90866ec879482aeed431038b165929f7057b1183] | committer: Steve Lhomme

video_output: fix the user Aspect Ratio reset right after it's set

Only use the source aspect ratio when we're back to the default/unset display
aspect ratio (0/0). This is also the default setup when no user aspect ratio
is set.

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

 src/video_output/display.c      | 5 +++--
 src/video_output/display.h      | 2 +-
 src/video_output/video_output.c | 7 ++-----
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/video_output/display.c b/src/video_output/display.c
index 99bb4d5ac8..1d304e2b32 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -553,7 +553,7 @@ void VoutFixFormatAR(video_format_t *fmt)
     }
 }
 
-void vout_UpdateDisplaySourceProperties(vout_display_t *vd, const video_format_t *source)
+void vout_UpdateDisplaySourceProperties(vout_display_t *vd, const video_format_t *source, const vlc_rational_t *forced_dar)
 {
     vout_display_priv_t *osys = container_of(vd, vout_display_priv_t, display);
     int err1 = 0, err2 = 0;
@@ -563,12 +563,13 @@ void vout_UpdateDisplaySourceProperties(vout_display_t *vd, const video_format_t
     if (fixed_src.i_sar_num * osys->source.i_sar_den !=
         fixed_src.i_sar_den * osys->source.i_sar_num) {
 
+        if (forced_dar->num == 0) {
         osys->source.i_sar_num = fixed_src.i_sar_num;
         osys->source.i_sar_den = fixed_src.i_sar_den;
 
-        /* FIXME it will override any AR that the user would have forced */
         err1 = vout_SetSourceAspect(vd, osys->source.i_sar_num,
                                     osys->source.i_sar_den);
+        }
     }
     if (source->i_x_offset       != osys->source.i_x_offset ||
         source->i_y_offset       != osys->source.i_y_offset ||
diff --git a/src/video_output/display.h b/src/video_output/display.h
index 35138c5c70..de1c631dc8 100644
--- a/src/video_output/display.h
+++ b/src/video_output/display.h
@@ -22,5 +22,5 @@
 
 #include "vout_wrapper.h"
 
-void vout_UpdateDisplaySourceProperties(vout_display_t *vd, const video_format_t *);
+void vout_UpdateDisplaySourceProperties(vout_display_t *vd, const video_format_t *, const vlc_rational_t *forced_dar);
 void VoutFixFormatAR(video_format_t *);
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index de9329bfcb..0233e214d9 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -81,10 +81,7 @@ typedef struct vout_thread_sys_t
 
     /* */
     struct {
-        struct {
-            unsigned num;
-            unsigned den;
-        } dar;
+        vlc_rational_t dar;
         struct {
             enum vout_crop_mode mode;
             union {
@@ -1379,7 +1376,7 @@ static int ThreadDisplayRenderPicture(vout_thread_sys_t *vout, bool is_forced)
     }
 
     /* Render the direct buffer */
-    vout_UpdateDisplaySourceProperties(vd, &todisplay->format);
+    vout_UpdateDisplaySourceProperties(vd, &todisplay->format, &sys->source.dar);
 
     todisplay = vout_ConvertForDisplay(vd, todisplay);
     if (todisplay == NULL) {



More information about the vlc-commits mailing list