diff options
author | James Almer <jamrial@gmail.com> | 2019-04-13 16:10:19 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2019-04-14 14:51:51 -0300 |
commit | 62074b8f85e083212abdf09c849e148e7634f5a2 (patch) | |
tree | 928a18f238ee1ef633e33f8f17526ffbde220891 /libavcodec/cbs_av1.c | |
parent | b18c8688dd4f097776572d4f78f12f19881c8057 (diff) | |
download | ffmpeg-62074b8f85e083212abdf09c849e148e7634f5a2.tar.gz |
avcodec/cbs_av1: add a function to strip trailing zeroes from a buffer size
Factor it out from cbs_av1_read_metadata_itut_t35()
Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/cbs_av1.c')
-rw-r--r-- | libavcodec/cbs_av1.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c index f02cca2dad..f8f7e5f050 100644 --- a/libavcodec/cbs_av1.c +++ b/libavcodec/cbs_av1.c @@ -574,6 +574,17 @@ static int cbs_av1_get_relative_dist(const AV1RawSequenceHeader *seq, return diff; } +static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) +{ + GetBitContext tmp = *gbc; + size_t size = 0; + for (int i = 0; get_bits_left(&tmp) >= 8; i++) { + if (get_bits(&tmp, 8)) + size = i; + } + return size; +} + #define HEADER(name) do { \ ff_cbs_trace_header(ctx, name); \ |