[vlc-devel] [PATCH v3 2/3] video_output:display: allow some vout to handle the source aspect ratio/crop before display

Steve Lhomme robux4 at ycbcr.xyz
Tue Sep 11 15:01:34 CEST 2018


Rather than waiting for the next display loop which may itself request another change.
---
 include/vlc_vout_display.h |  1 +
 src/video_output/display.c | 27 +++++++++++++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index 86eb1bced0..f8149e7e45 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -112,6 +112,7 @@ typedef struct {
     bool is_slow;                           /* The picture memory has slow read/write */
     bool has_double_click;                  /* Is double-click generated */
     bool has_pictures_invalid;              /* Will VOUT_DISPLAY_EVENT_PICTURES_INVALID be used */
+    int dynamic_src;                        /* bitmask of VOUT_DISPLAY_CHANGE_SOURCE_xxx supported dynamically */
     const vlc_fourcc_t *subpicture_chromas; /* List of supported chromas for subpicture rendering. */
 } vout_display_info_t;
 
diff --git a/src/video_output/display.c b/src/video_output/display.c
index e53591c51c..1aa6885b18 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -92,6 +92,7 @@ static vout_display_t *vout_display_New(vlc_object_t *obj,
     vd->info.is_slow = false;
     vd->info.has_double_click = false;
     vd->info.has_pictures_invalid = false;
+    vd->info.dynamic_src = 0;
     vd->info.subpicture_chromas = NULL;
 
     vd->cfg = cfg;
@@ -796,9 +797,16 @@ void vout_UpdateDisplaySourceProperties(vout_display_t *vd, const video_format_t
                     osys->source.i_sar_num, osys->source.i_sar_den, 0);
 
         /* FIXME it will override any AR that the user would have forced */
-        osys->ch_sar = true;
-        osys->sar.num = osys->source.i_sar_num;
-        osys->sar.den = osys->source.i_sar_den;
+        if (vd->info.dynamic_src & (1<<VOUT_DISPLAY_CHANGE_SOURCE_ASPECT))
+        {
+            UpdateSourceAspect(vd);
+        }
+        else
+        {
+            osys->ch_sar = true;
+            osys->sar.num = osys->source.i_sar_num;
+            osys->sar.den = osys->source.i_sar_den;
+        }
     }
     if (source->i_x_offset       != osys->source.i_x_offset ||
         source->i_y_offset       != osys->source.i_y_offset ||
@@ -809,7 +817,18 @@ void vout_UpdateDisplaySourceProperties(vout_display_t *vd, const video_format_t
 
         /* Force the vout to reapply the current user crop settings over the new decoder
          * crop settings. */
-        osys->ch_crop = true;
+        if (vd->info.dynamic_src & (1<<VOUT_DISPLAY_CHANGE_SOURCE_CROP))
+        {
+            UpdateSourceCrop(vd);
+        }
+        else
+        {
+            osys->ch_crop = true;
+        }
+    } else if (osys->ch_crop &&
+               vd->info.dynamic_src & (1<<VOUT_DISPLAY_CHANGE_SOURCE_CROP))
+    {
+        UpdateSourceCrop(vd);
     }
 }
 
-- 
2.17.0



More information about the vlc-devel mailing list