aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/lzma/lzma_encoder_private.h
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2021-01-13 19:16:32 +0200
committerLasse Collin <lasse.collin@tukaani.org>2021-01-14 18:58:13 +0200
commit625f4c7c99b2fcc4db9e7ab2deb4884790e2e17c (patch)
tree0706a4ff7aa1d64ecffdbc9e13c3899d67d3db2f /src/liblzma/lzma/lzma_encoder_private.h
parentScripts: Add zstd support to xzdiff. (diff)
downloadxz-625f4c7c99b2fcc4db9e7ab2deb4884790e2e17c.tar.xz
liblzma: Add rough support for output-size-limited encoding in LZMA1.
With this it is possible to encode LZMA1 data without EOPM so that the encoder will encode as much input as it can without exceeding the specified output size limit. The resulting LZMA1 stream will be a normal LZMA1 stream without EOPM. The actual uncompressed size will be available to the caller via the uncomp_size pointer. One missing thing is that the LZMA layer doesn't inform the LZ layer when the encoding is finished and thus the LZ may read more input when it won't be used. However, this doesn't matter if encoding is done with a single call (which is the planned use case for now). For proper multi-call encoding this should be improved. This commit only adds the functionality for internal use. Nothing uses it yet.
Diffstat (limited to '')
-rw-r--r--src/liblzma/lzma/lzma_encoder_private.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/liblzma/lzma/lzma_encoder_private.h b/src/liblzma/lzma/lzma_encoder_private.h
index 2e34aace..8960c52c 100644
--- a/src/liblzma/lzma/lzma_encoder_private.h
+++ b/src/liblzma/lzma/lzma_encoder_private.h
@@ -72,6 +72,18 @@ struct lzma_lzma1_encoder_s {
/// Range encoder
lzma_range_encoder rc;
+ /// Uncompressed size (doesn't include possible preset dictionary)
+ uint64_t uncomp_size;
+
+ /// If non-zero, produce at most this much output.
+ /// Some input may then be missing from the output.
+ uint64_t out_limit;
+
+ /// If the above out_limit is non-zero, *uncomp_size_ptr is set to
+ /// the amount of uncompressed data that we were able to fit
+ /// in the output buffer.
+ uint64_t *uncomp_size_ptr;
+
/// State
lzma_lzma_state state;