#include <limits.h>#include "avcodec.h"#include "bitstream.h"#include "golomb.h"#include <assert.h>

Go to the source code of this file.
Data Structures | |
| struct | FLACContext |
Defines | |
| #define | MAX_CHANNELS 8 |
| #define | MAX_BLOCKSIZE 65535 |
| #define | FLAC_STREAMINFO_SIZE 34 |
| #define | METADATA_TYPE_STREAMINFO 0 |
Enumerations | |
| enum | decorrelation_type { INDEPENDENT, LEFT_SIDE, RIGHT_SIDE, MID_SIDE } |
Functions | |
| static int64_t | get_utf8 (GetBitContext *gb) |
| static int | get_crc8 (const uint8_t *buf, int count) |
| static void | metadata_streaminfo (FLACContext *s) |
| static void | dump_headers (FLACContext *s) |
| static int | flac_decode_init (AVCodecContext *avctx) |
| static void | allocate_buffers (FLACContext *s) |
| 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) |
| static int | flac_decode_frame (AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size) |
| static int | flac_decode_close (AVCodecContext *avctx) |
| static void | flac_flush (AVCodecContext *avctx) |
Variables | |
| static int | sample_rate_table [] |
| static int | sample_size_table [] |
| static int | blocksize_table [] |
| static const uint8_t | table_crc8 [256] |
| AVCodec | flac_decoder |
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 flac.c.
| #define FLAC_STREAMINFO_SIZE 34 |
| #define METADATA_TYPE_STREAMINFO 0 |
| enum decorrelation_type |
| static void allocate_buffers | ( | FLACContext * | s | ) | [static] |
Definition at line 207 of file flac.c.
References FLACContext::allocated_bitstream_size, av_fast_realloc(), av_realloc(), FLACContext::bitstream, FLACContext::bps, FLACContext::channels, FLACContext::decoded, FLACContext::max_blocksize, and FLACContext::max_framesize.

| static int decode_frame | ( | FLACContext * | s | ) | [static] |
Definition at line 479 of file flac.c.
References align_get_bits(), av_log(), AV_LOG_DEBUG, AV_LOG_ERROR, FLACContext::avctx, FLACContext::blocksize, blocksize_table, FLACContext::bps, bps, GetBitContext::buffer, FLACContext::channels, decode_subframe(), FLACContext::decorrelation, FLACContext::gb, get_bits(), get_bits1(), get_bits_count(), get_crc8(), get_utf8(), INDEPENDENT, LEFT_SIDE, FLACContext::max_blocksize, FLACContext::min_blocksize, sample_rate_table, sample_size_table, FLACContext::samplerate, and skip_bits().

| static int decode_residuals | ( | FLACContext * | s, | |
| int | channel, | |||
| int | pred_order | |||
| ) | [static] |
Definition at line 248 of file flac.c.
References av_log(), AV_LOG_DEBUG, FLACContext::avctx, FLACContext::blocksize, FLACContext::decoded, FLACContext::gb, get_bits(), get_sbits(), get_sr_golomb_flac(), partition, and samples.
Referenced by decode_subframe_fixed(), and decode_subframe_lpc().

| static int decode_subframe | ( | FLACContext * | s, | |
| int | channel | |||
| ) | [inline, static] |
Definition at line 393 of file flac.c.
References av_log(), AV_LOG_DEBUG, FLACContext::avctx, FLACContext::blocksize, FLACContext::bps, FLACContext::curr_bps, decode_subframe_fixed(), decode_subframe_lpc(), FLACContext::decoded, FLACContext::decorrelation, FLACContext::gb, get_bits(), get_bits1(), get_sbits(), LEFT_SIDE, MID_SIDE, RIGHT_SIDE, show_bits(), and skip_bits().
Referenced by decode_frame().

| static int decode_subframe_fixed | ( | FLACContext * | s, | |
| int | channel, | |||
| int | pred_order | |||
| ) | [static] |
Definition at line 290 of file flac.c.
References av_log(), AV_LOG_ERROR, FLACContext::avctx, FLACContext::blocksize, FLACContext::curr_bps, decode_residuals(), FLACContext::decoded, FLACContext::gb, and get_sbits().
Referenced by decode_subframe().

