[FFmpeg-cvslog] avcodec/get_bits: add skip_1stop_8data_bits

Michael Niedermayer git at videolan.org
Wed Oct 30 18:35:33 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Oct 30 18:22:03 2013 +0100| [44e8e82d347fe2c19b84b74f419aeae73f4347ce] | committer: Michael Niedermayer

avcodec/get_bits: add skip_1stop_8data_bits

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=44e8e82d347fe2c19b84b74f419aeae73f4347ce
---

 libavcodec/get_bits.h |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index 4ddb088..7824e5a 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



More information about the ffmpeg-cvslog mailing list