[vlc-commits] vlc_bits.h: drop len field
Francois Cartegnie
git at videolan.org
Thu Mar 19 20:54:59 CET 2015
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Mar 19 18:57:44 2015 +0100| [e2d1ee3c0e416c823682b757766f5f51eacfb43c] | committer: Francois Cartegnie
vlc_bits.h: drop len field
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e2d1ee3c0e416c823682b757766f5f51eacfb43c
---
include/vlc_bits.h | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/include/vlc_bits.h b/include/vlc_bits.h
index 1eba5e9..ee3cfed 100644
--- a/include/vlc_bits.h
+++ b/include/vlc_bits.h
@@ -36,7 +36,6 @@
typedef struct bo_t
{
block_t *b;
- size_t len;
size_t basesize;
} bo_t;
@@ -212,25 +211,25 @@ static inline int bo_init(bo_t *p_bo, int i_size)
return VLC_ENOMEM;
p_bo->b->i_buffer = 0;
- p_bo->len = p_bo->basesize = i_size;
+ p_bo->basesize = i_size;
return VLC_SUCCESS;
}
static inline void bo_set_8(bo_t *p_bo, size_t i_offset, uint8_t i)
{
- if (i_offset >= p_bo->len)
+ size_t i_size = p_bo->b->i_size - (p_bo->b->p_buffer - p_bo->b->p_start);
+ if (i_offset >= i_size)
{
int i_growth = p_bo->basesize;
- while(i_offset >= p_bo->len + i_growth)
+ while(i_offset >= i_size + i_growth)
i_growth += p_bo->basesize;
int i = p_bo->b->i_buffer; /* Realloc would set payload size == buffer size */
- p_bo->b = block_Realloc(p_bo->b, 0, p_bo->len + i_growth);
+ p_bo->b = block_Realloc(p_bo->b, 0, i_size + i_growth);
if (!p_bo->b)
return;
p_bo->b->i_buffer = i;
- p_bo->len += i_growth;
}
p_bo->b->p_buffer[i_offset] = i;
}
@@ -336,12 +335,4 @@ static inline void bo_add_mem(bo_t *p_bo, int i_size, const uint8_t *p_mem)
bo_add_8(p_bo, p_mem[i]);
}
-static inline void bo_add_mp4_tag_descr(bo_t *p_bo, uint8_t tag, uint32_t size)
-{
- bo_add_8(p_bo, tag);
- for (int i = 3; i>0; i--)
- bo_add_8(p_bo, (size>>(7*i)) | 0x80);
- bo_add_8(p_bo, size & 0x7F);
-}
-
#endif
More information about the vlc-commits
mailing list