2 * \file lzma/metadata.h
3 * \brief Metadata handling
5 * \author Copyright (C) 1999-2006 Igor Pavlov
6 * \author Copyright (C) 2007 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 Information stored into a Metadata Block
27 * This structure holds all the information that can be stored to
32 * \brief Size of Header Metadata Block
34 lzma_vli header_metadata_size;
37 * \brief Total Size of the Stream
42 * \brief Uncompressed Size of the Stream
44 lzma_vli uncompressed_size;
47 * \brief Index of the Blocks stored in the Stream
52 * \brief Extra information
60 * \brief Calculate the encoded size of Metadata
62 * \return Uncompressed size of the Metadata in encoded form. This value
63 * may be passed to Block encoder as Uncompressed Size when using
64 * Metadata filter. On error, zero is returned.
66 extern lzma_vli lzma_metadata_size(const lzma_metadata *metadata);
70 * \brief Initializes Metadata encoder
72 * \param coder Pointer to a pointer to hold Metadata encoder's
73 * internal state. Original value is ignored, thus
74 * you don't need to initialize the pointer.
75 * \param allocator Custom memory allocator; usually NULL.
76 * \param metadata Pointer to Metadata to encoded
78 * \return - LZMA_OK: Initialization succeeded.
79 * - LZMA_MEM_ERROR: Cannot allocate memory for *coder.
81 * The initialization function makes internal copy of the *metadata structure.
82 * However, the linked lists metadata->index and metadata->extra are NOT
83 * copied. Thus, the application may destroy *metadata after initialization
84 * if it likes, but not Index or Extra.
86 extern lzma_ret lzma_metadata_encoder(lzma_stream *strm,
87 lzma_options_block *options, const lzma_metadata *metadata);
91 * \brief Initializes Metadata decoder
93 * \param want_extra If this is true, Extra Records will be stored
94 * to metadata->extra. If this is false, Extra
95 * Records will be parsed but not stored anywhere,
96 * metadata->extra will be set to NULL.
98 extern lzma_ret lzma_metadata_decoder(
99 lzma_stream *strm, lzma_options_block *options,
100 lzma_metadata *metadata, lzma_bool want_extra);