38 int bs_code, sr_code, bps_code;
41 if ((
get_bits(gb, 15) & 0x7FFF) != 0x7FFC) {
62 "invalid channel mode: %d\n", fi->
ch_mode);
68 if (bps_code == 3 || bps_code == 7) {
70 "invalid sample size code (%d)\n",
79 "broken stream, invalid padding\n");
87 "sample/frame number invalid; utf8 fscked\n");
94 "reserved blocksize code: 0\n");
96 }
else if (bs_code == 6) {
98 }
else if (bs_code == 7) {
107 }
else if (sr_code == 12) {
108 fi->samplerate =
get_bits(gb, 8) * 1000;
109 }
else if (sr_code == 13) {
111 }
else if (sr_code == 14) {
112 fi->samplerate =
get_bits(gb, 16) * 10;
115 "illegal sample rate code %d\n",
125 "header crc mismatch\n");
141 count += ch * ((7+bps+7)/8);
144 count += (( 2*bps+1) * blocksize + 7) / 8;
146 count += ( ch*bps * blocksize + 7) / 8;
#define GET_UTF8(val, GET_BYTE, ERROR)
Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form.
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
Calculate the CRC of a block.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
int64_t frame_or_sample_num
frame number or sample number
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.
FLACCOMMONINFO int blocksize
block size of the frame
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
static const int8_t sample_size_table[]
static int64_t get_utf8(GetBitContext *gb)
static int get_bits_count(const GetBitContext *s)
const int16_t ff_flac_blocksize_table[16]
int ch_mode
channel decorrelation mode
FLAC (Free Lossless Audio Codec) decoder/demuxer common functions.
void av_log(void *avcl, int level, const char *fmt,...)
int ff_flac_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb, FLACFrameInfo *fi, int log_level_offset)
Validate and decode a frame header.
const int ff_flac_sample_rate_table[16]
main external API structure.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
int is_var_size
specifies if the stream uses variable block sizes or a fixed block size; also determines the meaning ...
#define FLAC_MAX_CHANNELS