37 #define XING_FLAG_FRAMES 0x01
38 #define XING_FLAG_SIZE 0x02
39 #define XING_FLAG_TOC 0x04
40 #define XING_FLAC_QSCALE 0x08
42 #define XING_TOC_COUNT 100
60 int max_frames, first_frames = 0;
68 while(buf0 < end && !*buf0)
74 for(; buf <
end; buf= buf2+1) {
79 for(frames = 0; buf2 <
end; frames++) {
86 max_frames =
FFMAX(max_frames, frames);
97 else if(max_frames>=1 && max_frames >= p->
buf_size/10000)
return 1;
106 int fill_index = mp3->
usetoc && duration > 0;
129 #define LAST_BITS(k, n) ((k) & ((1 << (n)) - 1))
130 #define MIDDLE_BITS(k, m, n) LAST_BITS((k) >> (m), ((n) - (m)))
138 int32_t r_gain = INT32_MIN, a_gain = INT32_MIN;
141 static const int64_t
xing_offtbl[2][2] = {{32, 17}, {17,9}};
145 avio_skip(s->
pb, xing_offtbl[c->lsf == 1][c->nb_channels == 1]);
162 }
else if (delta > min >> 4) {
164 "filesize and duration do not match (growing file?)\n");
222 mp3->start_pad =
v>>12;
223 mp3-> end_pad =
v&4095;
224 st->skip_samples = mp3->start_pad + 528 + 1;
226 st->first_discard_sample = -mp3->end_pad + 528 + 1 + mp3->frames * (int64_t)spf;
227 st->last_discard_sample = mp3->frames * (int64_t)spf;
269 if (v ==
MKBETAG(
'V',
'B',
'R',
'I')) {
297 vbrtag_size = c.frame_size;
301 spf = c.lsf ? 576 : 1152;
318 if (mp3->header_filesize && mp3->frames && !mp3->is_cbr)
319 st->codec->bit_rate =
av_rescale(mp3->header_filesize, 8 *
c.sample_rate, mp3->frames * (int64_t)spf);
363 #define MP3_PACKET_SIZE 1024
408 return sd.frame_size;
429 if (filesize <= s->data_offset)
434 timestamp = av_clip64(timestamp, 0, duration);
456 for(i=0; i<4096; i++) {
457 int64_t pos = ie->
pos + (dir > 0 ? i - 1024 : -i);
458 int64_t candidate = -1;
468 if ((ie->
pos - pos)*dir <= 0 && abs(MIN_VALID/2-j) < score) {
470 score = abs(MIN_VALID/2-j);
474 if (best_score > score && j == MIN_VALID) {
475 best_pos = candidate;
512 .extensions =
"mp2,mp3,m2a,mpa",
513 .priv_class = &demuxer_class,