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;
71 while(buf0 < end && !*buf0)
77 for(; buf <
end; buf= buf2+1) {
82 for(frames = 0; buf2 <
end; frames++) {
90 max_frames =
FFMAX(max_frames, frames);
102 else if(max_frames>=1 && max_frames >= p->
buf_size/10000)
return 1;
111 int fill_index = mp3->
usetoc && duration > 0;
134 #define LAST_BITS(k, n) ((k) & ((1 << (n)) - 1))
135 #define MIDDLE_BITS(k, m, n) LAST_BITS((k) >> (m), ((n) - (m)))
143 int32_t r_gain = INT32_MIN, a_gain = INT32_MIN;
146 static const int64_t
xing_offtbl[2][2] = {{32, 17}, {17,9}};
150 avio_skip(s->
pb, xing_offtbl[c->lsf == 1][c->nb_channels == 1]);
167 }
else if (delta > min >> 4) {
169 "filesize and duration do not match (growing file?)\n");
227 mp3->start_pad =
v>>12;
228 mp3-> end_pad =
v&4095;
229 st->skip_samples = mp3->start_pad + 528 + 1;
231 st->first_discard_sample = -mp3->end_pad + 528 + 1 + mp3->frames * (int64_t)spf;
232 st->last_discard_sample = mp3->frames * (int64_t)spf;
274 if (v ==
MKBETAG(
'V',
'B',
'R',
'I')) {
302 vbrtag_size = c.frame_size;
306 spf = c.lsf ? 576 : 1152;
323 if (mp3->header_filesize && mp3->frames && !mp3->is_cbr)
324 st->codec->bit_rate =
av_rescale(mp3->header_filesize, 8 *
c.sample_rate, mp3->frames * (int64_t)spf);
368 #define MP3_PACKET_SIZE 1024
413 return sd.frame_size;
434 if (filesize <= s->internal->data_offset)
439 timestamp = av_clip64(timestamp, 0, duration);
461 for(i=0; i<4096; i++) {
462 int64_t pos = ie->
pos + (dir > 0 ? i - 1024 : -i);
463 int64_t candidate = -1;
473 if ((ie->
pos - pos)*dir <= 0 && abs(MIN_VALID/2-j) < score) {
475 score = abs(MIN_VALID/2-j);
479 if (best_score > score && j == MIN_VALID) {
480 best_pos = candidate;
517 .extensions =
"mp2,mp3,m2a,mpa",
518 .priv_class = &demuxer_class,