X-Git-Url: https://git.sesse.net/?p=fjl;a=blobdiff_plain;f=bitsource.h;h=ae29b4c4a2200abce210242a541be2c289ea8163;hp=bb3a6d246e62016665e5560ac048397b15f7f8e9;hb=9069ae93f3e9e9b44f5f28968f508d09f0711737;hpb=8445e04bae016b6bd74705902972e66ae7fe37c1;ds=sidebyside diff --git a/bitsource.h b/bitsource.h index bb3a6d2..ae29b4c 100644 --- a/bitsource.h +++ b/bitsource.h @@ -37,12 +37,18 @@ struct bit_source { uint8_t* byte_read_ptr; unsigned bytes_available; + // Some clients will purposedly read a bit ahead of the stream, causing + // problems at EOF. Thus, the client is allowed to request that we pad + // the end stream with a few bytes after the source reports EOF. + int padding_bytes_available; + // Data source. input_func_t* input_func; void* userdata; }; -void init_bit_source(struct bit_source* source, input_func_t* input_func, void* userdata); +void init_bit_source(struct bit_source* source, input_func_t* input_func, + unsigned padding_bytes, void* userdata); // Internal function. Do not use. void possibly_refill_slow_path(struct bit_source* source, unsigned num_bits);