]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/get_bits: add skip_1stop_8data_bits
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 30 Oct 2013 17:22:03 +0000 (18:22 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 30 Oct 2013 17:22:03 +0000 (18:22 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/get_bits.h

index 4ddb08817b4450348bcb520e6cd6c5f3361e34df..7824e5ab0fda1a17326ebec463fff5929a7d3a11 100644 (file)
@@ -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