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

Steve Lhomme robux4 at ycbcr.xyz
Wed Jun 5 17:50:25 CEST 2019


For now we don't overwrite the video format handled by the decoder.
---
 src/input/decoder_helpers.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
index 3d1c574cb7..d42ee64cb5 100644
--- a/src/input/decoder_helpers.c
+++ b/src/input/decoder_helpers.c
@@ -81,7 +81,23 @@ int decoder_UpdateVideoFormat( decoder_t *dec )
                   dec->cbs->video.format_update == NULL) )
         return -1;
 
-    return dec->cbs->video.format_update( dec );
+    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;
 }
 
 picture_t *decoder_NewPicture( decoder_t *dec )
-- 
2.17.1



More information about the vlc-devel mailing list