aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-11-14 20:45:02 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-11-14 20:52:42 +0100
commit1fea432b7a6957b800006fd7c4bd9b4076b0cc06 (patch)
tree3cc52bc2272161533565697905138c88f008bd0e /libavformat
parentecf5e705481a36bf3ea7f63d6bf3f393f9da677e (diff)
downloadffmpeg-1fea432b7a6957b800006fd7c4bd9b4076b0cc06.tar.gz
mp3enc: simplify mp3_write_xing()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mp3enc.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index eab483f850..3f2f02b943 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -185,13 +185,11 @@ static int mp3_write_xing(AVFormatContext *s)
header |= (srate_idx << 2) << 8;
header |= channels << 6;
- for (;;) {
+ for (;; bitrate_idx++) {
if (15 == bitrate_idx)
return -1;
- mask = (bitrate_idx << 4) << 8;
- header |= mask;
- avpriv_mpegaudio_decode_header(&c, header);
+ avpriv_mpegaudio_decode_header(&c, header | (bitrate_idx << (4+8)));
xing_offset=xing_offtbl[c.lsf == 1][c.nb_channels == 1];
needed = 4 // header
+ xing_offset
@@ -203,9 +201,6 @@ static int mp3_write_xing(AVFormatContext *s)
if (needed <= c.frame_size)
break;
-
- header &= ~mask;
- ++bitrate_idx;
}
avio_wb32(s->pb, header);