upipe/ubits.h header reference
Upipe bit-oriented writer and reader More
Header inclusion [link]
Members [link]
Types [link]
- struct ubits
- enum ubits_direction
Functions [link]
- int ubits_clean(struct ubits *s, uint8_t **buffer_end_p)
- uint32_t ubits_get(struct ubits *s, uint8_t nb)
- void ubits_init(struct ubits *s, uint8_t *buffer, size_t buffer_size, enum ubits_direction dir)
- void ubits_put(struct ubits *s, uint8_t nb, uint32_t value)
Description [link]
Upipe bit-oriented writer and reader
Members detail [link]
#define _UPIPE_UBITS_H_ [link]
This macro is declared in upipe/ubits.h source file, line 31.
struct ubits [link]
This struct is declared in upipe/ubits.h source file, line 44.
This struct is a helper allowing to write bits by bits to a buffer.
| Field | Description |
|---|---|
| uint8_t * buffer; | pointer to buffer |
| uint8_t * buffer_end; | end of buffer |
| uint32_t bits; | bits cache |
| uint32_t available; | number of available bits |
| bool overflow; | true if the bit stream cache overflows |
This function is declared in upipe/ubits.h source file, line 167.
This function cleans up the helper structure for bit-oriented writer.
Parameter list:
- s: helper structure
- buffer_end_p: filled in with a pointer to the first non-written octet
The return value is an error code
enum ubits_direction [link]
This enum is declared in upipe/ubits.h source file, line 58.
| Identifier | Value | Description |
|---|---|---|
| UBITS_WRITE | 0 | |
| UBITS_READ | 1 |
This function is declared in upipe/ubits.h source file, line 86.
This function returns up to 32 bits read from the bitstream.
Parameter list:
- s: helper structure
- nb: number of bits to read
void ubits_init(struct ubits *s, uint8_t *buffer, size_t buffer_size, enum ubits_direction dir) [link]
This function is declared in upipe/ubits.h source file, line 72.
This function initializes the helper structure for bit-oriented writer.
Parameter list:
- s: helper structure
- buffer: pointer to buffer
- buffer_size: buffer size in octets
- dir: direction (read or write)
This function is declared in upipe/ubits.h source file, line 135.
This function puts up to 32 bits into the bitstream.
Parameter list:
- s: helper structure
- nb: number of bits to write
- value: value to write