aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorAndreas Öman <andreas@lonelycoder.com>2007-10-23 17:10:41 +0000
committerAndreas Öman <andreas@lonelycoder.com>2007-10-23 17:10:41 +0000
commitdb233e832f0b327e5fc6a37816d4bc7cea6299b8 (patch)
tree3f6675c408bcf0b1aac973c5fd62556ceb604adb /libavformat
parentca851a3a082f3678c5f0e7e8dc24480a5f483ec6 (diff)
downloadffmpeg-db233e832f0b327e5fc6a37816d4bc7cea6299b8.tar.gz
cosmetical change of mp3_parse_xing() to prepare for upcoming VBRI tag support
Originally committed as revision 10846 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mp3.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/libavformat/mp3.c b/libavformat/mp3.c
index b2bc89587a..a711d7ff5f 100644
--- a/libavformat/mp3.c
+++ b/libavformat/mp3.c
@@ -430,26 +430,30 @@ static int mp3_read_probe(AVProbeData *p)
*/
static void mp3_parse_xing(AVFormatContext *s, AVStream *st)
{
- uint32_t v, frames, spf;
- const offset_t offtbl[2][2] = {{32, 17}, {17,9}};
+ uint32_t v, spf;
+ int frames = -1; /* Total number of frames in file */
+ const offset_t xing_offtbl[2][2] = {{32, 17}, {17,9}};
MPADecodeContext c;
ff_mpegaudio_decode_header(&c, get_be32(&s->pb));
- url_fseek(&s->pb, offtbl[c.lsf == 1][c.nb_channels == 1], SEEK_CUR);
- v = get_be32(&s->pb);
- if(c.layer != 3 ||
- (v != MKBETAG('X', 'i', 'n', 'g') &&
- v != MKBETAG('I', 'n', 'f', 'o')))
- return;
+ if(c.layer != 3)
+ 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);
- if(v & 0x1) {
- frames = get_be32(&s->pb); /* Total number of frames in file */
- spf = c.lsf ? 576 : 1152; /* Samples per frame, layer 3 */
-
- st->duration = av_rescale_q(frames, (AVRational){spf, c.sample_rate},
- st->time_base);
+ if(v == MKBETAG('X', 'i', 'n', 'g') || v == MKBETAG('I', 'n', 'f', 'o')) {
+ v = get_be32(&s->pb);
+ 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->time_base);
}
static int mp3_read_header(AVFormatContext *s,