OLD | NEW |
(Empty) | |
| 1 /* Copyright 2013 Google Inc. All Rights Reserved. |
| 2 |
| 3 Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 you may not use this file except in compliance with the License. |
| 5 You may obtain a copy of the License at |
| 6 |
| 7 http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
| 9 Unless required by applicable law or agreed to in writing, software |
| 10 distributed under the License is distributed on an "AS IS" BASIS, |
| 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 See the License for the specific language governing permissions and |
| 13 limitations under the License. |
| 14 |
| 15 API for Brotli decompression |
| 16 */ |
| 17 |
| 18 #ifndef BROTLI_DEC_DECODE_H_ |
| 19 #define BROTLI_DEC_DECODE_H_ |
| 20 |
| 21 #include "./streams.h" |
| 22 #include "./types.h" |
| 23 |
| 24 #if defined(__cplusplus) || defined(c_plusplus) |
| 25 extern "C" { |
| 26 #endif |
| 27 |
| 28 /* Sets *decoded_size to the decompressed size of the given encoded stream. */ |
| 29 /* This function only works if the encoded buffer has a single meta block, */ |
| 30 /* or if it has two meta-blocks, where the first is uncompressed and the */ |
| 31 /* second is empty. */ |
| 32 /* Returns 1 on success, 0 on failure. */ |
| 33 int BrotliDecompressedSize(size_t encoded_size, |
| 34 const uint8_t* encoded_buffer, |
| 35 size_t* decoded_size); |
| 36 |
| 37 /* Decompresses the data in encoded_buffer into decoded_buffer, and sets */ |
| 38 /* *decoded_size to the decompressed length. */ |
| 39 /* Returns 0 if there was either a bit stream error or memory allocation */ |
| 40 /* error, and 1 otherwise. */ |
| 41 /* If decoded size is zero, returns 1 and keeps decoded_buffer unchanged. */ |
| 42 int BrotliDecompressBuffer(size_t encoded_size, |
| 43 const uint8_t* encoded_buffer, |
| 44 size_t* decoded_size, |
| 45 uint8_t* decoded_buffer); |
| 46 |
| 47 /* Same as above, but uses the specified input and output callbacks instead */ |
| 48 /* of reading from and writing to pre-allocated memory buffers. */ |
| 49 int BrotliDecompress(BrotliInput input, BrotliOutput output); |
| 50 |
| 51 #if defined(__cplusplus) || defined(c_plusplus) |
| 52 } /* extern "C" */ |
| 53 #endif |
| 54 |
| 55 #endif /* BROTLI_DEC_DECODE_H_ */ |
OLD | NEW |