annotate flac.h @ 2299:a1c9edf44c7e

Fix a place I missed a problem from the SDL2 upgrade
author Michael Pavone <pavone@retrodev.com>
date Thu, 09 Mar 2023 22:59:29 -0800
parents 9d68799f945b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2296
789802d99629 Add basic FLAC decoder and add FLAC playback support to the media player
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1 #ifndef FLAC_H_
789802d99629 Add basic FLAC decoder and add FLAC playback support to the media player
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2 #define FLAC_H_
789802d99629 Add basic FLAC decoder and add FLAC playback support to the media player
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
3
789802d99629 Add basic FLAC decoder and add FLAC playback support to the media player
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
4 #include <stdint.h>
789802d99629 Add basic FLAC decoder and add FLAC playback support to the media player
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
5 #include <stdio.h>
789802d99629 Add basic FLAC decoder and add FLAC playback support to the media player
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
6
789802d99629 Add basic FLAC decoder and add FLAC playback support to the media player
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
7 typedef struct flac_file flac_file;
789802d99629 Add basic FLAC decoder and add FLAC playback support to the media player
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
8
2298
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
9 typedef uint8_t (*flac_read_fun)(flac_file *f);
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
10 typedef void (*flac_seek_fun)(flac_file *f, uint32_t offset, uint8_t relative);
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
11 typedef uint32_t (*flac_tell_fun)(flac_file *f);
2296
789802d99629 Add basic FLAC decoder and add FLAC playback support to the media player
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
12
789802d99629 Add basic FLAC decoder and add FLAC playback support to the media player
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
13 typedef struct {
789802d99629 Add basic FLAC decoder and add FLAC playback support to the media player
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
14 uint32_t allocated_samples;
789802d99629 Add basic FLAC decoder and add FLAC playback support to the media player
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
15 int32_t *decoded;
789802d99629 Add basic FLAC decoder and add FLAC playback support to the media player
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
16 } flac_subframe;
789802d99629 Add basic FLAC decoder and add FLAC playback support to the media player
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
17
2298
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
18 typedef struct {
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
19 uint64_t sample_number;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
20 uint64_t offset;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
21 uint16_t sample_count;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
22 } flac_seekpoint;
2296
789802d99629 Add basic FLAC decoder and add FLAC playback support to the media player
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
23
2298
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
24 struct flac_file {
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
25 uint64_t total_samples;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
26 uint64_t frame_start_sample;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
27 void *read_data;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
28 flac_read_fun read_byte;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
29 flac_seek_fun seek;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
30 flac_tell_fun tell;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
31 flac_subframe *subframes;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
32 flac_seekpoint *seekpoints;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
33 uint32_t num_seekpoints;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
34 uint32_t offset;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
35 uint32_t buffer_size;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
36 uint32_t first_frame_offset;
2296
789802d99629 Add basic FLAC decoder and add FLAC playback support to the media player
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
37
2298
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
38 uint32_t frame_sample_pos;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
39
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
40 uint32_t sample_rate;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
41 uint32_t frame_sample_rate;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
42 uint32_t frame_block_size;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
43 uint8_t bits_per_sample;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
44 uint8_t frame_bits_per_sample;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
45 uint8_t channels;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
46 uint8_t frame_channels;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
47 uint8_t frame_joint_stereo;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
48 uint8_t subframe_alloc;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
49
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
50 uint8_t cur_byte;
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
51 uint8_t bits;
2296
789802d99629 Add basic FLAC decoder and add FLAC playback support to the media player
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
52 };
789802d99629 Add basic FLAC decoder and add FLAC playback support to the media player
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
53
789802d99629 Add basic FLAC decoder and add FLAC playback support to the media player
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
54 flac_file *flac_file_from_buffer(void *buffer, uint32_t size);
789802d99629 Add basic FLAC decoder and add FLAC playback support to the media player
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
55 flac_file *flac_file_from_file(FILE *file);
789802d99629 Add basic FLAC decoder and add FLAC playback support to the media player
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
56 uint8_t flac_get_sample(flac_file *f, int16_t *out, uint8_t desired_channels);
2298
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2296
diff changeset
57 void flac_seek(flac_file *f, uint64_t sample_number);
2296
789802d99629 Add basic FLAC decoder and add FLAC playback support to the media player
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
58
789802d99629 Add basic FLAC decoder and add FLAC playback support to the media player
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
59 #endif //FLAC_H_