aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-08-11 15:15:19 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-08-11 15:15:54 +0200
commit11512d70facf42fb490168d33a5986448cf36074 (patch)
treedbb256b6069b75adcb30442cf48022cf92ee127c /libavcodec
parent7b3de03c8fa7c7a49522b45dc90f9970417554b4 (diff)
downloadffmpeg-11512d70facf42fb490168d33a5986448cf36074.tar.gz
avcodec/get_bits: add BITS_LEFT() for finding the bits left with an opened reader
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/get_bits.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index fd32535d2a..90235e319b 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -113,6 +113,9 @@ typedef struct RL_VLC_ELEM {
* LAST_SKIP_BITS(name, gb, num)
* Like SKIP_BITS, to be used if next call is UPDATE_CACHE or CLOSE_READER.
*
+ * BITS_LEFT(name, gb)
+ * Return the number of bits left
+ *
* For examples see get_bits, show_bits, skip_bits, get_vlc.
*/
@@ -179,6 +182,8 @@ typedef struct RL_VLC_ELEM {
name ## _index = FFMIN(name ## _size_plus8, name ## _index + (num))
#endif
+#define BITS_LEFT(name, gb) ((int)((gb)->size_in_bits - name ## _index))
+
#define SKIP_BITS(name, gb, num) \
do { \
SKIP_CACHE(name, gb, num); \