mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-09-19 21:06:42 +00:00
avcodec/put_bits: Add rebase_put_bits()
Reviewed-by: Benoit Fouet <benoit.fouet@free.fr> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
8ba6945487
commit
cf32181b70
@ -62,6 +62,24 @@ static inline void init_put_bits(PutBitContext *s, uint8_t *buffer,
|
||||
s->bit_buf = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebase the bit writer onto a reallocated buffer.
|
||||
*
|
||||
* @param buffer the buffer where to put bits
|
||||
* @param buffer_size the size in bytes of buffer,
|
||||
* must be larger than the previous size
|
||||
*/
|
||||
static inline void rebase_put_bits(PutBitContext *s, uint8_t *buffer,
|
||||
int buffer_size)
|
||||
{
|
||||
av_assert0(8*buffer_size > s->size_in_bits);
|
||||
|
||||
s->buf_end = buffer + buffer_size;
|
||||
s->buf_ptr = buffer + (s->buf_ptr - s->buf);
|
||||
s->buf = buffer;
|
||||
s->size_in_bits = 8 * buffer_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the total number of bits written to the bitstream.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user