Go to the documentation of this file.
53 int bs_code, sr_code, bps_code;
56 if ((
get_bits(gb, 15) & 0x7FFF) != 0x7FFC) {
78 "invalid channel mode: %d\n", fi->
ch_mode);
84 if (bps_code == 3 || bps_code == 7) {
86 "invalid sample size code (%d)\n",
95 "broken stream, invalid padding\n");
103 "sample/frame number invalid; utf8 fscked\n");
110 "reserved blocksize code: 0\n");
112 }
else if (bs_code == 6) {
114 }
else if (bs_code == 7) {
123 }
else if (sr_code == 12) {
124 fi->samplerate =
get_bits(gb, 8) * 1000;
125 }
else if (sr_code == 13) {
127 }
else if (sr_code == 14) {
128 fi->samplerate =
get_bits(gb, 16) * 10;
131 "illegal sample rate code %d\n",
141 "header crc mismatch\n");
157 count += ch * ((7+
bps+7)/8);
160 count += (( 2*
bps+1) * blocksize + 7) / 8;
162 count += ( ch*
bps * blocksize + 7) / 8;
171 uint8_t **streaminfo_start)
191 *streaminfo_start = &avctx->
extradata[8];
221 s->max_blocksize = 16;
static const int8_t sample_size_table[]
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
#define AV_LOG_WARNING
Something somehow does not look correct.
int sample_rate
samples per second
#define AV_CHANNEL_LAYOUT_5POINT1
static int get_bits_count(const GetBitContext *s)
#define AV_CHANNEL_LAYOUT_6POINT1
int64_t frame_or_sample_num
frame number or sample number
int is_var_size
specifies if the stream uses variable block sizes or a fixed block size; also determines the meaning ...
int ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s, const uint8_t *buffer)
Parse the Streaminfo metadata block.
#define AV_CHANNEL_LAYOUT_MONO
int ff_flac_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb, FLACFrameInfo *fi, int log_level_offset)
Validate and decode a frame header.
#define AV_CHANNEL_LAYOUT_STEREO
enum AVChannelOrder order
Channel order used in this layout.
int nb_channels
Number of channels in this layout.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
#define AV_CHANNEL_LAYOUT_5POINT0
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
void ff_flac_set_channel_layout(AVCodecContext *avctx, int channels)
AVChannelLayout ch_layout
Audio channel layout.
static const AVChannelLayout flac_channel_layouts[8]
#define AV_CHANNEL_LAYOUT_SURROUND
static double val(void *priv, double ch)
@ FLAC_CHMODE_INDEPENDENT
const int32_t ff_flac_blocksize_table[16]
#define GET_UTF8(val, GET_BYTE, ERROR)
Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
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.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample format(the sample packing is implied by the sample format) and sample rate. The lists are not just lists
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
const int ff_flac_sample_rate_table[16]
FLACCOMMONINFO int blocksize
block size of the frame
static unsigned int get_bits1(GetBitContext *s)
#define FLAC_STREAMINFO_SIZE
#define AV_CHANNEL_LAYOUT_7POINT1
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
int ff_flac_is_extradata_valid(AVCodecContext *avctx, enum FLACExtradataFormat *format, uint8_t **streaminfo_start)
Validate the FLAC extradata.
An AVChannelLayout holds information about the channel layout of audio data.
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
@ FLAC_EXTRADATA_FORMAT_FULL_HEADER
static int64_t get_utf8(GetBitContext *gb)
static uint64_t get_bits64(GetBitContext *s, int n)
Read 0-64 bits.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
int ch_mode
channel decorrelation mode
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
#define FLAC_MAX_CHANNELS
main external API structure.
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
Calculate the CRC of a block.
@ FLAC_EXTRADATA_FORMAT_STREAMINFO
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define MKTAG(a, b, c, d)
#define FLAC_MIN_BLOCKSIZE
#define AV_CHANNEL_LAYOUT_QUAD