Remove dependency on stdint in API
[platform/upstream/libaec.git] / src / libaec.h
1 #ifndef LIBAEC_H
2 #define LIBAEC_H
3
4 #include <stddef.h>
5
6 struct internal_state;
7
8 struct aec_stream {
9     const unsigned char *next_in;
10     size_t avail_in;         /* number of bytes available at
11                               * next_in */
12     size_t total_in;         /* total number of input bytes read so
13                               * far */
14     unsigned char *next_out;
15     size_t avail_out;        /* remaining free space at next_out */
16     size_t total_out;        /* total number of bytes output so far */
17     int bit_per_sample;      /* resolution in bits per sample (n =
18                               * 1,..., 32) */
19     int block_size;          /* block size in samples */
20     int rsi;                 /* Reference sample interval, the number of
21                                 blocks between consecutive reference
22                                 samples. */
23     int flags;
24
25     struct internal_state *state;
26 };
27
28 /* Coder flags */
29 #define AEC_DATA_UNSIGNED     0
30 #define AEC_DATA_SIGNED       1
31 #define AEC_DATA_3BYTE        2  /* 24 bit samples coded in 3 bytes */
32 #define AEC_DATA_LSB          0
33 #define AEC_DATA_MSB         16
34 #define AEC_DATA_PREPROCESS  32  /* Set if preprocessor should be used */
35
36 /* Return codes of library functions */
37 #define AEC_OK            0
38 #define AEC_CONF_ERROR   (-1)
39 #define AEC_STREAM_ERROR (-2)
40 #define AEC_DATA_ERROR   (-3)
41 #define AEC_MEM_ERROR    (-4)
42
43 /* Options for flushing */
44 #define AEC_NO_FLUSH      0 /* Do not enforce output flushing. More
45                              * input may be provided with later
46                              * calls. So far only relevant for
47                              * encoding.
48                              */
49 #define AEC_FLUSH         1 /* Flush output and end encoding. The last
50                              * call to aec_encode() must set AEC_FLUSH to
51                              * drain all output.
52                              *
53                              * It is not possible to continue encoding
54                              * of the same stream after it has been
55                              * flushed because the last byte may be
56                              * padded with fill bits.
57                              */
58
59 int aec_decode_init(struct aec_stream *strm);
60 int aec_decode(struct aec_stream *strm, int flush);
61 int aec_decode_end(struct aec_stream *strm);
62
63 int aec_encode_init(struct aec_stream *strm);
64 int aec_encode(struct aec_stream *strm, int flush);
65 int aec_encode_end(struct aec_stream *strm);
66
67 #endif /* LIBAEC_H */