Merge pull request #423 from jdgleaver/set-message-ext
[pcsx_rearmed.git] / deps / libchdr / flac.h
1 // license:BSD-3-Clause\r
2 // copyright-holders:Aaron Giles\r
3 /***************************************************************************\r
4 \r
5     flac.h\r
6 \r
7     FLAC compression wrappers\r
8 \r
9 ***************************************************************************/\r
10 \r
11 #pragma once\r
12 \r
13 #ifndef __FLAC_H__\r
14 #define __FLAC_H__\r
15 \r
16 #include <stdint.h>\r
17 #include "FLAC/all.h"\r
18 \r
19 //**************************************************************************\r
20 //  TYPE DEFINITIONS\r
21 //**************************************************************************\r
22 \r
23 typedef struct _flac_decoder flac_decoder;\r
24 struct _flac_decoder {\r
25                 // output state\r
26         FLAC__StreamDecoder*    decoder;                                // actual encoder\r
27         uint32_t                sample_rate;                    // decoded sample rate\r
28         uint8_t                 channels;                               // decoded number of channels\r
29         uint8_t                 bits_per_sample;                // decoded bits per sample\r
30         uint32_t                compressed_offset;              // current offset in compressed data\r
31         const FLAC__byte *      compressed_start;               // start of compressed data\r
32         uint32_t                compressed_length;              // length of compressed data\r
33         const FLAC__byte *      compressed2_start;              // start of compressed data\r
34         uint32_t                compressed2_length;             // length of compressed data\r
35         int16_t *               uncompressed_start[8];  // pointer to start of uncompressed data (up to 8 streams)\r
36         uint32_t                uncompressed_offset;    // current position in uncompressed data\r
37         uint32_t                uncompressed_length;    // length of uncompressed data\r
38         int                     uncompressed_swap;              // swap uncompressed sample data\r
39         uint8_t                 custom_header[0x2a];    // custom header\r
40 };\r
41 \r
42 // ======================> flac_decoder\r
43 \r
44 void            flac_decoder_init(flac_decoder* decoder);\r
45 void            flac_decoder_free(flac_decoder* decoder);\r
46 int             flac_decoder_reset(flac_decoder* decoder, uint32_t sample_rate, uint8_t num_channels, uint32_t block_size, const void *buffer, uint32_t length);\r
47 int             flac_decoder_decode_interleaved(flac_decoder* decoder, int16_t *samples, uint32_t num_samples, int swap_endian);\r
48 uint32_t        flac_decoder_finish(flac_decoder* decoder);\r
49 \r
50 #endif // __FLAC_H__\r