27 #ifndef SQUASH_CODEC_H 
   28 #define SQUASH_CODEC_H 
   30 #if !defined (SQUASH_H_INSIDE) && !defined (SQUASH_COMPILATION) 
   31 #error "Only <squash/squash.h> can be included directly." 
   46   SQUASH_CODEC_INFO_MASK                    = 0xffffffff
 
   49 #define SQUASH_CODEC_INFO_INVALID ((SquashCodecInfo) 0) 
   62                                                         size_t* decompressed_length,
 
   63                                                         uint8_t decompressed[SQUASH_ARRAY_PARAM(*decompressed_length)],
 
   64                                                         size_t compressed_length,
 
   65                                                         const uint8_t compressed[SQUASH_ARRAY_PARAM(compressed_length)],
 
   68                                                         size_t* compressed_length,
 
   69                                                         uint8_t compressed[SQUASH_ARRAY_PARAM(*compressed_length)],
 
   70                                                         size_t uncompressed_length,
 
   71                                                         const uint8_t uncompressed[SQUASH_ARRAY_PARAM(uncompressed_length)],
 
   74                                                         size_t* compressed_length,
 
   75                                                         uint8_t compressed[SQUASH_ARRAY_PARAM(*compressed_length)],
 
   76                                                         size_t uncompressed_length,
 
   77                                                         const uint8_t uncompressed[SQUASH_ARRAY_PARAM(uncompressed_length)],
 
   82                                                         size_t compressed_length,
 
   83                                                         const uint8_t compressed[SQUASH_ARRAY_PARAM(compressed_length)]);
 
  106                                                                               size_t compressed_length,
 
  107                                                                               const uint8_t compressed[SQUASH_ARRAY_PARAM(compressed_length)]);
 
  114                                                                               size_t* compressed_length,
 
  115                                                                               uint8_t compressed[SQUASH_ARRAY_PARAM(*compressed_length)],
 
  116                                                                               size_t uncompressed_length,
 
  117                                                                               const uint8_t uncompressed[SQUASH_ARRAY_PARAM(uncompressed_length)],
 
  120                                                                               size_t* compressed_length,
 
  121                                                                               uint8_t compressed[SQUASH_ARRAY_PARAM(*compressed_length)],
 
  122                                                                               size_t uncompressed_length,
 
  123                                                                               const uint8_t uncompressed[SQUASH_ARRAY_PARAM(uncompressed_length)],
 
  124                                                                               SquashOptions* options);
 
  126                                                                               size_t* decompressed_length,
 
  127                                                                               uint8_t decompressed[SQUASH_ARRAY_PARAM(*decompressed_length)],
 
  128                                                                               size_t compressed_length,
 
  129                                                                               const uint8_t compressed[SQUASH_ARRAY_PARAM(compressed_length)], ...);
 
  131                                                                               size_t* decompressed_length,
 
  132                                                                               uint8_t decompressed[SQUASH_ARRAY_PARAM(*decompressed_length)],
 
  133                                                                               size_t compressed_length,
 
  134                                                                               const uint8_t compressed[SQUASH_ARRAY_PARAM(compressed_length)],
 
  135                                                                               SquashOptions* options);
 
  140                                                                               SquashOptions* options,
 
  143                                                                               SquashOptions* options,
 
  146                                                                               SquashOptions* options,
 
  149                                                                               SquashOptions* options,
 
  152                                                                               SquashOptions* options,
 
  155                                                                               SquashOptions* options,
 
  158                                                                               SquashOptions* options,
 
  161                                                                               SquashOptions* options,
 
  166 SQUASH_API 
size_t                  squash_get_uncompressed_size              (
const char* codec,
 
  167                                                                               size_t compressed_length,
 
  168                                                                               const uint8_t compressed[SQUASH_ARRAY_PARAM(compressed_length)]);
 
  171                                                                               size_t* compressed_length,
 
  172                                                                               uint8_t compressed[SQUASH_ARRAY_PARAM(*compressed_length)],
 
  173                                                                               size_t uncompressed_length,
 
  174                                                                               const uint8_t uncompressed[SQUASH_ARRAY_PARAM(uncompressed_length)],
 
  177                                                                               size_t* compressed_length,
 
  178                                                                               uint8_t compressed[SQUASH_ARRAY_PARAM(*compressed_length)],
 
  179                                                                               size_t uncompressed_length,
 
  180                                                                               const uint8_t uncompressed[SQUASH_ARRAY_PARAM(uncompressed_length)],
 
  181                                                                               SquashOptions* options);
 
  183                                                                               size_t* decompressed_length,
 
  184                                                                               uint8_t decompressed[SQUASH_ARRAY_PARAM(*decompressed_length)],
 
  185                                                                               size_t compressed_length,
 
  186                                                                               const uint8_t compressed[SQUASH_ARRAY_PARAM(compressed_length)],
 
  189                                                                               size_t* decompressed_length,
 
  190                                                                               uint8_t decompressed[SQUASH_ARRAY_PARAM(*decompressed_length)],
 
  191                                                                               size_t compressed_length,
 
  192                                                                               const uint8_t compressed[SQUASH_ARRAY_PARAM(compressed_length)],
 
  193                                                                               SquashOptions* options);
 
