FFmpeg
Classes | Macros | Typedefs | Enumerations | Functions
flac.h File Reference

FLAC (Free Lossless Audio Codec) decoder/demuxer common functions. More...

#include "avcodec.h"
#include "bytestream.h"
#include "get_bits.h"

Go to the source code of this file.

Classes

struct  FLACStreaminfo
 
struct  FLACFrameInfo
 

Macros

#define FLAC_STREAMINFO_SIZE   34
 
#define FLAC_MAX_CHANNELS   8
 
#define FLAC_MIN_BLOCKSIZE   16
 
#define FLAC_MAX_BLOCKSIZE   65535
 
#define FLAC_MIN_FRAME_SIZE   11
 
#define FLACCOMMONINFO
 bits-per-sample More...
 
#define FLACSTREAMINFO
 Data needed from the Streaminfo header for use by the raw FLAC demuxer and/or the FLAC decoder. More...
 

Typedefs

typedef struct FLACStreaminfo FLACStreaminfo
 
typedef struct FLACFrameInfo FLACFrameInfo
 

Enumerations

enum  { FLAC_CHMODE_INDEPENDENT = 0, FLAC_CHMODE_LEFT_SIDE = 1, FLAC_CHMODE_RIGHT_SIDE = 2, FLAC_CHMODE_MID_SIDE = 3 }
 
enum  {
  FLAC_METADATA_TYPE_STREAMINFO = 0, FLAC_METADATA_TYPE_PADDING, FLAC_METADATA_TYPE_APPLICATION, FLAC_METADATA_TYPE_SEEKTABLE,
  FLAC_METADATA_TYPE_VORBIS_COMMENT, FLAC_METADATA_TYPE_CUESHEET, FLAC_METADATA_TYPE_PICTURE, FLAC_METADATA_TYPE_INVALID = 127
}
 
enum  FLACExtradataFormat { FLAC_EXTRADATA_FORMAT_STREAMINFO = 0, FLAC_EXTRADATA_FORMAT_FULL_HEADER = 1 }
 

Functions

int ff_flac_parse_streaminfo (AVCodecContext *avctx, struct FLACStreaminfo *s, const uint8_t *buffer)
 Parse the Streaminfo metadata block. More...
 
int ff_flac_is_extradata_valid (AVCodecContext *avctx, enum FLACExtradataFormat *format, uint8_t **streaminfo_start)
 Validate the FLAC extradata. More...
 
int ff_flac_get_max_frame_size (int blocksize, int ch, int bps)
 Calculate an estimate for the maximum frame size based on verbatim mode. More...
 
int ff_flac_decode_frame_header (AVCodecContext *avctx, GetBitContext *gb, FLACFrameInfo *fi, int log_level_offset)
 Validate and decode a frame header. More...
 
void ff_flac_set_channel_layout (AVCodecContext *avctx)
 

Detailed Description

FLAC (Free Lossless Audio Codec) decoder/demuxer common functions.

Macro Definition Documentation

§ FLACCOMMONINFO

#define FLACCOMMONINFO
Value:
int samplerate; \
int channels; \
int bps;

bits-per-sample

§ FLACSTREAMINFO

#define FLACSTREAMINFO
Value:
FLACCOMMONINFO \
int max_blocksize; \
int max_framesize; \
int64_t samples;

Data needed from the Streaminfo header for use by the raw FLAC demuxer and/or the FLAC decoder.

total number of samples

Function Documentation

§ ff_flac_decode_frame_header()

int ff_flac_decode_frame_header ( AVCodecContext avctx,
GetBitContext gb,
FLACFrameInfo fi,
int  log_level_offset 
)

Validate and decode a frame header.

Parameters
avctxAVCodecContext to use as av_log() context
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

§ ff_flac_get_max_frame_size()

int ff_flac_get_max_frame_size ( int  blocksize,
int  ch,
int  bps 
)

Calculate an estimate for the maximum frame size based on verbatim mode.

Parameters
blocksizeblock size, in samples
chnumber of channels
bpsbits-per-sample

§ ff_flac_is_extradata_valid()

int ff_flac_is_extradata_valid ( AVCodecContext avctx,
enum FLACExtradataFormat *  format,
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.

§ 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