2005-10-26 12:35:58 +00:00
|
|
|
#ifndef _FLAC_DECODER_H
|
|
|
|
#define _FLAC_DECODER_H
|
|
|
|
|
|
|
|
#include "bitstream.h"
|
|
|
|
|
2021-03-02 18:26:38 +00:00
|
|
|
#define MAX_CHANNELS 6 /* Maximum supported channels, only left/right will be played back */
|
|
|
|
#define MAX_BLOCKSIZE 4608 /* Maxsize in samples of one uncompressed frame */
|
|
|
|
#define MAX_FRAMESIZE 65536 /* Maxsize in bytes of one compressed frame */
|
|
|
|
#define MIN_FRAME_SIZE 11 /* smallest valid FLAC frame possible */
|
2005-10-26 12:35:58 +00:00
|
|
|
|
2006-02-13 19:26:18 +00:00
|
|
|
#define FLAC_OUTPUT_DEPTH 29 /* Provide samples left-shifted to 28 bits+sign */
|
2005-10-26 12:35:58 +00:00
|
|
|
|
|
|
|
enum decorrelation_type {
|
|
|
|
INDEPENDENT,
|
|
|
|
LEFT_SIDE,
|
|
|
|
RIGHT_SIDE,
|
|
|
|
MID_SIDE,
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct FLACContext {
|
|
|
|
GetBitContext gb;
|
|
|
|
|
|
|
|
int min_blocksize, max_blocksize;
|
|
|
|
int min_framesize, max_framesize;
|
|
|
|
int samplerate, channels;
|
|
|
|
int blocksize/*, last_blocksize*/;
|
2021-03-02 18:26:38 +00:00
|
|
|
int bps;
|
2005-10-26 12:35:58 +00:00
|
|
|
unsigned long samplenumber;
|
|
|
|
unsigned long totalsamples;
|
2021-03-02 18:26:38 +00:00
|
|
|
enum decorrelation_type ch_mode;
|
2005-10-26 12:35:58 +00:00
|
|
|
|
|
|
|
int filesize;
|
|
|
|
int length;
|
|
|
|
int bitrate;
|
|
|
|
int metadatalength;
|
|
|
|
|
|
|
|
int bitstream_size;
|
|
|
|
int bitstream_index;
|
2006-11-08 22:00:45 +00:00
|
|
|
|
|
|
|
int sample_skip;
|
|
|
|
int framesize;
|
2011-12-10 22:28:16 +00:00
|
|
|
|
|
|
|
int32_t *decoded[MAX_CHANNELS];
|
2005-10-26 12:35:58 +00:00
|
|
|
} FLACContext;
|
|
|
|
|
|
|
|
int flac_decode_frame(FLACContext *s,
|
|
|
|
uint8_t *buf, int buf_size,
|
2006-11-09 21:59:27 +00:00
|
|
|
void (*yield)(void)) ICODE_ATTR_FLAC;
|
2005-10-26 12:35:58 +00:00
|
|
|
|
|
|
|
#endif
|