Mercurial > repos > blastem
comparison flac.h @ 2305:6aca1734d573
Merge
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 15 Mar 2023 19:28:11 -0700 |
parents | 9d68799f945b |
children |
comparison
equal
deleted
inserted
replaced
2304:b3832f73444f | 2305:6aca1734d573 |
---|---|
1 #ifndef FLAC_H_ | |
2 #define FLAC_H_ | |
3 | |
4 #include <stdint.h> | |
5 #include <stdio.h> | |
6 | |
7 typedef struct flac_file flac_file; | |
8 | |
9 typedef uint8_t (*flac_read_fun)(flac_file *f); | |
10 typedef void (*flac_seek_fun)(flac_file *f, uint32_t offset, uint8_t relative); | |
11 typedef uint32_t (*flac_tell_fun)(flac_file *f); | |
12 | |
13 typedef struct { | |
14 uint32_t allocated_samples; | |
15 int32_t *decoded; | |
16 } flac_subframe; | |
17 | |
18 typedef struct { | |
19 uint64_t sample_number; | |
20 uint64_t offset; | |
21 uint16_t sample_count; | |
22 } flac_seekpoint; | |
23 | |
24 struct flac_file { | |
25 uint64_t total_samples; | |
26 uint64_t frame_start_sample; | |
27 void *read_data; | |
28 flac_read_fun read_byte; | |
29 flac_seek_fun seek; | |
30 flac_tell_fun tell; | |
31 flac_subframe *subframes; | |
32 flac_seekpoint *seekpoints; | |
33 uint32_t num_seekpoints; | |
34 uint32_t offset; | |
35 uint32_t buffer_size; | |
36 uint32_t first_frame_offset; | |
37 | |
38 uint32_t frame_sample_pos; | |
39 | |
40 uint32_t sample_rate; | |
41 uint32_t frame_sample_rate; | |
42 uint32_t frame_block_size; | |
43 uint8_t bits_per_sample; | |
44 uint8_t frame_bits_per_sample; | |
45 uint8_t channels; | |
46 uint8_t frame_channels; | |
47 uint8_t frame_joint_stereo; | |
48 uint8_t subframe_alloc; | |
49 | |
50 uint8_t cur_byte; | |
51 uint8_t bits; | |
52 }; | |
53 | |
54 flac_file *flac_file_from_buffer(void *buffer, uint32_t size); | |
55 flac_file *flac_file_from_file(FILE *file); | |
56 uint8_t flac_get_sample(flac_file *f, int16_t *out, uint8_t desired_channels); | |
57 void flac_seek(flac_file *f, uint64_t sample_number); | |
58 | |
59 #endif //FLAC_H_ |