* Initialize GetBitContext. * @param buffer bitstream buffer, must be AV_INPUT_BUFFER_PADDING_SIZE bytes * larger than the actual read bits because some optimized bitstream * readers read 32 or 64 bit at once and could read over the end * @param byte_size the size of the buffer in bytes * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow. */
| 542 | * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow. |
| 543 | */ |
| 544 | static inline int init_get_bits8(GetBitContext *s, const uint8_t *buffer, |
| 545 | int byte_size) |
| 546 | { |
| 547 | if (byte_size > INT_MAX / 8 || byte_size < 0) |
| 548 | byte_size = -1; |
| 549 | return init_get_bits(s, buffer, byte_size * 8); |
| 550 | } |
| 551 | |
| 552 | static inline int init_get_bits8_le(GetBitContext *s, const uint8_t *buffer, |
| 553 | int byte_size) |