diff options
author | Michael Chinen | 2010-07-09 12:14:33 +0000 |
---|---|---|
committer | Janne Grunau | 2010-07-09 12:14:33 +0000 |
commit | 603e5c0b711171fd0110745f4c1e650ac6c26760 (patch) | |
tree | f41ca1b95ded385739110c1abf420bc1c3710478 /libavformat/aviobuf.c | |
parent | f8280ff4c00eeaa245085fa9691035203abd168c (diff) |
move ff_get_v_length and ff_put_v from nutenc.c to internal.h/aviobuf.c
patch by Micheal Chinen < mchinen gmail >
Originally committed as revision 24140 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r-- | libavformat/aviobuf.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index d97ffd5e62..9f1187efe7 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -23,6 +23,7 @@ #include "libavutil/intreadwrite.h" #include "avformat.h" #include "avio.h" +#include "internal.h" #include <stdarg.h> #define IO_BUFFER_SIZE 32768 @@ -248,6 +249,24 @@ void put_strz(ByteIOContext *s, const char *str) put_byte(s, 0); } +int ff_get_v_length(uint64_t val){ + int i=1; + + while(val>>=7) + i++; + + return i; +} + +void ff_put_v(ByteIOContext *bc, uint64_t val){ + int i= ff_get_v_length(val); + + while(--i>0) + put_byte(bc, 128 | (val>>(7*i))); + + put_byte(bc, val&127); +} + void put_le64(ByteIOContext *s, uint64_t val) { put_le32(s, (uint32_t)(val & 0xffffffff)); |