Commit fdb5ee51 authored by andoma's avatar andoma

cosmetical change of mp3_parse_xing() to prepare for upcoming VBRI tag support



git-svn-id: file:///var/local/repositories/ffmpeg/trunk@10846 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 72840a55
...@@ -430,26 +430,30 @@ static int mp3_read_probe(AVProbeData *p) ...@@ -430,26 +430,30 @@ static int mp3_read_probe(AVProbeData *p)
*/ */
static void mp3_parse_xing(AVFormatContext *s, AVStream *st) static void mp3_parse_xing(AVFormatContext *s, AVStream *st)
{ {
uint32_t v, frames, spf; uint32_t v, spf;
const offset_t offtbl[2][2] = {{32, 17}, {17,9}}; int frames = -1; /* Total number of frames in file */
const offset_t xing_offtbl[2][2] = {{32, 17}, {17,9}};
MPADecodeContext c; MPADecodeContext c;
ff_mpegaudio_decode_header(&c, get_be32(&s->pb)); ff_mpegaudio_decode_header(&c, get_be32(&s->pb));
url_fseek(&s->pb, offtbl[c.lsf == 1][c.nb_channels == 1], SEEK_CUR); if(c.layer != 3)
v = get_be32(&s->pb);
if(c.layer != 3 ||
(v != MKBETAG('X', 'i', 'n', 'g') &&
v != MKBETAG('I', 'n', 'f', 'o')))
return; return;
/* Check for Xing / Info tag */
url_fseek(&s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1], SEEK_CUR);
v = get_be32(&s->pb); v = get_be32(&s->pb);
if(v & 0x1) { if(v == MKBETAG('X', 'i', 'n', 'g') || v == MKBETAG('I', 'n', 'f', 'o')) {
frames = get_be32(&s->pb); /* Total number of frames in file */ v = get_be32(&s->pb);
spf = c.lsf ? 576 : 1152; /* Samples per frame, layer 3 */ if(v & 0x1)
frames = get_be32(&s->pb);
}
if(frames < 0)
return;
spf = c.lsf ? 576 : 1152; /* Samples per frame, layer 3 */
st->duration = av_rescale_q(frames, (AVRational){spf, c.sample_rate}, st->duration = av_rescale_q(frames, (AVRational){spf, c.sample_rate},
st->time_base); st->time_base);
}
} }
static int mp3_read_header(AVFormatContext *s, static int mp3_read_header(AVFormatContext *s,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment