summaryrefslogtreecommitdiff
path: root/libavcodec/h264_sei.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2017-06-09 17:27:22 -0400
committerVittorio Giovara <vittorio.giovara@gmail.com>2017-08-10 15:40:16 +0200
commit8c34a2024da77b50470e62789e4859b45959932e (patch)
tree2d1e483df3ef247682b335743dc8eb6875233c27 /libavcodec/h264_sei.c
parent9042402ec78ad050eb7ad129610450ef90371df4 (diff)
h264: Add support for alternative transfer characterics SEI
The use of this SEI is for backward compatibility in HLG HDR systems: older devices that cannot interpret the "arib-std-b67" transfer will get the compatible transfer (usually bt709 or bt2020) from the VUI, while newer devices that can interpret HDR will read the SEI and use its value instead. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Diffstat (limited to 'libavcodec/h264_sei.c')
-rw-r--r--libavcodec/h264_sei.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index a7e627eba3..889bea2ee0 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -382,6 +382,14 @@ static int decode_green_metadata(H264SEIGreenMetaData *h, GetBitContext *gb)
return 0;
}
+static int decode_alternative_transfer(H264SEIAlternativeTransfer *h,
+ GetBitContext *gb)
+{
+ h->present = 1;
+ h->preferred_transfer_characteristics = get_bits(gb, 8);
+ return 0;
+}
+
int ff_h264_sei_decode(H264SEIContext *h, GetBitContext *gb,
const H264ParamSets *ps, void *logctx)
{
@@ -437,6 +445,9 @@ int ff_h264_sei_decode(H264SEIContext *h, GetBitContext *gb,
case SEI_TYPE_GREEN_METADATA:
ret = decode_green_metadata(&h->green_metadata, gb);
break;
+ case SEI_TYPE_ALTERNATIVE_TRANSFER:
+ ret = decode_alternative_transfer(&h->alternative_transfer, gb);
+ break;
default:
av_log(logctx, AV_LOG_DEBUG, "unknown SEI type %d\n", type);
}