Mask of flags which are automatically set based on which callbacks are provided. 
SQUASH_API SquashStream * squash_codec_create_stream_with_options(SquashCodec *codec, SquashStreamType stream_type, SquashOptions *options)
Create a new stream with existing SquashOptions. 
void(* _reserved1)(void)
Reserved for future use. 
SQUASH_API size_t squash_codec_get_option_size(SquashCodec *codec, SquashOptions *options, const char *key)
Get the size value for an option. 
void(* _reserved3)(void)
Reserved for future use. 
Function table for plugins. 
SQUASH_API size_t squash_get_max_compressed_size(const char *codec, size_t uncompressed_length)
Get the maximum buffer size necessary to store compressed data. 
SQUASH_API bool squash_codec_get_option_bool(SquashCodec *codec, SquashOptions *options, const char *key)
Get the boolean value for an option. 
const SquashOptionInfo * options
options which may bo passed to the codec to modify its operation 
SQUASH_API const char * squash_codec_get_option_string_index(SquashCodec *codec, SquashOptions *options, size_t index)
Get the string value for an option by index. 
void(* _reserved2)(void)
Reserved for future use. 
SquashStatus(* process_stream)(SquashStream *stream, SquashOperation operation)
Process a SquashStream. 
SQUASH_API const SquashOptionInfo * squash_get_option_info(const char *codec)
Get a list of options applicable to the codec. 
void(* _reserved4)(void)
Reserved for future use. 
SQUASH_API SquashCodecInfo squash_get_info(const char *codec)
Get a bitmask of information about the codec. 
SQUASH_API bool squash_codec_get_option_bool_index(SquashCodec *codec, SquashOptions *options, size_t index)
Get the boolean value for an option by index. 
SquashCodecInfo
Information about the codec. 
void(* _reserved5)(void)
Reserved for future use. 
SQUASH_API SquashStatus squash_decompress(const char *codec, size_t *decompressed_length, uint8_t decompressed[SQUASH_ARRAY_PARAM(*decompressed_length)], size_t compressed_length, const uint8_t compressed[SQUASH_ARRAY_PARAM(compressed_length)],...)
Decompress a buffer with an existing SquashOptions. 
SQUASH_API SquashStatus squash_codec_compress(SquashCodec *codec, size_t *compressed_length, uint8_t compressed[SQUASH_ARRAY_PARAM(*compressed_length)], size_t uncompressed_length, const uint8_t uncompressed[SQUASH_ARRAY_PARAM(uncompressed_length)],...)
Compress a buffer. 
The data is processed in a background thread. 
SQUASH_API const char * squash_codec_get_extension(SquashCodec *codec)
Get the codec's extension. 
SQUASH_API SquashPlugin * squash_codec_get_plugin(SquashCodec *codec)
Get the plugin associated with a codec. 
SQUASH_API size_t squash_codec_get_uncompressed_size(SquashCodec *codec, size_t compressed_length, const uint8_t compressed[SQUASH_ARRAY_PARAM(compressed_length)])
Get the uncompressed size of the compressed buffer. 
SQUASH_API SquashStream * squash_codec_create_stream(SquashCodec *codec, SquashStreamType stream_type,...)
Create a new stream with existing SquashOptions. 
SQUASH_API size_t squash_codec_get_option_size_index(SquashCodec *codec, SquashOptions *options, size_t index)
Get the size value for an option by index. 
SQUASH_API SquashStatus squash_compress_with_options(const char *codec, size_t *compressed_length, uint8_t compressed[SQUASH_ARRAY_PARAM(*compressed_length)], size_t uncompressed_length, const uint8_t uncompressed[SQUASH_ARRAY_PARAM(uncompressed_length)], SquashOptions *options)
Compress a buffer with an existing SquashOptions. 
SQUASH_API SquashStatus squash_codec_init(SquashCodec *codec)
Initialize a codec. 
SQUASH_API SquashStatus squash_compress(const char *codec, size_t *compressed_length, uint8_t compressed[SQUASH_ARRAY_PARAM(*compressed_length)], size_t uncompressed_length, const uint8_t uncompressed[SQUASH_ARRAY_PARAM(uncompressed_length)],...)
Compress a buffer. 
SquashCodecInfo info
Capability information about the codec. 
The codec will not write outside of the buffer supplied to it during decompression. 
SQUASH_API int squash_codec_get_option_int(SquashCodec *codec, SquashOptions *options, const char *key)
Get the integer value for an option. 
SQUASH_API size_t squash_codec_get_max_compressed_size(SquashCodec *codec, size_t uncompressed_length)
Get the maximum buffer size necessary to store compressed data. 
SQUASH_API const char * squash_codec_get_name(SquashCodec *codec)
Get the name of a SquashCodec. 
SQUASH_API SquashStatus squash_codec_compress_with_options(SquashCodec *codec, size_t *compressed_length, uint8_t compressed[SQUASH_ARRAY_PARAM(*compressed_length)], size_t uncompressed_length, const uint8_t uncompressed[SQUASH_ARRAY_PARAM(uncompressed_length)], SquashOptions *options)
Compress a buffer with an existing SquashOptions. 
SQUASH_API SquashStatus squash_decompress_with_options(const char *codec, size_t *decompressed_length, uint8_t decompressed[SQUASH_ARRAY_PARAM(*decompressed_length)], size_t compressed_length, const uint8_t compressed[SQUASH_ARRAY_PARAM(compressed_length)], SquashOptions *options)
Decompress a buffer. 
SQUASH_API const char * squash_codec_get_option_string(SquashCodec *codec, SquashOptions *options, const char *key)
Get the string value for an option. 
SQUASH_API SquashStatus squash_codec_decompress_with_options(SquashCodec *codec, size_t *decompressed_length, uint8_t decompressed[SQUASH_ARRAY_PARAM(*decompressed_length)], size_t compressed_length, const uint8_t compressed[SQUASH_ARRAY_PARAM(compressed_length)], SquashOptions *options)
Decompress a buffer with an existing SquashOptions. 
SquashStatus(* decompress_buffer)(SquashCodec *codec, size_t *decompressed_length, uint8_t decompressed[SQUASH_ARRAY_PARAM(*decompressed_length)], size_t compressed_length, const uint8_t compressed[SQUASH_ARRAY_PARAM(compressed_length)], SquashOptions *options)
Decompress a buffer. 
void(* _reserved6)(void)
Reserved for future use. 
SQUASH_API const SquashOptionInfo * squash_codec_get_option_info(SquashCodec *codec)
Get a list of options applicable to the codec. 
SquashStatus
Status codes. 
void(* _reserved7)(void)
Reserved for future use. 
SquashOperation
Operations to perform on a stream. 
void(* SquashCodecForeachFunc)(SquashCodec *codec, void *data)
Squashlback to be invoked on each SquashCodec in a set. 
SQUASH_API SquashStatus squash_codec_decompress(SquashCodec *codec, size_t *decompressed_length, uint8_t decompressed[SQUASH_ARRAY_PARAM(*decompressed_length)], size_t compressed_length, const uint8_t compressed[SQUASH_ARRAY_PARAM(compressed_length)],...)
Decompress a buffer. 
size_t(* get_max_compressed_size)(SquashCodec *codec, size_t uncompressed_length)
Get the maximum compressed size. 
SquashStatus(* compress_buffer_unsafe)(SquashCodec *codec, size_t *compressed_length, uint8_t compressed[SQUASH_ARRAY_PARAM(*compressed_length)], size_t uncompressed_length, const uint8_t uncompressed[SQUASH_ARRAY_PARAM(uncompressed_length)], SquashOptions *options)
Compress a buffer. 
SQUASH_API unsigned int squash_codec_get_priority(SquashCodec *codec)
Get the priority of a SquashCodec. 
SquashStatus(* compress_buffer)(SquashCodec *codec, size_t *compressed_length, uint8_t compressed[SQUASH_ARRAY_PARAM(*compressed_length)], size_t uncompressed_length, const uint8_t uncompressed[SQUASH_ARRAY_PARAM(uncompressed_length)], SquashOptions *options)
Compress a buffer. 
SQUASH_API SquashCodecInfo squash_codec_get_info(SquashCodec *codec)
Get a bitmask of information about the codec. 
The compressed data encodes the length of the uncompressed data without having to decompress it...
The codec natively supports a streaming interface. 
void(* _reserved8)(void)
Reserved for future use. 
SQUASH_API int squash_codec_get_option_int_index(SquashCodec *codec, SquashOptions *options, size_t index)
Get the integer value for an option by index. 
SquashStreamType
Stream type. 
size_t(* get_uncompressed_size)(SquashCodec *codec, size_t compressed_length, const uint8_t compressed[SQUASH_ARRAY_PARAM(compressed_length)])
Get the buffer's uncompressed size.