39 int sample_rate_index, bitrate_index;
46 if (header & (1<<20)) {
47 s->lsf = (header & (1<<19)) ? 0 : 1;
54 s->layer = 4 - ((header >> 17) & 3);
56 sample_rate_index = (header >> 10) & 3;
58 sample_rate_index = 0;
60 sample_rate_index += 3 * (s->lsf + mpeg25);
61 s->sample_rate_index = sample_rate_index;
62 s->error_protection = ((header >> 16) & 1) ^ 1;
65 bitrate_index = (header >> 12) & 0xf;
66 padding = (header >> 9) & 1;
68 s->mode = (header >> 6) & 3;
69 s->mode_ext = (header >> 4) & 3;
79 if (bitrate_index != 0) {
81 s->bit_rate = frame_size * 1000;
84 frame_size = (frame_size * 12000) / sample_rate;
85 frame_size = (frame_size + padding) * 4;
88 frame_size = (frame_size * 144000) / sample_rate;
89 frame_size += padding;
93 frame_size = (frame_size * 144000) / (sample_rate << s->lsf);
94 frame_size += padding;
105 s->layer, s->sample_rate, s->bit_rate);
106 if (s->nb_channels == 2) {
150 *sample_rate = s->sample_rate;
151 *channels = s->nb_channels;
152 *bit_rate = s->bit_rate;
153 return s->frame_size;
mpeg audio layer common tables.
const uint16_t avpriv_mpa_freq_tab[3]
static const uint8_t header[24]
AVCodecID
Identify the syntax and semantics of the bitstream.
#define MODE_EXT_MS_STEREO
preferred ID for decoding MPEG audio layer 1, 2 or 3
#define FF_ARRAY_ELEMS(a)
Libavcodec external API header.
#define MODE_EXT_I_STEREO
common internal api header.
common internal and external API header
mpeg audio declarations for both encoder and decoder.
const uint16_t avpriv_mpa_bitrate_tab[2][3][15]