| cyan4973 | 2e3b659 | 2017-01-20 14:00:41 -0800 | [diff] [blame] | 1 | /** |
| 2 | * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * This source code is licensed under the BSD-style license found in the |
| 6 | * LICENSE file in the root directory of this source tree. An additional grant |
| 7 | * of patent rights can be found in the PATENTS file in the same directory. |
| 8 | */ |
| Yann Collet | 3d93f2f | 2016-12-27 07:19:36 +0100 | [diff] [blame] | 9 | |
| Yann Collet | 107bcbb | 2017-01-12 01:25:46 +0100 | [diff] [blame] | 10 | /* === Dependencies === */ |
| Yann Collet | 3d93f2f | 2016-12-27 07:19:36 +0100 | [diff] [blame] | 11 | #include <stddef.h> /* size_t */ |
| Yann Collet | 19d670b | 2017-01-19 15:32:07 -0800 | [diff] [blame] | 12 | #define ZSTD_STATIC_LINKING_ONLY /* ZSTD_parameters */ |
| Yann Collet | 317604e | 2017-01-20 17:18:41 -0800 | [diff] [blame^] | 13 | #include "zstd.h" /* ZSTD_inBuffer, ZSTD_outBuffer, ZSTDLIB_API */ |
| Yann Collet | 107bcbb | 2017-01-12 01:25:46 +0100 | [diff] [blame] | 14 | |
| 15 | |
| 16 | /* === Simple one-pass functions === */ |
| Yann Collet | 3d93f2f | 2016-12-27 07:19:36 +0100 | [diff] [blame] | 17 | |
| 18 | typedef struct ZSTDMT_CCtx_s ZSTDMT_CCtx; |
| Yann Collet | 317604e | 2017-01-20 17:18:41 -0800 | [diff] [blame^] | 19 | ZSTDLIB_API ZSTDMT_CCtx* ZSTDMT_createCCtx(unsigned nbThreads); |
| 20 | ZSTDLIB_API size_t ZSTDMT_freeCCtx(ZSTDMT_CCtx* cctx); |
| Yann Collet | 3d93f2f | 2016-12-27 07:19:36 +0100 | [diff] [blame] | 21 | |
| Yann Collet | 317604e | 2017-01-20 17:18:41 -0800 | [diff] [blame^] | 22 | ZSTDLIB_API size_t ZSTDMT_compressCCtx(ZSTDMT_CCtx* cctx, |
| Yann Collet | 3d93f2f | 2016-12-27 07:19:36 +0100 | [diff] [blame] | 23 | void* dst, size_t dstCapacity, |
| 24 | const void* src, size_t srcSize, |
| 25 | int compressionLevel); |
| Yann Collet | 107bcbb | 2017-01-12 01:25:46 +0100 | [diff] [blame] | 26 | |
| 27 | |
| 28 | /* === Streaming functions === */ |
| 29 | |
| Yann Collet | 317604e | 2017-01-20 17:18:41 -0800 | [diff] [blame^] | 30 | ZSTDLIB_API size_t ZSTDMT_initCStream(ZSTDMT_CCtx* zcs, int compressionLevel); |
| 31 | ZSTDLIB_API size_t ZSTDMT_resetCStream(ZSTDMT_CCtx* zcs, unsigned long long pledgedSrcSize); /**< pledgedSrcSize is optional and can be zero == unknown */ |
| 32 | ZSTDLIB_API size_t ZSTDMT_initCStream_advanced(ZSTDMT_CCtx* zcs, const void* dict, size_t dictSize, |
| Yann Collet | 19d670b | 2017-01-19 15:32:07 -0800 | [diff] [blame] | 33 | ZSTD_parameters params, unsigned long long pledgedSrcSize); /**< pledgedSrcSize is optional and can be zero == unknown ; current limitation : no checksum */ |
| 34 | |
| Yann Collet | 317604e | 2017-01-20 17:18:41 -0800 | [diff] [blame^] | 35 | ZSTDLIB_API size_t ZSTDMT_compressStream(ZSTDMT_CCtx* zcs, ZSTD_outBuffer* output, ZSTD_inBuffer* input); |
| Yann Collet | 19d670b | 2017-01-19 15:32:07 -0800 | [diff] [blame] | 36 | |
| Yann Collet | 317604e | 2017-01-20 17:18:41 -0800 | [diff] [blame^] | 37 | ZSTDLIB_API size_t ZSTDMT_flushStream(ZSTDMT_CCtx* zcs, ZSTD_outBuffer* output); /**< @return : 0 == all flushed; >0 : still some data to be flushed; or an error code (ZSTD_isError()) */ |
| 38 | ZSTDLIB_API size_t ZSTDMT_endStream(ZSTDMT_CCtx* zcs, ZSTD_outBuffer* output); /**< @return : 0 == all flushed; >0 : still some data to be flushed; or an error code (ZSTD_isError()) */ |