37 #define XING_FLAG_FRAMES 0x01
38 #define XING_FLAG_SIZE 0x02
39 #define XING_FLAG_TOC 0x04
41 #define XING_TOC_COUNT 100
59 int max_frames, first_frames = 0;
67 while(buf0 < end && !*buf0)
73 for(; buf <
end; buf= buf2+1) {
78 for(frames = 0; buf2 <
end; frames++) {
85 max_frames =
FFMAX(max_frames, frames);
96 else if(max_frames>=1 && max_frames >= p->
buf_size/10000)
return 1;
105 int fill_index = mp3->
usetoc && duration > 0;
128 #define LAST_BITS(k, n) ((k) & ((1 << (n)) - 1))
129 #define MIDDLE_BITS(k, m, n) LAST_BITS((k) >> (m), ((n) - (m)))
137 int32_t r_gain = INT32_MIN, a_gain = INT32_MIN;
140 static const int64_t
xing_offtbl[2][2] = {{32, 17}, {17,9}};
144 avio_skip(s->
pb, xing_offtbl[c->lsf == 1][c->nb_channels == 1]);
161 }
else if (delta > min >> 4) {
163 "filesize and duration do not match (growing file?)\n");
219 mp3->start_pad =
v>>12;
220 mp3-> end_pad =
v&4095;
221 st->skip_samples = mp3->start_pad + 528 + 1;
262 if (v ==
MKBETAG(
'V',
'B',
'R',
'I')) {
290 vbrtag_size = c.frame_size;
294 spf = c.lsf ? 576 : 1152;
311 if (mp3->header_filesize && mp3->frames && !mp3->is_cbr)
312 st->codec->bit_rate =
av_rescale(mp3->header_filesize, 8 *
c.sample_rate, mp3->frames * (int64_t)spf);
356 #define MP3_PACKET_SIZE 1024
401 return sd.frame_size;
422 if (filesize <= s->data_offset)
427 timestamp = av_clip64(timestamp, 0, duration);
449 for(i=0; i<4096; i++) {
450 int64_t pos = ie->
pos + (dir > 0 ? i - 1024 : -i);
451 int64_t candidate = -1;
457 if ((ie->
pos - pos)*dir <= 0 && abs(MIN_VALID/2-j) < score) {
459 score = abs(MIN_VALID/2-j);
463 if (best_score > score && j == MIN_VALID) {
464 best_pos = candidate;
501 .extensions =
"mp2,mp3,m2a,mpa",
502 .priv_class = &demuxer_class,