summaryrefslogtreecommitdiff
path: root/libavcodec/shorten.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-09-14 15:20:22 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2011-10-20 13:09:25 -0400
commit07745485ef70bd38485c6a391ec2300687528a6d (patch)
treecc36cde5db4b4dd9479376c6d9a9c3317efc7a36 /libavcodec/shorten.c
parenta1f7885a8b40e475c1f7b8651e7b536701a2e770 (diff)
shorten: skip some fields in the WAV header embedded in the shorten header.
fixes incorrect bitrate reporting and potential misreporting of the number of channels.
Diffstat (limited to 'libavcodec/shorten.c')
-rw-r--r--libavcodec/shorten.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index af12e08bfc..af798da1b3 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -231,10 +231,10 @@ static int decode_wave_header(AVCodecContext *avctx, uint8_t *header, int header
return -1;
}
- avctx->channels = get_le16(&hb);
+ skip_bits(&hb, 16); // skip channels (already got from shorten header)
avctx->sample_rate = get_le32(&hb);
- avctx->bit_rate = get_le32(&hb) * 8;
- avctx->block_align = get_le16(&hb);
+ skip_bits(&hb, 32); // skip bit rate (represents original uncompressed bit rate)
+ skip_bits(&hb, 16); // skip block align (not needed)
avctx->bits_per_coded_sample = get_le16(&hb);
if (avctx->bits_per_coded_sample != 16) {
@@ -295,6 +295,7 @@ static int read_header(ShortenContext *s)
av_log(s->avctx, AV_LOG_ERROR, "too many channels: %d\n", s->channels);
return -1;
}
+ s->avctx->channels = s->channels;
/* get blocksize if version > 0 */
if (s->version > 0) {