A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita
audio
rust
zig
deno
mpris
rockbox
mpd
1#ifndef _FLAC_DECODER_H
2#define _FLAC_DECODER_H
3
4#include "bitstream.h"
5
6#define MAX_CHANNELS 7 /* Maximum supported channels, only left/right will be played back */
7#ifndef MAX_BLOCKSIZE
8#define MAX_BLOCKSIZE 4608 /* Maxsize in samples of one uncompressed frame */
9#endif
10#define MAX_FRAMESIZE 65536 /* Maxsize in bytes of one compressed frame */
11#define MIN_FRAME_SIZE 11 /* smallest valid FLAC frame possible */
12
13#define FLAC_OUTPUT_DEPTH 29 /* Provide samples left-shifted to 28 bits+sign */
14
15enum decorrelation_type {
16 INDEPENDENT,
17 LEFT_SIDE,
18 RIGHT_SIDE,
19 MID_SIDE,
20};
21
22typedef struct FLACContext {
23 GetBitContext gb;
24
25 int min_blocksize, max_blocksize;
26 int min_framesize, max_framesize;
27 int samplerate, channels;
28 int blocksize/*, last_blocksize*/;
29 int bps;
30 unsigned long samplenumber;
31 unsigned long totalsamples;
32 enum decorrelation_type ch_mode;
33
34 int filesize;
35 int length;
36 int bitrate;
37 int metadatalength;
38
39 int bitstream_size;
40 int bitstream_index;
41
42 int sample_skip;
43 int framesize;
44
45 int32_t *decoded[MAX_CHANNELS];
46} FLACContext;
47
48int flac_decode_frame(FLACContext *s,
49 uint8_t *buf, int buf_size,
50 void (*yield)(void)) ICODE_ATTR_FLAC;
51
52#endif