bytestream: add functions for accessing size of buffer
authorPaul B Mahol <onemda@gmail.com>
Wed, 21 Mar 2012 00:10:18 +0000 (00:10 +0000)
committerSean McGovern <gseanmcg@gmail.com>
Tue, 15 Apr 2014 03:18:53 +0000 (23:18 -0400)
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
CC:libav-stable@libav.org
(cherry picked from commit de9d2705f61ef569487ec5f8974a9c7ce34ec783)

libavcodec/bytestream.h

index 0f89558..63d61f1 100644 (file)
@@ -190,6 +190,16 @@ static av_always_inline int bytestream2_tell_p(PutByteContext *p)
     return (int)(p->buffer - p->buffer_start);
 }
 
+static av_always_inline int bytestream2_size(GetByteContext *g)
+{
+    return (int)(g->buffer_end - g->buffer_start);
+}
+
+static av_always_inline int bytestream2_size_p(PutByteContext *p)
+{
+    return (int)(p->buffer_end - p->buffer_start);
+}
+
 static av_always_inline int bytestream2_seek(GetByteContext *g,
                                              int offset,
                                              int whence)