mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-02-26 00:31:12 +00:00
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
This commit is contained in:
parent
f8280ff4c0
commit
603e5c0b71
@ -23,6 +23,7 @@
|
|||||||
#include "libavutil/intreadwrite.h"
|
#include "libavutil/intreadwrite.h"
|
||||||
#include "avformat.h"
|
#include "avformat.h"
|
||||||
#include "avio.h"
|
#include "avio.h"
|
||||||
|
#include "internal.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#define IO_BUFFER_SIZE 32768
|
#define IO_BUFFER_SIZE 32768
|
||||||
@ -248,6 +249,24 @@ void put_strz(ByteIOContext *s, const char *str)
|
|||||||
put_byte(s, 0);
|
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)
|
void put_le64(ByteIOContext *s, uint64_t val)
|
||||||
{
|
{
|
||||||
put_le32(s, (uint32_t)(val & 0xffffffff));
|
put_le32(s, (uint32_t)(val & 0xffffffff));
|
||||||
|
@ -157,4 +157,14 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c,
|
|||||||
int ff_write_chained(AVFormatContext *dst, int dst_stream, AVPacket *pkt,
|
int ff_write_chained(AVFormatContext *dst, int dst_stream, AVPacket *pkt,
|
||||||
AVFormatContext *src);
|
AVFormatContext *src);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the length in bytes which is needed to store val as v.
|
||||||
|
*/
|
||||||
|
int ff_get_v_length(uint64_t val);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put val using a variable number of bytes.
|
||||||
|
*/
|
||||||
|
void ff_put_v(ByteIOContext *bc, uint64_t val);
|
||||||
|
|
||||||
#endif /* AVFORMAT_INTERNAL_H */
|
#endif /* AVFORMAT_INTERNAL_H */
|
||||||
|
@ -241,27 +241,6 @@ static void build_frame_code(AVFormatContext *s){
|
|||||||
nut->frame_code['N'].flags= FLAG_INVALID;
|
nut->frame_code['N'].flags= FLAG_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the length in bytes which is needed to store val as v.
|
|
||||||
*/
|
|
||||||
static int ff_get_v_length(uint64_t val){
|
|
||||||
int i=1;
|
|
||||||
|
|
||||||
while(val>>=7)
|
|
||||||
i++;
|
|
||||||
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
static 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void put_tt(NUTContext *nut, StreamContext *nus, ByteIOContext *bc, uint64_t val){
|
static void put_tt(NUTContext *nut, StreamContext *nus, ByteIOContext *bc, uint64_t val){
|
||||||
val *= nut->time_base_count;
|
val *= nut->time_base_count;
|
||||||
val += nus->time_base - nut->time_base;
|
val += nus->time_base - nut->time_base;
|
||||||
|
Loading…
Reference in New Issue
Block a user