[vlc-devel] [PATCH] display: apply the same source aspect ratio cleaning on init and source update
Steve Lhomme
robux4 at ycbcr.xyz
Thu Jun 20 12:18:26 CEST 2019
On 2019-06-20 11:18, Rémi Denis-Courmont wrote:
> Hi,
>
> I don't think we should override previous user settings, in this case
> A/R. Though there is indeed a bug in the current code.
>
> Also, AFAICT, the source update should occur before prep'ing a picture,
> not when updating the decoder output format. That's probably why the
> buggy code was left as it is.
There's already a lot of format cleaning in vout_update_format() so it
could be added there. There are also odd things with the cleaned format
used to create the display pool but not updated on the decoder output,
leading to mismatches (the i_chroma is not even set by default).
I'm working on cleaning that as it's needed for the push.
> Le 19 juin 2019 08:09:43 GMT+03:00, Steve Lhomme <robux4 at ycbcr.xyz> a
> écrit :
>
> In push we still need to clean the format every time the source changes. Before
> it was done before the display pool was allocated and kept all along.
> ------------------------------------------------------------------------
> src/video_output/display.c | 22 ++++++++++++++++------
> src/video_output/display.h | 1 +
> src/video_output/video_output.c | 7 +------
> 3 files changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/src/video_output/display.c b/src/video_output/display.c
> index f295ad6731..2173bb084e 100644
> --- a/src/video_output/display.c
> +++ b/src/video_output/display.c
> @@ -588,18 +588,28 @@ static int vout_SetSourceAspect(vout_display_t *vd,
> return ret;
> }
>
> +void VoutFixFormatAR(video_format_t *fmt)
> +{
> + vlc_ureduce( &fmt->i_sar_num, &fmt->i_sar_den,
> + fmt->i_sar_num, fmt->i_sar_den, 50000 );
> + if (fmt->i_sar_num <= 0 || fmt->i_sar_den <= 0) {
> + fmt->i_sar_num = 1;
> + fmt->i_sar_den = 1;
> + }
> +}
> +
> void vout_UpdateDisplaySourceProperties(vout_display_t *vd, const video_format_t *source)
> {
> vout_display_priv_t *osys = container_of(vd, vout_display_priv_t, display);
> int err1 = 0, err2 = 0;
>
> - if (source->i_sar_num * osys->source.i_sar_den !=
> - source->i_sar_den * osys->source.i_sar_num) {
> + video_format_t fixed_src = *source;
> + VoutFixFormatAR( &fixed_src );
> + if (fixed_src.i_sar_num * osys->source.i_sar_den !=
> + fixed_src.i_sar_den * osys->source.i_sar_num) {
>
> - osys->source.i_sar_num = source->i_sar_num;
> - osys->source.i_sar_den = source->i_sar_den;
> - vlc_ureduce(&osys->source.i_sar_num, &osys->source.i_sar_den,
> - osys->source.i_sar_num, osys->source.i_sar_den, 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,
> diff --git a/src/video_output/display.h b/src/video_output/display.h
> index f9100d98ef..35138c5c70 100644
> --- a/src/video_output/display.h
> +++ b/src/video_output/display.h
> @@ -23,3 +23,4 @@
> #include "vout_wrapper.h"
>
> void vout_UpdateDisplaySourceProperties(vout_display_t *vd, const video_format_t *);
> +void VoutFixFormatAR(video_format_t *);
> diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
> index 1ae84bbb1c..a3ef144da1 100644
> --- a/src/video_output/video_output.c
> +++ b/src/video_output/video_output.c
> @@ -87,12 +87,7 @@ static void VoutFixFormat(video_format_t *dst, const video_format_t *src)
> {
> video_format_Copy(dst, src);
> dst->i_chroma = vlc_fourcc_GetCodec(VIDEO_ES, src->i_chroma);
> - vlc_ureduce( &dst->i_sar_num, &dst->i_sar_den,
> - src->i_sar_num, src->i_sar_den, 50000 );
> - if (dst->i_sar_num <= 0 || dst->i_sar_den <= 0) {
> - dst->i_sar_num = 1;
> - dst->i_sar_den = 1;
> - }
> + VoutFixFormatAR( dst );
> video_format_FixRgb(dst);
> }
>
>
>
> --
> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser
> ma brièveté.
>
> _______________________________________________
> 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