[vlc-devel] [PATCH 1/4] dec: used the container colorimetry values on the output if they are known

Steve Lhomme robux4 at ycbcr.xyz
Thu Dec 13 10:02:40 CET 2018


The container wraps the codec data, so if it sets a different value than the
one stored in the codec, it must be used.

---
Deprecates https://patches.videolan.org/patch/22224/ and https://patches.videolan.org/patch/22223/
---
 include/vlc_codec.h | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/include/vlc_codec.h b/include/vlc_codec.h
index 88965e7337..f0b6d572fa 100644
--- a/include/vlc_codec.h
+++ b/include/vlc_codec.h
@@ -273,10 +273,18 @@ static inline int decoder_UpdateVideoFormat( decoder_t *dec )
 {
     vlc_assert( dec->fmt_in.i_cat == VIDEO_ES && dec->cbs != NULL );
 
+    if ( dec->fmt_in.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 = dec->fmt_in.video.transfer;
+    if ( dec->fmt_in.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 = dec->fmt_in.video.chroma_location;
+
     if( dec->fmt_in.i_cat == VIDEO_ES && dec->cbs->video.format_update != NULL )
         return dec->cbs->video.format_update( dec );
-    else
-        return -1;
+    return -1;
 }
 
 /**
-- 
2.17.1



More information about the vlc-devel mailing list