diff options
author | James Almer <jamrial@gmail.com> | 2020-12-06 12:30:14 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2020-12-07 14:22:52 -0300 |
commit | 1aa72fe79454c8f0a9adcd9ac7e6fbd20bbfe1a4 (patch) | |
tree | bcd899a7457055f2a4d4c323af3d0ee2b85e81e7 /libavcodec/dynamic_hdr10_plus.c | |
parent | b9f7c9b2723f44aa7850c24f9dcbb6a4e3ac555f (diff) |
avcodec/dynamic_hdr10_plus: don't take a GetBitContext as input argument
Create a local one instead from a byte buffer input argument.
This prevents skipping bytes that may belong to another SEI message.
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/dynamic_hdr10_plus.c')
-rw-r--r-- | libavcodec/dynamic_hdr10_plus.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libavcodec/dynamic_hdr10_plus.c b/libavcodec/dynamic_hdr10_plus.c index bf0d085b8f..4b2ecdb72e 100644 --- a/libavcodec/dynamic_hdr10_plus.c +++ b/libavcodec/dynamic_hdr10_plus.c @@ -17,6 +17,7 @@ */ #include "dynamic_hdr10_plus.h" +#include "get_bits.h" static const uint8_t usa_country_code = 0xB5; static const uint16_t smpte_provider_code = 0x003C; @@ -30,11 +31,19 @@ static const int32_t knee_point_den = 4095; static const int32_t bezier_anchor_den = 1023; static const int32_t saturation_weight_den = 8; -int ff_parse_itu_t_t35_to_dynamic_hdr10_plus(GetBitContext *gb, AVDynamicHDRPlus *s) +int ff_parse_itu_t_t35_to_dynamic_hdr10_plus(AVDynamicHDRPlus *s, const uint8_t *data, + int size) { + GetBitContext gbc, *gb = &gbc; + int ret; + if (!s) return AVERROR(ENOMEM); + ret = init_get_bits8(gb, data, size); + if (ret < 0) + return ret; + s->application_version = get_bits(gb, 8); if (get_bits_left(gb) < 2) @@ -189,7 +198,5 @@ int ff_parse_itu_t_t35_to_dynamic_hdr10_plus(GetBitContext *gb, AVDynamicHDRPlus } } - skip_bits(gb, get_bits_left(gb)); - return 0; } |