[FFmpeg-cvslog] avcodec/get_bits: add BITS_LEFT() for finding the bits left with an opened reader

Michael Niedermayer git at videolan.org
Mon Aug 11 16:59:47 CEST 2014


ffmpeg | branch: release/2.3 | Michael Niedermayer <michaelni at gmx.at> | Mon Aug 11 15:15:19 2014 +0200| [6badd558ce19dffe8c3ea3e687812b933e0cb2ff] | committer: Michael Niedermayer

avcodec/get_bits: add BITS_LEFT() for finding the bits left with an opened reader

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 11512d70facf42fb490168d33a5986448cf36074)

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

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

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

diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index d8d7b6e..d67263c 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);              \



More information about the ffmpeg-cvslog mailing list