36 int sample_rate_index, bitrate_index;
37 if (header & (1<<20)) {
38 s->lsf = (header & (1<<19)) ? 0 : 1;
45 s->layer = 4 - ((header >> 17) & 3);
47 sample_rate_index = (header >> 10) & 3;
49 sample_rate_index += 3 * (s->lsf + mpeg25);
50 s->sample_rate_index = sample_rate_index;
51 s->error_protection = ((header >> 16) & 1) ^ 1;
54 bitrate_index = (header >> 12) & 0xf;
55 padding = (header >> 9) & 1;
57 s->mode = (header >> 6) & 3;
58 s->mode_ext = (header >> 4) & 3;
68 if (bitrate_index != 0) {
70 s->bit_rate = frame_size * 1000;
73 frame_size = (frame_size * 12000) / sample_rate;
74 frame_size = (frame_size + padding) * 4;
77 frame_size = (frame_size * 144000) / sample_rate;
78 frame_size += padding;
82 frame_size = (frame_size * 144000) / (sample_rate << s->lsf);
83 frame_size += padding;
93 av_dlog(NULL,
"layer%d, %d Hz, %d kbits/s, ",
94 s->layer, s->sample_rate, s->bit_rate);
95 if (s->nb_channels == 2) {
141 *sample_rate = s->sample_rate;
142 *channels = s->nb_channels;
143 *bit_rate = s->bit_rate;
144 return s->frame_size;