| 1 |
.TH "decode.h" 3 "August 2021" "Brotli" \" -*- nroff -*- |
| 2 |
.ad l |
| 3 |
.nh |
| 4 |
.SH NAME |
| 5 |
decode.h \- API for Brotli decompression\&. |
| 6 |
|
| 7 |
.SH SYNOPSIS |
| 8 |
.br |
| 9 |
.PP |
| 10 |
.SS "Macros" |
| 11 |
|
| 12 |
.in +1c |
| 13 |
.ti -1c |
| 14 |
.RI "#define \fBBROTLI_DECODER_ERROR_CODES_LIST\fP(BROTLI_ERROR_CODE, SEPARATOR) " |
| 15 |
.br |
| 16 |
.RI "\fITemplate that evaluates items of \fBBrotliDecoderErrorCode\fP\&. \fP" |
| 17 |
.ti -1c |
| 18 |
.RI "#define \fBBROTLI_LAST_ERROR_CODE\fP BROTLI_DECODER_ERROR_UNREACHABLE" |
| 19 |
.br |
| 20 |
.RI "\fIThe value of the last error code, negative integer\&. \fP" |
| 21 |
.in -1c |
| 22 |
.SS "Typedefs" |
| 23 |
|
| 24 |
.in +1c |
| 25 |
.ti -1c |
| 26 |
.RI "typedef void(* \fBbrotli_decoder_metadata_chunk_func\fP) (void *opaque, const uint8_t *data, size_t size)" |
| 27 |
.br |
| 28 |
.RI "\fICallback to fire on metadata block chunk becomes available\&. \fP" |
| 29 |
.ti -1c |
| 30 |
.RI "typedef void(* \fBbrotli_decoder_metadata_start_func\fP) (void *opaque, size_t size)" |
| 31 |
.br |
| 32 |
.RI "\fICallback to fire on metadata block start\&. \fP" |
| 33 |
.ti -1c |
| 34 |
.RI "typedef enum \fBBrotliDecoderParameter\fP \fBBrotliDecoderParameter\fP" |
| 35 |
.br |
| 36 |
.RI "\fIOptions to be used with \fBBrotliDecoderSetParameter\fP\&. \fP" |
| 37 |
.ti -1c |
| 38 |
.RI "typedef struct BrotliDecoderStateStruct \fBBrotliDecoderState\fP" |
| 39 |
.br |
| 40 |
.RI "\fIOpaque structure that holds decoder state\&. \fP" |
| 41 |
.in -1c |
| 42 |
.SS "Enumerations" |
| 43 |
.SS "Functions" |
| 44 |
|
| 45 |
.in +1c |
| 46 |
.ti -1c |
| 47 |
.RI "\fBBROTLI_BOOL\fP \fBBrotliDecoderAttachDictionary\fP (\fBBrotliDecoderState\fP *state, BrotliSharedDictionaryType type, size_t data_size, const uint8_t data[data_size])" |
| 48 |
.br |
| 49 |
.RI "\fIAdds LZ77 prefix dictionary, adds or replaces built-in static dictionary and transforms\&. \fP" |
| 50 |
.ti -1c |
| 51 |
.RI "\fBBrotliDecoderState\fP * \fBBrotliDecoderCreateInstance\fP (\fBbrotli_alloc_func\fP alloc_func, \fBbrotli_free_func\fP free_func, void *opaque)" |
| 52 |
.br |
| 53 |
.RI "\fICreates an instance of \fBBrotliDecoderState\fP and initializes it\&. \fP" |
| 54 |
.ti -1c |
| 55 |
.RI "\fBBrotliDecoderResult\fP \fBBrotliDecoderDecompress\fP (size_t encoded_size, const uint8_t encoded_buffer[encoded_size], size_t *decoded_size, uint8_t decoded_buffer[*decoded_size])" |
| 56 |
.br |
| 57 |
.RI "\fIPerforms one-shot memory-to-memory decompression\&. \fP" |
| 58 |
.ti -1c |
| 59 |
.RI "\fBBrotliDecoderResult\fP \fBBrotliDecoderDecompressStream\fP (\fBBrotliDecoderState\fP *state, size_t *available_in, const uint8_t **next_in, size_t *available_out, uint8_t **next_out, size_t *total_out)" |
| 60 |
.br |
| 61 |
.RI "\fIDecompresses the input stream to the output stream\&. \fP" |
| 62 |
.ti -1c |
| 63 |
.RI "void \fBBrotliDecoderDestroyInstance\fP (\fBBrotliDecoderState\fP *state)" |
| 64 |
.br |
| 65 |
.RI "\fIDeinitializes and frees \fBBrotliDecoderState\fP instance\&. \fP" |
| 66 |
.ti -1c |
| 67 |
.RI "const char * \fBBrotliDecoderErrorString\fP (\fBBrotliDecoderErrorCode\fP c)" |
| 68 |
.br |
| 69 |
.RI "\fIConverts error code to a c-string\&. \fP" |
| 70 |
.ti -1c |
| 71 |
.RI "\fBBrotliDecoderErrorCode\fP \fBBrotliDecoderGetErrorCode\fP (const \fBBrotliDecoderState\fP *state)" |
| 72 |
.br |
| 73 |
.RI "\fIAcquires a detailed error code\&. \fP" |
| 74 |
.ti -1c |
| 75 |
.RI "\fBBROTLI_BOOL\fP \fBBrotliDecoderHasMoreOutput\fP (const \fBBrotliDecoderState\fP *state)" |
| 76 |
.br |
| 77 |
.RI "\fIChecks if decoder has more output\&. \fP" |
| 78 |
.ti -1c |
| 79 |
.RI "\fBBROTLI_BOOL\fP \fBBrotliDecoderIsFinished\fP (const \fBBrotliDecoderState\fP *state)" |
| 80 |
.br |
| 81 |
.RI "\fIChecks if decoder instance reached the final state\&. \fP" |
| 82 |
.ti -1c |
| 83 |
.RI "\fBBROTLI_BOOL\fP \fBBrotliDecoderIsUsed\fP (const \fBBrotliDecoderState\fP *state)" |
| 84 |
.br |
| 85 |
.RI "\fIChecks if instance has already consumed input\&. \fP" |
| 86 |
.ti -1c |
| 87 |
.RI "void \fBBrotliDecoderSetMetadataCallbacks\fP (\fBBrotliDecoderState\fP *state, \fBbrotli_decoder_metadata_start_func\fP start_func, \fBbrotli_decoder_metadata_chunk_func\fP chunk_func, void *opaque)" |
| 88 |
.br |
| 89 |
.RI "\fISets callback for receiving metadata blocks\&. \fP" |
| 90 |
.ti -1c |
| 91 |
.RI "\fBBROTLI_BOOL\fP \fBBrotliDecoderSetParameter\fP (\fBBrotliDecoderState\fP *state, \fBBrotliDecoderParameter\fP param, uint32_t value)" |
| 92 |
.br |
| 93 |
.RI "\fISets the specified parameter to the given decoder instance\&. \fP" |
| 94 |
.ti -1c |
| 95 |
.RI "const uint8_t * \fBBrotliDecoderTakeOutput\fP (\fBBrotliDecoderState\fP *state, size_t *size)" |
| 96 |
.br |
| 97 |
.RI "\fIAcquires pointer to internal output buffer\&. \fP" |
| 98 |
.ti -1c |
| 99 |
.RI "uint32_t \fBBrotliDecoderVersion\fP (void)" |
| 100 |
.br |
| 101 |
.RI "\fIGets a decoder library version\&. \fP" |
| 102 |
.in -1c |
| 103 |
.SH "Detailed Description" |
| 104 |
.PP |
| 105 |
API for Brotli decompression\&. |
| 106 |
|
| 107 |
|
| 108 |
.SH "Macro Definition Documentation" |
| 109 |
.PP |
| 110 |
.SS "#define BROTLI_DECODER_ERROR_CODES_LIST(BROTLI_ERROR_CODE, SEPARATOR)" |
| 111 |
|
| 112 |
.PP |
| 113 |
Template that evaluates items of \fBBrotliDecoderErrorCode\fP\&. Example: |
| 114 |
.PP |
| 115 |
.nf |
| 116 |
// Log Brotli error code\&. |
| 117 |
switch (brotliDecoderErrorCode) { |
| 118 |
#define CASE_(PREFIX, NAME, CODE) \ |
| 119 |
case BROTLI_DECODER ## PREFIX ## NAME: \ |
| 120 |
LOG(INFO) << "error code:" << #NAME; \ |
| 121 |
break; |
| 122 |
#define NEWLINE_ |
| 123 |
BROTLI_DECODER_ERROR_CODES_LIST(CASE_, NEWLINE_) |
| 124 |
#undef CASE_ |
| 125 |
#undef NEWLINE_ |
| 126 |
default: LOG(FATAL) << "unknown brotli error code"; |
| 127 |
} |
| 128 |
|
| 129 |
.fi |
| 130 |
.PP |
| 131 |
|
| 132 |
.SS "#define BROTLI_LAST_ERROR_CODE BROTLI_DECODER_ERROR_UNREACHABLE" |
| 133 |
|
| 134 |
.PP |
| 135 |
The value of the last error code, negative integer\&. All other error code values are in the range from \fBBROTLI_LAST_ERROR_CODE\fP to \fC-1\fP\&. There are also 4 other possible non-error codes \fC0\fP \&.\&. \fC3\fP in \fBBrotliDecoderErrorCode\fP enumeration\&. |
| 136 |
.SH "Typedef Documentation" |
| 137 |
.PP |
| 138 |
.SS "typedef void(* brotli_decoder_metadata_chunk_func) (void *opaque, const uint8_t *data, size_t size)" |
| 139 |
|
| 140 |
.PP |
| 141 |
Callback to fire on metadata block chunk becomes available\&. This function can be invoked multiple times per metadata block; block should be considered finished when sum of \fCsize\fP matches the announced metadata block size\&. Chunks contents pointed by \fCdata\fP are transient and shouln not be accessed after leaving the callback\&. |
| 142 |
.PP |
| 143 |
\fBParameters:\fP |
| 144 |
.RS 4 |
| 145 |
\fIopaque\fP callback handle |
| 146 |
.br |
| 147 |
\fIdata\fP pointer to metadata contents |
| 148 |
.br |
| 149 |
\fIsize\fP size of metadata block chunk, at least \fC1\fP |
| 150 |
.RE |
| 151 |
.PP |
| 152 |
|
| 153 |
.SS "typedef void(* brotli_decoder_metadata_start_func) (void *opaque, size_t size)" |
| 154 |
|
| 155 |
.PP |
| 156 |
Callback to fire on metadata block start\&. After this callback is fired, if \fCsize\fP is not \fC0\fP, it is followed by \fBbrotli_decoder_metadata_chunk_func\fP as more metadata block contents become accessible\&. |
| 157 |
.PP |
| 158 |
\fBParameters:\fP |
| 159 |
.RS 4 |
| 160 |
\fIopaque\fP callback handle |
| 161 |
.br |
| 162 |
\fIsize\fP size of metadata block |
| 163 |
.RE |
| 164 |
.PP |
| 165 |
|
| 166 |
.SS "typedef enum \fBBrotliDecoderParameter\fP \fBBrotliDecoderParameter\fP" |
| 167 |
|
| 168 |
.PP |
| 169 |
Options to be used with \fBBrotliDecoderSetParameter\fP\&. |
| 170 |
.SS "typedef struct BrotliDecoderStateStruct \fBBrotliDecoderState\fP" |
| 171 |
|
| 172 |
.PP |
| 173 |
Opaque structure that holds decoder state\&. Allocated and initialized with \fBBrotliDecoderCreateInstance\fP\&. Cleaned up and deallocated with \fBBrotliDecoderDestroyInstance\fP\&. |
| 174 |
.SH "Enumeration Type Documentation" |
| 175 |
.PP |
| 176 |
.SS "enum \fBBrotliDecoderErrorCode\fP" |
| 177 |
|
| 178 |
.PP |
| 179 |
Error code for detailed logging / production debugging\&. See \fBBrotliDecoderGetErrorCode\fP and \fBBROTLI_LAST_ERROR_CODE\fP\&. |
| 180 |
.SS "enum \fBBrotliDecoderParameter\fP" |
| 181 |
|
| 182 |
.PP |
| 183 |
Options to be used with \fBBrotliDecoderSetParameter\fP\&. |
| 184 |
.PP |
| 185 |
\fBEnumerator\fP |
| 186 |
.in +1c |
| 187 |
.TP |
| 188 |
\fB\fIBROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION \fP\fP |
| 189 |
Disable 'canny' ring buffer allocation strategy\&. Ring buffer is allocated according to window size, despite the real size of the content\&. |
| 190 |
.TP |
| 191 |
\fB\fIBROTLI_DECODER_PARAM_LARGE_WINDOW \fP\fP |
| 192 |
Flag that determines if 'Large Window Brotli' is used\&. |
| 193 |
.SS "enum \fBBrotliDecoderResult\fP" |
| 194 |
|
| 195 |
.PP |
| 196 |
Result type for \fBBrotliDecoderDecompress\fP and \fBBrotliDecoderDecompressStream\fP functions\&. |
| 197 |
.PP |
| 198 |
\fBEnumerator\fP |
| 199 |
.in +1c |
| 200 |
.TP |
| 201 |
\fB\fIBROTLI_DECODER_RESULT_ERROR \fP\fP |
| 202 |
Decoding error, e\&.g\&. corrupted input or memory allocation problem\&. |
| 203 |
.TP |
| 204 |
\fB\fIBROTLI_DECODER_RESULT_SUCCESS \fP\fP |
| 205 |
Decoding successfully completed\&. |
| 206 |
.TP |
| 207 |
\fB\fIBROTLI_DECODER_RESULT_NEEDS_MORE_INPUT \fP\fP |
| 208 |
Partially done; should be called again with more input\&. |
| 209 |
.TP |
| 210 |
\fB\fIBROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT \fP\fP |
| 211 |
Partially done; should be called again with more output\&. |
| 212 |
.SH "Function Documentation" |
| 213 |
.PP |
| 214 |
.SS "\fBBROTLI_BOOL\fP BrotliDecoderAttachDictionary (\fBBrotliDecoderState\fP * state, BrotliSharedDictionaryType type, size_t data_size, const uint8_t data[data_size])" |
| 215 |
|
| 216 |
.PP |
| 217 |
Adds LZ77 prefix dictionary, adds or replaces built-in static dictionary and transforms\&. Attached dictionary ownership is not transferred\&. Data provided to this method should be kept accessible until decoding is finished and decoder instance is destroyed\&. |
| 218 |
.PP |
| 219 |
\fBNote:\fP |
| 220 |
.RS 4 |
| 221 |
Dictionaries can NOT be attached after actual decoding is started\&. |
| 222 |
.RE |
| 223 |
.PP |
| 224 |
\fBParameters:\fP |
| 225 |
.RS 4 |
| 226 |
\fIstate\fP decoder instance |
| 227 |
.br |
| 228 |
\fItype\fP dictionary data format |
| 229 |
.br |
| 230 |
\fIdata_size\fP length of memory region pointed by \fCdata\fP |
| 231 |
.br |
| 232 |
\fIdata\fP dictionary data in format corresponding to \fCtype\fP |
| 233 |
.RE |
| 234 |
.PP |
| 235 |
\fBReturns:\fP |
| 236 |
.RS 4 |
| 237 |
\fBBROTLI_FALSE\fP if dictionary is corrupted, or dictionary count limit is reached |
| 238 |
.PP |
| 239 |
\fBBROTLI_TRUE\fP if dictionary is accepted / attached |
| 240 |
.RE |
| 241 |
.PP |
| 242 |
|
| 243 |
.SS "\fBBrotliDecoderState\fP* BrotliDecoderCreateInstance (\fBbrotli_alloc_func\fP alloc_func, \fBbrotli_free_func\fP free_func, void * opaque)" |
| 244 |
|
| 245 |
.PP |
| 246 |
Creates an instance of \fBBrotliDecoderState\fP and initializes it\&. The instance can be used once for decoding and should then be destroyed with \fBBrotliDecoderDestroyInstance\fP, it cannot be reused for a new decoding session\&. |
| 247 |
.PP |
| 248 |
\fCalloc_func\fP and \fCfree_func\fP \fBMUST\fP be both zero or both non-zero\&. In the case they are both zero, default memory allocators are used\&. \fCopaque\fP is passed to \fCalloc_func\fP and \fCfree_func\fP when they are called\&. \fCfree_func\fP has to return without doing anything when asked to free a NULL pointer\&. |
| 249 |
.PP |
| 250 |
\fBParameters:\fP |
| 251 |
.RS 4 |
| 252 |
\fIalloc_func\fP custom memory allocation function |
| 253 |
.br |
| 254 |
\fIfree_func\fP custom memory free function |
| 255 |
.br |
| 256 |
\fIopaque\fP custom memory manager handle |
| 257 |
.RE |
| 258 |
.PP |
| 259 |
\fBReturns:\fP |
| 260 |
.RS 4 |
| 261 |
\fC0\fP if instance can not be allocated or initialized |
| 262 |
.PP |
| 263 |
pointer to initialized \fBBrotliDecoderState\fP otherwise |
| 264 |
.RE |
| 265 |
.PP |
| 266 |
|
| 267 |
.SS "\fBBrotliDecoderResult\fP BrotliDecoderDecompress (size_t encoded_size, const uint8_t encoded_buffer[encoded_size], size_t * decoded_size, uint8_t decoded_buffer[*decoded_size])" |
| 268 |
|
| 269 |
.PP |
| 270 |
Performs one-shot memory-to-memory decompression\&. Decompresses the data in \fCencoded_buffer\fP into \fCdecoded_buffer\fP, and sets \fC*decoded_size\fP to the decompressed length\&. |
| 271 |
.PP |
| 272 |
\fBParameters:\fP |
| 273 |
.RS 4 |
| 274 |
\fIencoded_size\fP size of \fCencoded_buffer\fP |
| 275 |
.br |
| 276 |
\fIencoded_buffer\fP compressed data buffer with at least \fCencoded_size\fP addressable bytes |
| 277 |
.br |
| 278 |
\fIdecoded_size\fP \fBin:\fP size of \fCdecoded_buffer\fP; |
| 279 |
.br |
| 280 |
\fBout:\fP length of decompressed data written to \fCdecoded_buffer\fP |
| 281 |
.br |
| 282 |
\fIdecoded_buffer\fP decompressed data destination buffer |
| 283 |
.RE |
| 284 |
.PP |
| 285 |
\fBReturns:\fP |
| 286 |
.RS 4 |
| 287 |
\fBBROTLI_DECODER_RESULT_ERROR\fP if input is corrupted, memory allocation failed, or \fCdecoded_buffer\fP is not large enough; |
| 288 |
.PP |
| 289 |
\fBBROTLI_DECODER_RESULT_SUCCESS\fP otherwise |
| 290 |
.RE |
| 291 |
.PP |
| 292 |
|
| 293 |
.SS "\fBBrotliDecoderResult\fP BrotliDecoderDecompressStream (\fBBrotliDecoderState\fP * state, size_t * available_in, const uint8_t ** next_in, size_t * available_out, uint8_t ** next_out, size_t * total_out)" |
| 294 |
|
| 295 |
.PP |
| 296 |
Decompresses the input stream to the output stream\&. The values \fC*available_in\fP and \fC*available_out\fP must specify the number of bytes addressable at \fC*next_in\fP and \fC*next_out\fP respectively\&. When \fC*available_out\fP is \fC0\fP, \fCnext_out\fP is allowed to be \fCNULL\fP\&. |
| 297 |
.PP |
| 298 |
After each call, \fC*available_in\fP will be decremented by the amount of input bytes consumed, and the \fC*next_in\fP pointer will be incremented by that amount\&. Similarly, \fC*available_out\fP will be decremented by the amount of output bytes written, and the \fC*next_out\fP pointer will be incremented by that amount\&. |
| 299 |
.PP |
| 300 |
\fCtotal_out\fP, if it is not a null-pointer, will be set to the number of bytes decompressed since the last \fCstate\fP initialization\&. |
| 301 |
.PP |
| 302 |
\fBNote:\fP |
| 303 |
.RS 4 |
| 304 |
Input is never overconsumed, so \fCnext_in\fP and \fCavailable_in\fP could be passed to the next consumer after decoding is complete\&. |
| 305 |
.RE |
| 306 |
.PP |
| 307 |
\fBParameters:\fP |
| 308 |
.RS 4 |
| 309 |
\fIstate\fP decoder instance |
| 310 |
.br |
| 311 |
\fIavailable_in\fP \fBin:\fP amount of available input; |
| 312 |
.br |
| 313 |
\fBout:\fP amount of unused input |
| 314 |
.br |
| 315 |
\fInext_in\fP pointer to the next compressed byte |
| 316 |
.br |
| 317 |
\fIavailable_out\fP \fBin:\fP length of output buffer; |
| 318 |
.br |
| 319 |
\fBout:\fP remaining size of output buffer |
| 320 |
.br |
| 321 |
\fInext_out\fP output buffer cursor; can be \fCNULL\fP if \fCavailable_out\fP is \fC0\fP |
| 322 |
.br |
| 323 |
\fItotal_out\fP number of bytes decompressed so far; can be \fCNULL\fP |
| 324 |
.RE |
| 325 |
.PP |
| 326 |
\fBReturns:\fP |
| 327 |
.RS 4 |
| 328 |
\fBBROTLI_DECODER_RESULT_ERROR\fP if input is corrupted, memory allocation failed, arguments were invalid, etc\&.; use \fBBrotliDecoderGetErrorCode\fP to get detailed error code |
| 329 |
.PP |
| 330 |
\fBBROTLI_DECODER_RESULT_NEEDS_MORE_INPUT\fP decoding is blocked until more input data is provided |
| 331 |
.PP |
| 332 |
\fBBROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT\fP decoding is blocked until more output space is provided |
| 333 |
.PP |
| 334 |
\fBBROTLI_DECODER_RESULT_SUCCESS\fP decoding is finished, no more input might be consumed and no more output will be produced |
| 335 |
.RE |
| 336 |
.PP |
| 337 |
|
| 338 |
.SS "void BrotliDecoderDestroyInstance (\fBBrotliDecoderState\fP * state)" |
| 339 |
|
| 340 |
.PP |
| 341 |
Deinitializes and frees \fBBrotliDecoderState\fP instance\&. |
| 342 |
.PP |
| 343 |
\fBParameters:\fP |
| 344 |
.RS 4 |
| 345 |
\fIstate\fP decoder instance to be cleaned up and deallocated |
| 346 |
.RE |
| 347 |
.PP |
| 348 |
|
| 349 |
.SS "\fBBrotliDecoderErrorCode\fP BrotliDecoderGetErrorCode (const \fBBrotliDecoderState\fP * state)" |
| 350 |
|
| 351 |
.PP |
| 352 |
Acquires a detailed error code\&. Should be used only after \fBBrotliDecoderDecompressStream\fP returns \fBBROTLI_DECODER_RESULT_ERROR\fP\&. |
| 353 |
.PP |
| 354 |
See also \fBBrotliDecoderErrorString\fP |
| 355 |
.PP |
| 356 |
\fBParameters:\fP |
| 357 |
.RS 4 |
| 358 |
\fIstate\fP decoder instance |
| 359 |
.RE |
| 360 |
.PP |
| 361 |
\fBReturns:\fP |
| 362 |
.RS 4 |
| 363 |
last saved error code |
| 364 |
.RE |
| 365 |
.PP |
| 366 |
|
| 367 |
.SS "\fBBROTLI_BOOL\fP BrotliDecoderHasMoreOutput (const \fBBrotliDecoderState\fP * state)" |
| 368 |
|
| 369 |
.PP |
| 370 |
Checks if decoder has more output\&. |
| 371 |
.PP |
| 372 |
\fBParameters:\fP |
| 373 |
.RS 4 |
| 374 |
\fIstate\fP decoder instance |
| 375 |
.RE |
| 376 |
.PP |
| 377 |
\fBReturns:\fP |
| 378 |
.RS 4 |
| 379 |
\fBBROTLI_TRUE\fP, if decoder has some unconsumed output |
| 380 |
.PP |
| 381 |
\fBBROTLI_FALSE\fP otherwise |
| 382 |
.RE |
| 383 |
.PP |
| 384 |
|
| 385 |
.SS "\fBBROTLI_BOOL\fP BrotliDecoderIsFinished (const \fBBrotliDecoderState\fP * state)" |
| 386 |
|
| 387 |
.PP |
| 388 |
Checks if decoder instance reached the final state\&. |
| 389 |
.PP |
| 390 |
\fBParameters:\fP |
| 391 |
.RS 4 |
| 392 |
\fIstate\fP decoder instance |
| 393 |
.RE |
| 394 |
.PP |
| 395 |
\fBReturns:\fP |
| 396 |
.RS 4 |
| 397 |
\fBBROTLI_TRUE\fP if decoder is in a state where it reached the end of the input and produced all of the output |
| 398 |
.PP |
| 399 |
\fBBROTLI_FALSE\fP otherwise |
| 400 |
.RE |
| 401 |
.PP |
| 402 |
|
| 403 |
.SS "\fBBROTLI_BOOL\fP BrotliDecoderIsUsed (const \fBBrotliDecoderState\fP * state)" |
| 404 |
|
| 405 |
.PP |
| 406 |
Checks if instance has already consumed input\&. Instance that returns \fBBROTLI_FALSE\fP is considered 'fresh' and could be reused\&. |
| 407 |
.PP |
| 408 |
\fBParameters:\fP |
| 409 |
.RS 4 |
| 410 |
\fIstate\fP decoder instance |
| 411 |
.RE |
| 412 |
.PP |
| 413 |
\fBReturns:\fP |
| 414 |
.RS 4 |
| 415 |
\fBBROTLI_TRUE\fP if decoder has already used some input bytes |
| 416 |
.PP |
| 417 |
\fBBROTLI_FALSE\fP otherwise |
| 418 |
.RE |
| 419 |
.PP |
| 420 |
|
| 421 |
.SS "void BrotliDecoderSetMetadataCallbacks (\fBBrotliDecoderState\fP * state, \fBbrotli_decoder_metadata_start_func\fP start_func, \fBbrotli_decoder_metadata_chunk_func\fP chunk_func, void * opaque)" |
| 422 |
|
| 423 |
.PP |
| 424 |
Sets callback for receiving metadata blocks\&. |
| 425 |
.PP |
| 426 |
\fBParameters:\fP |
| 427 |
.RS 4 |
| 428 |
\fIstate\fP decoder instance |
| 429 |
.br |
| 430 |
\fIstart_func\fP callback on metadata block start |
| 431 |
.br |
| 432 |
\fIchunk_func\fP callback on metadata block chunk |
| 433 |
.br |
| 434 |
\fIopaque\fP callback handle |
| 435 |
.RE |
| 436 |
.PP |
| 437 |
|
| 438 |
.SS "\fBBROTLI_BOOL\fP BrotliDecoderSetParameter (\fBBrotliDecoderState\fP * state, \fBBrotliDecoderParameter\fP param, uint32_t value)" |
| 439 |
|
| 440 |
.PP |
| 441 |
Sets the specified parameter to the given decoder instance\&. |
| 442 |
.PP |
| 443 |
\fBParameters:\fP |
| 444 |
.RS 4 |
| 445 |
\fIstate\fP decoder instance |
| 446 |
.br |
| 447 |
\fIparam\fP parameter to set |
| 448 |
.br |
| 449 |
\fIvalue\fP new parameter value |
| 450 |
.RE |
| 451 |
.PP |
| 452 |
\fBReturns:\fP |
| 453 |
.RS 4 |
| 454 |
\fBBROTLI_FALSE\fP if parameter is unrecognized, or value is invalid |
| 455 |
.PP |
| 456 |
\fBBROTLI_TRUE\fP if value is accepted |
| 457 |
.RE |
| 458 |
.PP |
| 459 |
|
| 460 |
.SS "const uint8_t* BrotliDecoderTakeOutput (\fBBrotliDecoderState\fP * state, size_t * size)" |
| 461 |
|
| 462 |
.PP |
| 463 |
Acquires pointer to internal output buffer\&. This method is used to make language bindings easier and more efficient: |
| 464 |
.IP "1." 4 |
| 465 |
push data to \fBBrotliDecoderDecompressStream\fP, until \fBBROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT\fP is reported |
| 466 |
.IP "2." 4 |
| 467 |
use \fBBrotliDecoderTakeOutput\fP to peek bytes and copy to language-specific entity |
| 468 |
.PP |
| 469 |
.PP |
| 470 |
Also this could be useful if there is an output stream that is able to consume all the provided data (e\&.g\&. when data is saved to file system)\&. |
| 471 |
.PP |
| 472 |
\fBAttention:\fP |
| 473 |
.RS 4 |
| 474 |
After every call to \fBBrotliDecoderTakeOutput\fP \fC*size\fP bytes of output are considered consumed for all consecutive calls to the instance methods; returned pointer becomes invalidated as well\&. |
| 475 |
.RE |
| 476 |
.PP |
| 477 |
\fBNote:\fP |
| 478 |
.RS 4 |
| 479 |
Decoder output is not guaranteed to be contiguous\&. This means that after the size-unrestricted call to \fBBrotliDecoderTakeOutput\fP, immediate next call to \fBBrotliDecoderTakeOutput\fP may return more data\&. |
| 480 |
.RE |
| 481 |
.PP |
| 482 |
\fBParameters:\fP |
| 483 |
.RS 4 |
| 484 |
\fIstate\fP decoder instance |
| 485 |
.br |
| 486 |
\fIsize\fP \fBin:\fP number of bytes caller is ready to take, \fC0\fP if any amount could be handled; |
| 487 |
.br |
| 488 |
\fBout:\fP amount of data pointed by returned pointer and considered consumed; |
| 489 |
.br |
| 490 |
out value is never greater than in value, unless it is \fC0\fP |
| 491 |
.RE |
| 492 |
.PP |
| 493 |
\fBReturns:\fP |
| 494 |
.RS 4 |
| 495 |
pointer to output data |
| 496 |
.RE |
| 497 |
.PP |
| 498 |
|
| 499 |
.SS "uint32_t BrotliDecoderVersion (void)" |
| 500 |
|
| 501 |
.PP |
| 502 |
Gets a decoder library version\&. Look at BROTLI_MAKE_HEX_VERSION for more information\&. |
| 503 |
.SH "Author" |
| 504 |
.PP |
| 505 |
Generated automatically by Doxygen for Brotli from the source code\&. |