#include <limits.h>
#include "libavutil/crc.h"
#include "avcodec.h"
#include "internal.h"
#include "get_bits.h"
#include "bytestream.h"
#include "golomb.h"
#include "flac.h"
#include "flacdata.h"
#include <assert.h>
Go to the source code of this file.
Data Structures | |
struct | FLACContext |
Defines | |
#define | DECORRELATE(left, right) |
Functions | |
static void | allocate_buffers (FLACContext *s) |
int | avpriv_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 | avpriv_flac_parse_streaminfo (AVCodecContext *avctx, struct FLACStreaminfo *s, const uint8_t *buffer) |
Parse the Streaminfo metadata block. | |
void | avpriv_flac_parse_block_header (const uint8_t *block_header, int *last, int *type, int *size) |
Parse the metadata block parameters from the header. | |
static int | parse_streaminfo (FLACContext *s, const uint8_t *buf, int buf_size) |
Parse the STREAMINFO from an inline header. | |
static int | get_metadata_size (const uint8_t *buf, int buf_size) |
Determine the size of an inline header. | |
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 *got_frame_ptr, AVPacket *avpkt) |
static av_cold int | flac_decode_close (AVCodecContext *avctx) |
Variables | |
AVCodec | ff_flac_decoder |
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().
static void allocate_buffers | ( | FLACContext * | s | ) | [static] |
int avpriv_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 67 of file flacdec.c.
Referenced by ff_flac_write_header(), flac_decode_init(), flac_write_trailer(), and ogg_build_flac_headers().
void avpriv_flac_parse_block_header | ( | const uint8_t * | block_header, | |
int * | last, | |||
int * | type, | |||
int * | size | |||
) |
Parse the metadata block parameters from the header.
[in] | block_header | header data, at least 4 bytes |
[out] | last | indicator for last metadata block |
[out] | type | metadata block type |
[out] | size | metadata block size |
Definition at line 181 of file flacdec.c.
Referenced by flac_read_header(), get_metadata_size(), and parse_streaminfo().
void avpriv_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 147 of file flacdec.c.
Referenced by flac_decode_init(), flac_header(), flac_read_header(), and parse_streaminfo().
static int decode_frame | ( | FLACContext * | s | ) | [static] |
static int decode_residuals | ( | FLACContext * | s, | |
int | channel, | |||
int | pred_order | |||
) | [static] |
Definition at line 247 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 337 of file flacdec.c.
Referenced by decode_subframe(), and shorten_decode_frame().
static void dump_headers | ( | AVCodecContext * | avctx, | |
FLACStreaminfo * | s | |||
) | [static] |
Definition at line 126 of file flacdec.c.
Referenced by avpriv_flac_parse_streaminfo(), and decode_frame().
static av_cold int flac_decode_close | ( | AVCodecContext * | avctx | ) | [static] |
static int flac_decode_frame | ( | AVCodecContext * | avctx, | |
void * | data, | |||
int * | got_frame_ptr, | |||
AVPacket * | avpkt | |||
) | [static] |
static av_cold int flac_decode_init | ( | AVCodecContext * | avctx | ) | [static] |
static int get_metadata_size | ( | const uint8_t * | buf, | |
int | buf_size | |||
) | [static] |
Determine the size of an inline header.
buf | input buffer, starting with the "fLaC" marker | |
buf_size | buffer size |
Definition at line 226 of file flacdec.c.
Referenced by flac_decode_frame().
static int parse_streaminfo | ( | FLACContext * | s, | |
const uint8_t * | buf, | |||
int | buf_size | |||
) | [static] |
Parse the STREAMINFO from an inline header.
s | the flac decoding context | |
buf | input buffer, starting with the "fLaC" marker | |
buf_size | buffer size |
Definition at line 200 of file flacdec.c.
Referenced by flac_decode_frame().
Initial value:
{ .name = "flac", .type = AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_FLAC, .priv_data_size = sizeof(FLACContext), .init = flac_decode_init, .close = flac_decode_close, .decode = flac_decode_frame, .capabilities = CODEC_CAP_DR1, .long_name= NULL_IF_CONFIG_SMALL("FLAC (Free Lossless Audio Codec)"), }