[vlc-devel] [PATCH 1/3] decoder: forward the source colorimetry if the decoder doesn't set it

Steve Lhomme robux4 at ycbcr.xyz
Mon Feb 18 16:56:40 CET 2019


---
 src/input/decoder_helpers.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
index 3cc02de8d6..a019a540df 100644
--- a/src/input/decoder_helpers.c
+++ b/src/input/decoder_helpers.c
@@ -79,6 +79,22 @@ int decoder_UpdateVideoFormat( decoder_t *dec )
                   dec->cbs->video.format_update == NULL) )
         return -1;
 
+    if ( dec->fmt_in.video.color_range != COLOR_RANGE_UNDEF &&
+         dec->fmt_out.video.color_range == COLOR_RANGE_UNDEF )
+        dec->fmt_out.video.color_range = dec->fmt_in.video.color_range;
+    if ( dec->fmt_in.video.space != COLOR_SPACE_UNDEF &&
+         dec->fmt_out.video.space != COLOR_SPACE_UNDEF )
+        dec->fmt_out.video.space = dec->fmt_in.video.space;
+    if ( dec->fmt_in.video.transfer != TRANSFER_FUNC_UNDEF &&
+         dec->fmt_out.video.transfer != TRANSFER_FUNC_UNDEF )
+        dec->fmt_out.video.transfer = dec->fmt_in.video.transfer;
+    if ( dec->fmt_in.video.primaries != COLOR_PRIMARIES_UNDEF &&
+         dec->fmt_out.video.primaries != COLOR_PRIMARIES_UNDEF )
+        dec->fmt_out.video.primaries = dec->fmt_in.video.primaries;
+    if ( dec->fmt_in.video.chroma_location != CHROMA_LOCATION_UNDEF &&
+         dec->fmt_out.video.chroma_location != CHROMA_LOCATION_UNDEF )
+        dec->fmt_out.video.chroma_location = dec->fmt_in.video.chroma_location;
+
     return dec->cbs->video.format_update( dec );
 }
 
-- 
2.17.1



More information about the vlc-devel mailing list