3 * \brief Easy to use encoder initialization
5 * \author Copyright (C) 1999-2006 Igor Pavlov
6 * \author Copyright (C) 2008 Lasse Collin
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
19 #ifndef LZMA_H_INTERNAL
20 # error Never include this file directly. Use <lzma.h> instead.
25 * \brief Compression level names for lzma_easy_* functions
27 * At the moment, all the compression levels support LZMA_SYNC_FLUSH.
28 * In future there may be levels that don't support LZMA_SYNC_FLUSH.
29 * However, the LZMA_SYNC_FLUSH support won't be removed from the
30 * existing compression levels.
32 * \note If liblzma is built without encoder support, or with some
33 * filters disabled, some of the compression levels may be
34 * unsupported. In that case, the initialization functions
35 * will return LZMA_HEADER_ERROR.
40 * No compression; the data is just wrapped into .lzma
46 * LZMA filter with fast compression (fast in terms of LZMA).
47 * If you are interested in the exact options used, see
48 * lzma_preset_lzma[0]. Note that the exact options may
49 * change between liblzma versions.
51 * At the moment, the command line tool uses these settings
52 * when `lzma -1' is used. In future, the command line tool
53 * may default to some more complex way to determine the
54 * settings used e.g. the type of files being compressed.
56 * LZMA_EASY_LZMA_2 is equivalent to lzma_preset_lzma[1]
72 * \brief Default compression level
74 * Data Blocks contain the actual compressed data. It's not straightforward
75 * to recommend a default level, because in some cases keeping the resource
76 * usage relatively low is more important that getting the maximum
79 #define LZMA_EASY_DEFAULT LZMA_EASY_LZMA_7
83 * \brief Calculates rough memory requirements of a compression level
85 * This function is a wrapper for lzma_memory_usage(), which is declared
88 * \return Approximate memory usage of the encoder with the given
89 * compression level in mebibytes (value * 1024 * 1024 bytes).
90 * On error (e.g. compression level is not supported),
91 * UINT32_MAX is returned.
93 extern uint32_t lzma_easy_memory_usage(lzma_easy_level level);
97 * \brief Initializes .lzma Stream encoder
99 * This function is intended for those who just want to use the basic LZMA
100 * features (that is, most developers out there). Lots of assumptions are
101 * made, which are correct or at least good enough for most situations.
103 * \param strm Pointer to lzma_stream that is at least initialized
104 * with LZMA_STREAM_INIT.
105 * \param level Compression level to use. This selects a set of
106 * compression settings from a list of compression
109 * \return - LZMA_OK: Initialization succeeded. Use lzma_code() to
111 * - LZMA_MEM_ERROR: Memory allocation failed. All memory
112 * previously allocated for *strm is now freed.
113 * - LZMA_HEADER_ERROR: The given compression level is not
114 * supported by this build of liblzma.
116 * If initialization succeeds, use lzma_code() to do the actual encoding.
117 * Valid values for `action' (the second argument of lzma_code()) are
118 * LZMA_RUN, LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, and LZMA_FINISH. In future,
119 * there may be compression levels that don't support LZMA_SYNC_FLUSH.
121 extern lzma_ret lzma_easy_encoder(lzma_stream *strm, lzma_easy_level level);