#include <limits.h>
#include "libavutil/crc.h"
#include "avcodec.h"
#include "bitstream.h"
#include "golomb.h"
#include "flac.h"
#include <assert.h>
Go to the source code of this file.
Data Structures | |
| struct | FLACContext |
Defines | |
| #define | ALT_BITSTREAM_READER |
| #define | MAX_CHANNELS 8 |
| #define | MAX_BLOCKSIZE 65535 |
| #define | DECORRELATE(left, right) |
Enumerations | |
| enum | decorrelation_type { INDEPENDENT, LEFT_SIDE, RIGHT_SIDE, MID_SIDE } |
Functions | |
| static int64_t | get_utf8 (GetBitContext *gb) |
| static void | allocate_buffers (FLACContext *s) |
| int | ff_flac_is_extradata_valid (AVCodecContext *avctx, enum FLACExtradataFormat *format, uint8_t **streaminfo_start) |
| Validate the FLAC extradata. | |
| static av_cold int | flac_decode_init (AVCodecContext *avctx) |
| static void | dump_headers (AVCodecContext *avctx, FLACStreaminfo *s) |
| void | ff_flac_parse_streaminfo (AVCodecContext *avctx, struct FLACStreaminfo *s, const uint8_t *buffer) |
| Parse the Streaminfo metadata block. | |
| static int | metadata_parse (FLACContext *s) |
| Parse a list of metadata blocks. | |
| static int | decode_residuals (FLACContext *s, int channel, int pred_order) |
| static int | decode_subframe_fixed (FLACContext *s, int channel, int pred_order) |
| static int | decode_subframe_lpc (FLACContext *s, int channel, int pred_order) |
| static int | decode_subframe (FLACContext *s, int channel) |
| static int | decode_frame (FLACContext *s, int alloc_data_size) |
| static int | flac_decode_frame (AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size) |
| static av_cold int | flac_decode_close (AVCodecContext *avctx) |
| static void | flac_flush (AVCodecContext *avctx) |
Variables | |
| static const int | sample_rate_table [] |
| static const int | sample_size_table [] |
| static const int | blocksize_table [] |
| AVCodec | flac_decoder |
For more information on the FLAC format, visit: http://flac.sourceforge.net/
This decoder can be used in 1 of 2 ways: Either raw FLAC data can be fed through, starting from the initial 'fLaC' signature; or by passing the 34-byte streaminfo structure through avctx->extradata[_size] followed by data starting with the 0xFFF8 marker.
Definition in file flacdec.c.
| #define DECORRELATE | ( | left, | |||
| right | ) |
Value:
assert(s->channels == 2);\
for (i = 0; i < s->blocksize; i++) {\
int a= s->decoded[0][i];\
int b= s->decoded[1][i];\
if (s->is32) {\
*samples_32++ = (left) << s->sample_shift;\
*samples_32++ = (right) << s->sample_shift;\
} else {\
*samples_16++ = (left) << s->sample_shift;\
*samples_16++ = (right) << s->sample_shift;\
}\
}\
break;
Referenced by flac_decode_frame().
| #define MAX_BLOCKSIZE 65535 |
Definition at line 49 of file flacdec.c.
Referenced by filter_channel(), read_decoding_params(), and read_major_sync().
| enum decorrelation_type |
| static void allocate_buffers | ( | FLACContext * | s | ) | [static] |
| static int decode_frame | ( | FLACContext * | s, | |
| int | alloc_data_size | |||
| ) | [static] |
| static int decode_residuals | ( | FLACContext * | s, | |
| int | channel, | |||
| int | pred_order | |||
| ) | [static] |
Definition at line 263 of file flacdec.c.
Referenced by decode_subframe_fixed(), and decode_subframe_lpc().
| static int decode_subframe | ( | FLACContext * | s, | |
| int | channel | |||
| ) | [inline, static] |
| static int decode_subframe_fixed | ( | FLACContext * | s, | |
| int | channel, | |||
| int | pred_order | |||
| ) | [static] |
| static int decode_subframe_lpc | ( | FLACContext * | s, | |
| int | channel, | |||
| int | pred_order | |||
| ) | [static] |
Definition at line 353 of file flacdec.c.
Referenced by decode_subframe(), and shorten_decode_frame().
| static void dump_headers | ( | AVCodecContext * | avctx, | |
| FLACStreaminfo * | s | |||
| ) | [static] |
| int ff_flac_is_extradata_valid | ( | AVCodecContext * | avctx, | |
| enum FLACExtradataFormat * | format, | |||
| uint8_t ** | streaminfo_start | |||
| ) |
Validate the FLAC extradata.
| [in] | avctx | codec context containing the extradata. |
| [out] | format | extradata format. |
| [out] | streaminfo_start | pointer to start of 34-byte STREAMINFO data. |
Definition at line 100 of file flacdec.c.
Referenced by ff_flac_write_header(), flac_decode_init(), flac_write_trailer(), and ogg_build_flac_headers().
| void ff_flac_parse_streaminfo | ( | AVCodecContext * | avctx, | |
| struct FLACStreaminfo * | s, | |||
| const uint8_t * | buffer | |||
| ) |
Parse the Streaminfo metadata block.
| [out] | avctx | codec context to set basic stream parameters |
| [out] | s | where parsed information is stored |
| [in] | buffer | pointer to start of 34-byte streaminfo data |
Definition at line 183 of file flacdec.c.
Referenced by flac_decode_init(), flac_header(), and metadata_parse().
| static av_cold int flac_decode_close | ( | AVCodecContext * | avctx | ) | [static] |
| static int flac_decode_frame | ( | AVCodecContext * | avctx, | |
| void * | data, | |||
| int * | data_size, | |||
| const uint8_t * | buf, | |||
| int | buf_size | |||
| ) | [static] |
| static av_cold int flac_decode_init | ( | AVCodecContext * | avctx | ) | [static] |
| static void flac_flush | ( | AVCodecContext * | avctx | ) | [static] |
| static int64_t get_utf8 | ( | GetBitContext * | gb | ) | [static] |
| static int metadata_parse | ( | FLACContext * | s | ) | [static] |
Parse a list of metadata blocks.
This list of blocks must begin with the fLaC marker.
| s | the flac decoding context containing the gb bit reader used to parse metadata |
Definition at line 224 of file flacdec.c.
Referenced by flac_decode_frame().
const int blocksize_table[] [static] |
Initial value:
{
0, 192, 576<<0, 576<<1, 576<<2, 576<<3, 0, 0,
256<<0, 256<<1, 256<<2, 256<<3, 256<<4, 256<<5, 256<<6, 256<<7
}
Definition at line 86 of file flacdec.c.
Referenced by decode_frame().
Initial value:
{
"flac",
CODEC_TYPE_AUDIO,
CODEC_ID_FLAC,
sizeof(FLACContext),
flac_decode_init,
NULL,
flac_decode_close,
flac_decode_frame,
CODEC_CAP_DELAY,
.flush= flac_flush,
.long_name= NULL_IF_CONFIG_SMALL("FLAC (Free Lossless Audio Codec)"),
}
const int sample_rate_table[] [static] |
Initial value:
{ 0,
88200, 176400, 192000,
8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000,
0, 0, 0, 0 }
Definition at line 77 of file flacdec.c.
Referenced by decode_frame().
const int sample_size_table[] [static] |
Initial value:
{ 0, 8, 12, 0, 16, 20, 24, 0 }
Definition at line 83 of file flacdec.c.
Referenced by decode_frame().
1.5.8