xa: set correct bit rate
authorJustin Ruggles <justin.ruggles@gmail.com>
Tue, 20 Mar 2012 16:13:15 +0000 (12:13 -0400)
committerJustin Ruggles <justin.ruggles@gmail.com>
Tue, 20 Mar 2012 18:12:54 +0000 (14:12 -0400)
Also fixes stream duration calculation.

libavformat/xa.c

index 4cec2da..09ef17f 100644 (file)
@@ -84,6 +84,9 @@ static int xa_read_header(AVFormatContext *s)
     avio_skip(pb, 2);       /* Skip block align */
     avio_skip(pb, 2);       /* Skip bits-per-sample */
 
+    st->codec->bit_rate = av_clip(15LL * st->codec->channels * 8 *
+                                  st->codec->sample_rate / 28, 0, INT_MAX);
+
     avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
     st->start_time = 0;