FFmpeg
Functions | Variables
flac.c File Reference
#include "libavutil/channel_layout.h"
#include "libavutil/crc.h"
#include "libavutil/log.h"
#include "bytestream.h"
#include "get_bits.h"
#include "flac.h"
#include "flacdata.h"
#include "flac_parse.h"

Go to the source code of this file.

Functions

static int64_t get_utf8 (GetBitContext *gb)
 
int ff_flac_decode_frame_header (void *logctx, GetBitContext *gb, FLACFrameInfo *fi, int log_level_offset)
 Validate and decode a frame header. More...
 
int ff_flac_is_extradata_valid (AVCodecContext *avctx, uint8_t **streaminfo_start)
 Validate the FLAC extradata. More...
 
void ff_flac_set_channel_layout (AVCodecContext *avctx, int channels)
 
int ff_flac_parse_streaminfo (AVCodecContext *avctx, struct FLACStreaminfo *s, const uint8_t *buffer)
 Parse the Streaminfo metadata block. More...
 

Variables

static const int8_t sample_size_table [] = { 0, 8, 12, 0, 16, 20, 24, 32 }
 
static const AVChannelLayout flac_channel_layouts [8]
 

Function Documentation

◆ get_utf8()

static int64_t get_utf8 ( GetBitContext gb)
static

Definition at line 44 of file flac.c.

Referenced by ff_flac_decode_frame_header().

◆ ff_flac_decode_frame_header()

int ff_flac_decode_frame_header ( void *  logctx,
GetBitContext gb,
FLACFrameInfo fi,
int  log_level_offset 
)

Validate and decode a frame header.

Parameters
logctxcontext for logging
gbGetBitContext from which to read frame header
[out]fiframe information
log_level_offsetlog level offset. can be used to silence error messages.
Returns
non-zero on error, 0 if ok

Definition at line 51 of file flac.c.

Referenced by decode_frame(), and frame_header_is_valid().

◆ ff_flac_is_extradata_valid()

int ff_flac_is_extradata_valid ( AVCodecContext avctx,
uint8_t **  streaminfo_start 
)

Validate the FLAC extradata.

Parameters
[in]avctxcodec context containing the extradata.
[out]formatextradata format.
[out]streaminfo_startpointer to start of 34-byte STREAMINFO data.
Returns
1 if valid, 0 if not valid.

Definition at line 149 of file flac.c.

Referenced by flac_decode_init().

◆ ff_flac_set_channel_layout()

void ff_flac_set_channel_layout ( AVCodecContext avctx,
int  channels 
)

Definition at line 173 of file flac.c.

Referenced by decode_frame(), ff_flac_parse_streaminfo(), and get_best_header().

◆ ff_flac_parse_streaminfo()

int ff_flac_parse_streaminfo ( AVCodecContext avctx,
struct FLACStreaminfo s,
const uint8_t *  buffer 
)

Parse the Streaminfo metadata block.

Parameters
[out]avctxcodec context to set basic stream parameters
[out]swhere parsed information is stored
[in]bufferpointer to start of 34-byte streaminfo data
Returns
negative error code on faiure or >= 0 on success

Definition at line 187 of file flac.c.

Referenced by flac_decode_init(), and parse_streaminfo().

Variable Documentation

◆ sample_size_table

const int8_t sample_size_table[] = { 0, 8, 12, 0, 16, 20, 24, 32 }
static

Definition at line 31 of file flac.c.

Referenced by ff_flac_decode_frame_header().

◆ flac_channel_layouts

const AVChannelLayout flac_channel_layouts[8]
static
AV_CHANNEL_LAYOUT_STEREO
#define AV_CHANNEL_LAYOUT_STEREO
Definition: channel_layout.h:379
AV_CHANNEL_LAYOUT_SURROUND
#define AV_CHANNEL_LAYOUT_SURROUND
Definition: channel_layout.h:382
AV_CHANNEL_LAYOUT_7POINT1
#define AV_CHANNEL_LAYOUT_7POINT1
Definition: channel_layout.h:401
AV_CHANNEL_LAYOUT_QUAD
#define AV_CHANNEL_LAYOUT_QUAD
Definition: channel_layout.h:387
AV_CHANNEL_LAYOUT_MONO
#define AV_CHANNEL_LAYOUT_MONO
Definition: channel_layout.h:378
AV_CHANNEL_LAYOUT_6POINT1
#define AV_CHANNEL_LAYOUT_6POINT1
Definition: channel_layout.h:396
AV_CHANNEL_LAYOUT_5POINT0
#define AV_CHANNEL_LAYOUT_5POINT0
Definition: channel_layout.h:388
AV_CHANNEL_LAYOUT_5POINT1
#define AV_CHANNEL_LAYOUT_5POINT1
Definition: channel_layout.h:389