27 #ifndef SQUASH_STREAM_H
28 #define SQUASH_STREAM_H
30 #if !defined (SQUASH_H_INSIDE) && !defined (SQUASH_COMPILATION)
31 #error "Only <squash/squash.h> can be included directly."
44 SQUASH_STREAM_STATE_IDLE = 0,
45 SQUASH_STREAM_STATE_RUNNING = 1,
46 SQUASH_STREAM_STATE_FLUSHING = 2,
47 SQUASH_STREAM_STATE_FINISHING = 3,
48 SQUASH_STREAM_STATE_FINISHED = 4
87 const char*
const* keys,
88 const char*
const* values);
91 SquashOptions* options);
97 SquashOptions* options);
106 SquashOptions* options,
SquashStreamState state
State the stream is in.
SQUASH_API SquashStatus squash_stream_finish(SquashStream *stream)
Finish writing to a stream.
SQUASH_API SquashOperation squash_stream_yield(SquashStream *stream, SquashStatus status)
Yield execution back to the main thread.
size_t avail_in
Size (in bytes) of available input.
SquashOptions * options
Options used for this stream.
SQUASH_API SquashStream * squash_stream_new_codec(SquashCodec *codec, SquashStreamType stream_type,...)
Create a new stream using a codec instance.
void * user_data
User data.
void(* SquashDestroyNotify)(void *data)
Callback to be invoked when information data is no longer needed.
SQUASH_API SquashStream * squash_stream_newa(const char *codec, SquashStreamType stream_type, const char *const *keys, const char *const *values)
Create a new stream with key/value option arrays.
const uint8_t * next_in
The next input data to consume.
Private data for streams.
SQUASH_API SquashStream * squash_stream_new_codec_with_options(SquashCodec *codec, SquashStreamType stream_type, SquashOptions *options)
Create a new stream using codec and options intances.
size_t avail_out
Number of bytes available in the output buffer.
Compression/decompression streams.
Continue processing the stream normally.
SquashStreamType stream_type
Stream type.
SquashDestroyNotify destroy_user_data
Squashlback to invoke on user_data when it is no longer necessary.
SQUASH_API SquashStream * squash_stream_newv(const char *codec, SquashStreamType stream_type, va_list options)
Create a new stream with a variadic list of options.
SQUASH_API SquashStatus squash_stream_flush(SquashStream *stream)
Flush a stream.
SQUASH_API void squash_stream_init(void *stream, SquashCodec *codec, SquashStreamType stream_type, SquashOptions *options, SquashDestroyNotify destroy_notify)
Initialize a stream.
SquashObject base_object
Base object.
SquashStatus
Status codes.
size_t total_out
Total number of bytes output.
SQUASH_API SquashStream * squash_stream_new_with_options(const char *codec, SquashStreamType stream_type, SquashOptions *options)
Create a new stream with options.
SquashOperation
Operations to perform on a stream.
SquashCodec * codec
Codec used for this stream.
SQUASH_API void squash_stream_destroy(void *stream)
Destroy a stream.
size_t total_in
The total number of bytes input.
SQUASH_API SquashStream * squash_stream_new(const char *codec, SquashStreamType stream_type,...)
Create a new stream.
uint8_t * next_out
The buffer to write output to.
SQUASH_API SquashStatus squash_stream_process(SquashStream *stream)
Process a stream.
Finish processing the stream.
SquashStreamType
Stream type.
SquashStreamPrivate * priv
Private data.