[vlc-devel] [PATCH 2/2] video_output: fix the user Aspect Ratio reset right after it's set

Thomas Guillem thomas at gllm.fr
Mon Oct 12 15:24:53 CEST 2020


Set LGTM

On Mon, Oct 12, 2020, at 15:14, Steve Lhomme wrote:
> 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.
> ---
>  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 99bb4d5ac86..1d304e2b32b 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 35138c5c70f..de1c631dc83 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 de9329bfcb9..0233e214d9e 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) {
> -- 
> 2.26.2
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list