RetroArch
flac.h
Go to the documentation of this file.
1 /* license:BSD-3-Clause
2  * copyright-holders:Aaron Giles
3  ***************************************************************************
4 
5  flac.h
6 
7  FLAC compression wrappers
8 
9 ***************************************************************************/
10 
11 #pragma once
12 
13 #ifndef __FLAC_H__
14 #define __FLAC_H__
15 
16 #include <stdint.h>
17 #include "libchdr_zlib.h"
18 #include "FLAC/ordinals.h"
19 #include "FLAC/stream_decoder.h"
20 
21 /***************************************************************************
22  * TYPE DEFINITIONS
23  ***************************************************************************
24  */
25 
26 typedef struct _flac_decoder flac_decoder;
27 struct _flac_decoder {
28  /* output state */
29  FLAC__StreamDecoder* decoder; /* actual encoder */
30  uint32_t sample_rate; /* decoded sample rate */
31  uint8_t channels; /* decoded number of channels */
32  uint8_t bits_per_sample; /* decoded bits per sample */
33  uint32_t compressed_offset; /* current offset in compressed data */
34  const FLAC__byte * compressed_start; /* start of compressed data */
35  uint32_t compressed_length; /* length of compressed data */
36  const FLAC__byte * compressed2_start; /* start of compressed data */
37  uint32_t compressed2_length; /* length of compressed data */
38  int16_t * uncompressed_start[8]; /* pointer to start of uncompressed data (up to 8 streams) */
39  uint32_t uncompressed_offset; /* current position in uncompressed data */
40  uint32_t uncompressed_length; /* length of uncompressed data */
41  int uncompressed_swap; /* swap uncompressed sample data */
42  uint8_t custom_header[0x2a]; /* custom header */
43 };
44 
45 /* ======================> flac_decoder */
46 
47 void flac_decoder_init(flac_decoder* decoder);
48 void flac_decoder_free(flac_decoder* decoder);
52 
53 /* codec-private data for the CDFL codec */
56  /* internal state */
59 #ifdef WANT_SUBCODE
60  zlib_codec_data subcode_decompressor;
61 #endif
63 };
64 
65 /* cdfl compression codec */
66 chd_error cdfl_codec_init(void* codec, uint32_t hunkbytes);
67 void cdfl_codec_free(void* codec);
68 chd_error cdfl_codec_decompress(void *codec, const uint8_t *src, uint32_t complen, uint8_t *dest, uint32_t destlen);
69 
70 #endif /* __FLAC_H__ */
GLsizei samples
Definition: glext.h:7673
void flac_decoder_free(flac_decoder *decoder)
Definition: libchdr_flac.c:56
int swap_endian
Definition: flac.h:57
void flac_decoder_init(flac_decoder *decoder)
Definition: libchdr_flac.c:35
Definition: stream_decoder.h:463
uint32_t compressed2_length
Definition: flac.h:37
enum _chd_error chd_error
Definition: chd.h:280
uint32_t uncompressed_length
Definition: flac.h:40
const FLAC__byte * compressed2_start
Definition: flac.h:36
uint32_t uncompressed_offset
Definition: flac.h:39
uint8_t custom_header[0x2a]
Definition: flac.h:42
uint8_t channels
Definition: flac.h:31
int16_t * uncompressed_start[8]
Definition: flac.h:38
uint32_t flac_decoder_finish(flac_decoder *decoder)
Definition: libchdr_flac.c:181
static uint32_t swap_endian(uint32_t v)
Definition: spirv_cross.cpp:784
int uncompressed_swap
Definition: flac.h:41
const FLAC__byte * compressed_start
Definition: flac.h:34
FLAC__uint8 FLAC__byte
Definition: ordinals.h:72
signed short int16_t
Definition: stdint.h:122
Definition: flac.h:27
static const int num_channels
Definition: switch_audio.c:34
GLenum src
Definition: glext.h:6980
uint8_t * buffer
Definition: flac.h:62
unsigned sample_rate
Definition: ffmpeg_core.c:181
Definition: libchdr_zlib.h:33
void cdfl_codec_free(void *codec)
Definition: libchdr_flac_codec.c:113
uint32_t compressed_offset
Definition: flac.h:33
int flac_decoder_decode_interleaved(flac_decoder *decoder, int16_t *samples, uint32_t num_samples, int swap_endian)
Definition: libchdr_flac.c:130
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)
Definition: libchdr_flac.c:90
chd_error cdfl_codec_decompress(void *codec, const uint8_t *src, uint32_t complen, uint8_t *dest, uint32_t destlen)
Definition: libchdr_flac_codec.c:124
flac_decoder decoder
Definition: flac.h:58
Definition: flac.h:55
uint8_t bits_per_sample
Definition: flac.h:32
uint32_t compressed_length
Definition: flac.h:35
FLAC__StreamDecoder * decoder
Definition: flac.h:29
Definition: video4linux2.c:51
This module contains the functions which implement the stream decoder.
GLenum GLuint GLenum GLsizei length
Definition: glext.h:6233
unsigned char uint8_t
Definition: stdint.h:124
unsigned int uint32_t
Definition: stdint.h:126
chd_error cdfl_codec_init(void *codec, uint32_t hunkbytes)
Definition: libchdr_flac_codec.c:78
uint32_t sample_rate
Definition: flac.h:30