| static int decode_subframe_lpc | ( | FLACContext * | s, | |
| int | channel, | |||
| int | pred_order | |||
| ) | [static] |
Definition at line 342 of file flac.c.
References av_log(), AV_LOG_DEBUG, FLACContext::avctx, FLACContext::blocksize, FLACContext::curr_bps, decode_residuals(), FLACContext::decoded, FLACContext::gb, get_bits(), and get_sbits().
Referenced by decode_subframe(), and shorten_decode_frame().

| static void dump_headers | ( | FLACContext * | s | ) | [static] |
Definition at line 198 of file flac.c.
References av_log(), AV_LOG_DEBUG, FLACContext::avctx, FLACContext::blocksize, FLACContext::bps, FLACContext::channels, FLACContext::max_blocksize, FLACContext::max_framesize, FLACContext::min_blocksize, FLACContext::min_framesize, and FLACContext::samplerate.
Referenced by flac_decode_frame(), and flac_decode_init().

| static int flac_decode_close | ( | AVCodecContext * | avctx | ) | [static] |
Definition at line 793 of file flac.c.
References av_freep(), FLACContext::bitstream, FLACContext::channels, FLACContext::decoded, AVCodecContext::priv_data, and s.

| static int flac_decode_frame | ( | AVCodecContext * | avctx, | |
| void * | data, | |||
| int * | data_size, | |||
| uint8_t * | buf, | |||
| int | buf_size | |||
| ) | [static] |
Definition at line 586 of file flac.c.
References FLACContext::allocated_bitstream_size, av_fast_realloc(), av_log(), AV_LOG_DEBUG, AV_LOG_ERROR, FLACContext::avctx, FLACContext::bitstream, FLACContext::bitstream_index, FLACContext::bitstream_size, FLACContext::blocksize, bswap_32(), FLACContext::channels, decode_frame(), FLACContext::decoded, FLACContext::decorrelation, dump_headers(), FLACContext::gb, get_bits(), get_bits_count(), get_bits_long(), INDEPENDENT, init_get_bits(), LEFT_SIDE, FLACContext::max_framesize, memcpy, metadata_streaminfo(), METADATA_TYPE_STREAMINFO, MID_SIDE, AVCodecContext::priv_data, RIGHT_SIDE, s, samples, show_bits(), show_bits_long(), and skip_bits().

| static int flac_decode_init | ( | AVCodecContext * | avctx | ) | [static] |
Definition at line 183 of file flac.c.
References FLACContext::avctx, dump_headers(), AVCodecContext::extradata, AVCodecContext::extradata_size, FLAC_STREAMINFO_SIZE, FLACContext::gb, init_get_bits(), metadata_streaminfo(), AVCodecContext::priv_data, and s.

| static void flac_flush | ( | AVCodecContext * | avctx | ) | [static] |
Definition at line 807 of file flac.c.
References FLACContext::bitstream_index, FLACContext::bitstream_size, AVCodecContext::priv_data, and s.
| static int get_crc8 | ( | const uint8_t * | buf, | |
| int | count | |||
| ) | [static] |
| static int64_t get_utf8 | ( | GetBitContext * | gb | ) | [static] |
Definition at line 122 of file flac.c.
References bytes, get_bits(), and get_bits1().
Referenced by decode_frame().

| static void metadata_streaminfo | ( | FLACContext * | s | ) | [static] |
Definition at line 224 of file flac.c.
References allocate_buffers(), FLACContext::avctx, FLACContext::bps, AVCodecContext::channels, FLACContext::channels, FLACContext::gb, get_bits(), get_bits_long(), FLACContext::max_blocksize, FLACContext::max_framesize, FLACContext::min_blocksize, FLACContext::min_framesize, AVCodecContext::sample_rate, FLACContext::samplerate, and skip_bits().
Referenced by flac_decode_frame(), and flac_decode_init().

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 82 of file flac.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,
.flush= flac_flush,
}
Definition at line 814 of file flac.c.
Referenced by avcodec_register_all().
int sample_rate_table[] [static] |
Initial value:
{ 0, 0, 0, 0,
8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000,
0, 0, 0, 0 }
Definition at line 74 of file flac.c.
Referenced by decode_frame().
int sample_size_table[] [static] |
Initial value:
{ 0, 8, 12, 0, 16, 20, 24, 0 }
Definition at line 79 of file flac.c.
Referenced by decode_frame().
const uint8_t table_crc8[256] [static] |
1.5.5