FFmpeg
flac.c
Go to the documentation of this file.
1 /*
2  * FLAC common code
3  * Copyright (c) 2009 Justin Ruggles
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
23 #include "libavutil/crc.h"
24 #include "libavutil/log.h"
25 #include "bytestream.h"
26 #include "get_bits.h"
27 #include "flac.h"
28 #include "flacdata.h"
29 
30 static const int8_t sample_size_table[] = { 0, 8, 12, 0, 16, 20, 24, 0 };
31 
32 static const uint64_t flac_channel_layouts[8] = {
41 };
42 
43 static int64_t get_utf8(GetBitContext *gb)
44 {
45  int64_t val;
46  GET_UTF8(val, get_bits(gb, 8), return -1;)
47  return val;
48 }
49 
51  FLACFrameInfo *fi, int log_level_offset)
52 {
53  int bs_code, sr_code, bps_code;
54 
55  /* frame sync code */
56  if ((get_bits(gb, 15) & 0x7FFF) != 0x7FFC) {
57  av_log(avctx, AV_LOG_ERROR + log_level_offset, "invalid sync code\n");
58  return AVERROR_INVALIDDATA;
59  }
60 
61  /* variable block size stream code */
62  fi->is_var_size = get_bits1(gb);
63 
64  /* block size and sample rate codes */
65  bs_code = get_bits(gb, 4);
66  sr_code = get_bits(gb, 4);
67 
68  /* channels and decorrelation */
69  fi->ch_mode = get_bits(gb, 4);
70  if (fi->ch_mode < FLAC_MAX_CHANNELS) {
71  fi->channels = fi->ch_mode + 1;
72  fi->ch_mode = FLAC_CHMODE_INDEPENDENT;
73  } else if (fi->ch_mode < FLAC_MAX_CHANNELS + FLAC_CHMODE_MID_SIDE) {
74  fi->channels = 2;
75  fi->ch_mode -= FLAC_MAX_CHANNELS - 1;
76  } else {
77  av_log(avctx, AV_LOG_ERROR + log_level_offset,
78  "invalid channel mode: %d\n", fi->ch_mode);
79  return AVERROR_INVALIDDATA;
80  }
81 
82  /* bits per sample */
83  bps_code = get_bits(gb, 3);
84  if (bps_code == 3 || bps_code == 7) {
85  av_log(avctx, AV_LOG_ERROR + log_level_offset,
86  "invalid sample size code (%d)\n",
87  bps_code);
88  return AVERROR_INVALIDDATA;
89  }
90  fi->bps = sample_size_table[bps_code];
91 
92  /* reserved bit */
93  if (get_bits1(gb)) {
94  av_log(avctx, AV_LOG_ERROR + log_level_offset,
95  "broken stream, invalid padding\n");
96  return AVERROR_INVALIDDATA;
97  }
98 
99  /* sample or frame count */
100  fi->frame_or_sample_num = get_utf8(gb);
101  if (fi->frame_or_sample_num < 0) {
102  av_log(avctx, AV_LOG_ERROR + log_level_offset,
103  "sample/frame number invalid; utf8 fscked\n");
104  return AVERROR_INVALIDDATA;
105  }
106 
107  /* blocksize */
108  if (bs_code == 0) {
109  av_log(avctx, AV_LOG_ERROR + log_level_offset,
110  "reserved blocksize code: 0\n");
111  return AVERROR_INVALIDDATA;
112  } else if (bs_code == 6) {
113  fi->blocksize = get_bits(gb, 8) + 1;
114  } else if (bs_code == 7) {
115  fi->blocksize = get_bits(gb, 16) + 1;
116  } else {
117  fi->blocksize = ff_flac_blocksize_table[bs_code];
118  }
119 
120  /* sample rate */
121  if (sr_code < 12) {
122  fi->samplerate = ff_flac_sample_rate_table[sr_code];
123  } else if (sr_code == 12) {
124  fi->samplerate = get_bits(gb, 8) * 1000;
125  } else if (sr_code == 13) {
126  fi->samplerate = get_bits(gb, 16);
127  } else if (sr_code == 14) {
128  fi->samplerate = get_bits(gb, 16) * 10;
129  } else {
130  av_log(avctx, AV_LOG_ERROR + log_level_offset,
131  "illegal sample rate code %d\n",
132  sr_code);
133  return AVERROR_INVALIDDATA;
134  }
135 
136  /* header CRC-8 check */
137  skip_bits(gb, 8);
139  get_bits_count(gb)/8)) {
140  av_log(avctx, AV_LOG_ERROR + log_level_offset,
141  "header crc mismatch\n");
142  return AVERROR_INVALIDDATA;
143  }
144 
145  return 0;
146 }
147 
148 int ff_flac_get_max_frame_size(int blocksize, int ch, int bps)
149 {
150  /* Technically, there is no limit to FLAC frame size, but an encoder
151  should not write a frame that is larger than if verbatim encoding mode
152  were to be used. */
153 
154  int count;
155 
156  count = 16; /* frame header */
157  count += ch * ((7+bps+7)/8); /* subframe headers */
158  if (ch == 2) {
159  /* for stereo, need to account for using decorrelation */
160  count += (( 2*bps+1) * blocksize + 7) / 8;
161  } else {
162  count += ( ch*bps * blocksize + 7) / 8;
163  }
164  count += 2; /* frame footer */
165 
166  return count;
167 }
168 
171  uint8_t **streaminfo_start)
172 {
173  if (!avctx->extradata || avctx->extradata_size < FLAC_STREAMINFO_SIZE) {
174  av_log(avctx, AV_LOG_ERROR, "extradata NULL or too small.\n");
175  return 0;
176  }
177  if (AV_RL32(avctx->extradata) != MKTAG('f','L','a','C')) {
178  /* extradata contains STREAMINFO only */
179  if (avctx->extradata_size != FLAC_STREAMINFO_SIZE) {
180  av_log(avctx, AV_LOG_WARNING, "extradata contains %d bytes too many.\n",
182  }
184  *streaminfo_start = avctx->extradata;
185  } else {
186  if (avctx->extradata_size < 8+FLAC_STREAMINFO_SIZE) {
187  av_log(avctx, AV_LOG_ERROR, "extradata too small.\n");
188  return 0;
189  }
191  *streaminfo_start = &avctx->extradata[8];
192  }
193  return 1;
194 }
195 
197 {
199  avctx->channel_layout = flac_channel_layouts[avctx->channels - 1];
200  else
201  avctx->channel_layout = 0;
202 }
203 
205  const uint8_t *buffer)
206 {
207  GetBitContext gb;
209 
210  skip_bits(&gb, 16); /* skip min blocksize */
211  s->max_blocksize = get_bits(&gb, 16);
212  if (s->max_blocksize < FLAC_MIN_BLOCKSIZE) {
213  av_log(avctx, AV_LOG_WARNING, "invalid max blocksize: %d\n",
214  s->max_blocksize);
215  s->max_blocksize = 16;
216  return AVERROR_INVALIDDATA;
217  }
218 
219  skip_bits(&gb, 24); /* skip min frame size */
220  s->max_framesize = get_bits_long(&gb, 24);
221 
222  s->samplerate = get_bits_long(&gb, 20);
223  s->channels = get_bits(&gb, 3) + 1;
224  s->bps = get_bits(&gb, 5) + 1;
225 
226  if (s->bps < 4) {
227  av_log(avctx, AV_LOG_ERROR, "invalid bps: %d\n", s->bps);
228  s->bps = 16;
229  return AVERROR_INVALIDDATA;
230  }
231 
232  avctx->channels = s->channels;
233  avctx->sample_rate = s->samplerate;
234  avctx->bits_per_raw_sample = s->bps;
235 
236  if (!avctx->channel_layout ||
239 
240  s->samples = get_bits64(&gb, 36);
241 
242  skip_bits_long(&gb, 64); /* md5 sum */
243  skip_bits_long(&gb, 64); /* md5 sum */
244 
245  return 0;
246 }
sample_size_table
static const int8_t sample_size_table[]
Definition: flac.c:30
AV_CH_LAYOUT_6POINT1
#define AV_CH_LAYOUT_6POINT1
Definition: channel_layout.h:102
FLAC_CHMODE_MID_SIDE
@ FLAC_CHMODE_MID_SIDE
Definition: flac.h:44
skip_bits_long
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
Definition: get_bits.h:291
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
AVCodecContext::channel_layout
uint64_t channel_layout
Audio channel layout.
Definition: avcodec.h:2276
AVCodecContext::sample_rate
int sample_rate
samples per second
Definition: avcodec.h:2225
MKTAG
#define MKTAG(a, b, c, d)
Definition: common.h:366
AV_CH_LAYOUT_MONO
#define AV_CH_LAYOUT_MONO
Definition: channel_layout.h:85
get_bits_long
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
Definition: get_bits.h:546
ch
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(const uint8_t *) pi - 0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(const int16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(const int16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(const int32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(const int32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(const int64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0f/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(const float *) pi *(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(const double *) pi *(INT64_C(1)<< 63))) #define FMT_PAIR_FUNC(out, in) static conv_func_type *const fmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={ FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64), };static void cpy1(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, len);} static void cpy2(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 2 *len);} static void cpy4(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 4 *len);} static void cpy8(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 8 *len);} AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, const int *ch_map, int flags) { AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) return NULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) return NULL;if(channels==1){ in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);} ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map) { switch(av_get_bytes_per_sample(in_fmt)){ case 1:ctx->simd_f=cpy1;break;case 2:ctx->simd_f=cpy2;break;case 4:ctx->simd_f=cpy4;break;case 8:ctx->simd_f=cpy8;break;} } if(HAVE_X86ASM &&1) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);if(ARCH_ARM) swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);if(ARCH_AARCH64) swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);return ctx;} void swri_audio_convert_free(AudioConvert **ctx) { av_freep(ctx);} int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len) { int ch;int off=0;const int os=(out->planar ? 1 :out->ch_count) *out->bps;unsigned misaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask) { int planes=in->planar ? in->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;} if(ctx->out_simd_align_mask) { int planes=out->planar ? out->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;} if(ctx->simd_f &&!ctx->ch_map &&!misaligned){ off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){ if(out->planar==in->planar){ int planes=out->planar ? out->ch_count :1;for(ch=0;ch< planes;ch++){ ctx->simd_f(out-> ch ch
Definition: audioconvert.c:56
get_bits_count
static int get_bits_count(const GetBitContext *s)
Definition: get_bits.h:219
count
void INT64 INT64 count
Definition: avisynth_c.h:767
ff_flac_parse_streaminfo
int ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s, const uint8_t *buffer)
Parse the Streaminfo metadata block.
Definition: flac.c:204
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.
Definition: flac.c:50
init_get_bits
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
Definition: get_bits.h:659
crc.h
skip_bits
static void skip_bits(GetBitContext *s, int n)
Definition: get_bits.h:467
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:379
GetBitContext
Definition: get_bits.h:61
AV_CH_LAYOUT_STEREO
#define AV_CH_LAYOUT_STEREO
Definition: channel_layout.h:86
AV_CH_LAYOUT_QUAD
#define AV_CH_LAYOUT_QUAD
Definition: channel_layout.h:94
ff_flac_blocksize_table
const int32_t ff_flac_blocksize_table[16]
Definition: flacdata.c:30
GET_UTF8
#define GET_UTF8(val, GET_BYTE, ERROR)
Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form.
Definition: common.h:385
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
FLACStreaminfo
Definition: flac.h:80
AVCodecContext::extradata_size
int extradata_size
Definition: avcodec.h:1667
s
#define s(width, name)
Definition: cbs_vp9.c:257
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.
Definition: flac.c:148
format
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
AVCodecContext::bits_per_raw_sample
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
Definition: avcodec.h:2796
get_bits.h
FLACExtradataFormat
FLACExtradataFormat
Definition: flac.h:58
ff_flac_sample_rate_table
const int ff_flac_sample_rate_table[16]
Definition: flacdata.c:24
GetBitContext::buffer
const uint8_t * buffer
Definition: get_bits.h:62
get_bits1
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:498
AV_CH_LAYOUT_5POINT1
#define AV_CH_LAYOUT_5POINT1
Definition: channel_layout.h:96
ff_flac_set_channel_layout
void ff_flac_set_channel_layout(AVCodecContext *avctx)
Definition: flac.c:196
FLAC_STREAMINFO_SIZE
#define FLAC_STREAMINFO_SIZE
Definition: flac.h:34
FLACFrameInfo
Definition: flac.h:84
av_get_channel_layout_nb_channels
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
Definition: channel_layout.c:220
ff_flac_is_extradata_valid
int ff_flac_is_extradata_valid(AVCodecContext *avctx, enum FLACExtradataFormat *format, uint8_t **streaminfo_start)
Validate the FLAC extradata.
Definition: flac.c:169
bps
unsigned bps
Definition: movenc.c:1497
flacdata.h
val
const char const char void * val
Definition: avisynth_c.h:863
fi
AVS_FilterInfo ** fi
Definition: avisynth_c.h:807
av_crc_get_table
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
Definition: crc.c:374
FLAC_EXTRADATA_FORMAT_FULL_HEADER
@ FLAC_EXTRADATA_FORMAT_FULL_HEADER
Definition: flac.h:60
get_utf8
static int64_t get_utf8(GetBitContext *gb)
Definition: flac.c:43
AVCodecContext::channels
int channels
number of audio channels
Definition: avcodec.h:2226
get_bits64
static uint64_t get_bits64(GetBitContext *s, int n)
Read 0-64 bits.
Definition: get_bits.h:572
AV_CH_LAYOUT_5POINT0
#define AV_CH_LAYOUT_5POINT0
Definition: channel_layout.h:95
log.h
AVCodecContext::extradata
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:1666
AV_CH_LAYOUT_7POINT1
#define AV_CH_LAYOUT_7POINT1
Definition: channel_layout.h:107
uint8_t
uint8_t
Definition: audio_convert.c:194
AV_CH_LAYOUT_SURROUND
#define AV_CH_LAYOUT_SURROUND
Definition: channel_layout.h:89
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen_template.c:38
AV_RL32
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:88
FLAC_MAX_CHANNELS
#define FLAC_MAX_CHANNELS
Definition: flac.h:35
AVCodecContext
main external API structure.
Definition: avcodec.h:1565
channel_layout.h
buffer
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
Definition: filter_design.txt:49
av_crc
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
Calculate the CRC of a block.
Definition: crc.c:392
FLAC_EXTRADATA_FORMAT_STREAMINFO
@ FLAC_EXTRADATA_FORMAT_STREAMINFO
Definition: flac.h:59
AV_CRC_8_ATM
@ AV_CRC_8_ATM
Definition: crc.h:50
bytestream.h
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
FLAC_MIN_BLOCKSIZE
#define FLAC_MIN_BLOCKSIZE
Definition: flac.h:36
flac.h
FLAC_CHMODE_INDEPENDENT
@ FLAC_CHMODE_INDEPENDENT
Definition: flac.h:41
flac_channel_layouts
static const uint64_t flac_channel_layouts[8]
Definition: flac.c:32