[vlc-devel] [PATCH 1/4] decoder: Give packetizer aspect ratio to decoder.

Rémi Denis-Courmont remi at remlab.net
Thu Feb 6 18:59:12 CET 2014


Le jeudi 6 février 2014, 15:05:08 Martin Storsjö a écrit :
> From: Julian Scheel <julian at jusst.de>
> 
> When the packetizer detects a valid pixel aspect ratio this should be
> forwarded to the decoders input format. This is helpful for decoder modules
> which do not expose the aspect ratio on their own.
> 
> Signed-off-by: Julian Scheel <julian at jusst.de>
> ---
> IIRC the discussion last time ended at whether all of the struct
> should be copied, or just these fields. For this use case either
> is fine I think.
> 
> Should these fields always be copied, or only the first time?
> As it currently is written, it disallows any updates of the
> aspect ratio through this channel.
> ---
>  src/input/decoder.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/src/input/decoder.c b/src/input/decoder.c
> index d7caf2d..79a729d 100644
> --- a/src/input/decoder.c
> +++ b/src/input/decoder.c
> @@ -1569,6 +1569,21 @@ static void DecoderProcessVideo( decoder_t *p_dec,
> block_t *p_block, bool b_flus es_format_Clean( &p_dec->fmt_in );
>                  es_format_Copy( &p_dec->fmt_in, &p_packetizer->fmt_out );
>              }
> +
> +            /* If the packetizer provides aspect ratio information use it
> as +             * long as the decoder itself provides no aspect ratio +   
>          * information. */
> +            if( p_packetizer->fmt_out.video.i_sar_num > 0 &&
> +                    p_packetizer->fmt_out.video.i_sar_den > 0 &&
> +                    (p_dec->fmt_in.video.i_sar_num == 0 ||
> +                     p_dec->fmt_in.video.i_sar_den == 0) )
> +            {
> +                p_dec->fmt_in.video.i_sar_num =
> +                    p_packetizer->fmt_out.video.i_sar_num;
> +                p_dec->fmt_in.video.i_sar_den=
> +                    p_packetizer->fmt_out.video.i_sar_den;
> +            }

This will overwrite the decoder-specified SAR if extra data changed, won't it? 
(that bug was already there, true, but in another form...)

> +
>              if( p_packetizer->pf_get_cc )
>                  DecoderGetCc( p_dec, p_packetizer );

-- 
Rémi Denis-Courmont
http://www.remlab.net/




More information about the vlc-devel mailing list