[vlc-devel] [PATCH 01/13] decoder: forward the source colorimetry if the decoder doesn't set it
Steve Lhomme
robux4 at ycbcr.xyz
Tue Feb 19 11:02:09 CET 2019
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;
+ 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;
}
picture_t *decoder_NewPicture( decoder_t *dec )
--
2.17.1
More information about the vlc-devel
mailing list