diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-10-30 18:22:03 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-10-30 18:22:03 +0100 |
commit | 44e8e82d347fe2c19b84b74f419aeae73f4347ce (patch) | |
tree | 557a20b4b3c15d8eef6522913e25a20a5ae57d3b /libavcodec/get_bits.h | |
parent | 7f019129e1bdeeb7fd0af05dc002b133df530f03 (diff) | |
download | ffmpeg-44e8e82d347fe2c19b84b74f419aeae73f4347ce.tar.gz |
avcodec/get_bits: add skip_1stop_8data_bits
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/get_bits.h')
-rw-r--r-- | libavcodec/get_bits.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h index 4ddb08817b..7824e5ab0f 100644 --- a/libavcodec/get_bits.h +++ b/libavcodec/get_bits.h @@ -585,6 +585,20 @@ static inline int get_bits_left(GetBitContext *gb) return gb->size_in_bits - get_bits_count(gb); } +static inline int skip_1stop_8data_bits(GetBitContext *gb) +{ + if (get_bits_left(gb) <= 0) + return AVERROR_INVALIDDATA; + + while (get_bits1(gb)) { + skip_bits(gb, 8); + if (get_bits_left(gb) <= 0) + return AVERROR_INVALIDDATA; + } + + return 0; +} + //#define TRACE #ifdef TRACE |