[vlc-devel] [PATCH 01/13] decoder: forward the source colorimetry if the decoder doesn't set it
Thomas Guillem
thomas at gllm.fr
Tue Feb 19 11:06:14 CET 2019
Not sure if you saw my previous comment.
On Tue, Feb 19, 2019, at 11:03, Steve Lhomme wrote:
> For now we don't overwrite the video format handled by the decoder.
> ---
> src/input/decoder_helpers.c | 19 ++++++++++++++++++-
> 1 file changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
> index 3cc02de8d6..bfc954312c 100644
> --- a/src/input/decoder_helpers.c
> +++ b/src/input/decoder_helpers.c
> @@ -74,12 +74,29 @@ void decoder_Destroy( decoder_t *p_dec )
>
> int decoder_UpdateVideoFormat( decoder_t *dec )
> {
> + video_format_t fmt_out;
> vlc_assert( dec->fmt_in.i_cat == VIDEO_ES && dec->cbs != NULL );
> if ( unlikely(dec->fmt_in.i_cat != VIDEO_ES || dec->cbs == NULL ||
> dec->cbs->video.format_update == NULL) )
> return -1;
>
> - return dec->cbs->video.format_update( dec );
> + fmt_out = dec->fmt_out.video;
VLC is a C (11) project © ;)
video_format_t fmt_out = dec->fmt_out.video;
> + if ( fmt_out.color_range == COLOR_RANGE_UNDEF )
> + fmt_out.color_range = dec->fmt_in.video.color_range;
> + if ( fmt_out.space == COLOR_SPACE_UNDEF )
> + fmt_out.space = dec->fmt_in.video.space;
> + if ( fmt_out.transfer == TRANSFER_FUNC_UNDEF )
> + fmt_out.transfer = dec->fmt_in.video.transfer;
> + if ( fmt_out.primaries == COLOR_PRIMARIES_UNDEF )
> + fmt_out.primaries = dec->fmt_in.video.primaries;
> + if ( fmt_out.chroma_location == CHROMA_LOCATION_UNDEF )
> + fmt_out.chroma_location = dec->fmt_in.video.chroma_location;
> +
> + video_format_t original = dec->fmt_out.video;
> + dec->fmt_out.video = fmt_out;
> + int err = dec->cbs->video.format_update( dec );
> + dec->fmt_out.video = original;
> + return err;
Maybe it's better to fix the few video decoders that override fmt_out colorimetry with invalid values, no ?
> }
>
> picture_t *decoder_NewPicture( decoder_t *dec )
> --
> 2.17.1
>
> _______________________________________________
> 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