diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2012-05-02 18:34:45 +0400 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2012-05-12 01:01:02 +0400 |
commit | b39a573eee650baedd41e766e0f349f8a617093f (patch) | |
tree | a2a8431c123e92703d59b4990e311f049e709c5b | |
parent | 2edc7a2d7dcc42cc1cb51682a32ac10a87d1809a (diff) |
riff: don't overwrite bpp from WAVEFORMATEX if EXTENSIBLE doesn't contain that data.lav0.50.5lav0.50.4lav0.50.3
According to the specification on the MSDN [1], 0 is valid for that particular field, and it should be ignored in that case.
[1]: http://msdn.microsoft.com/en-us/library/windows/desktop/dd757714(v=vs.85).aspx
-rw-r--r-- | libavformat/riff.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/riff.c b/libavformat/riff.c index ccb587a2b2..4a2622cc7e 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -588,7 +588,9 @@ int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) cbSize = FFMIN(size, cbSize); if (cbSize >= 22 && id == 0xfffe) { /* WAVEFORMATEXTENSIBLE */ ff_asf_guid subformat; - codec->bits_per_coded_sample = avio_rl16(pb); + int bpp = avio_rl16(pb); + if (bpp) + codec->bits_per_coded_sample = bpp; codec->channel_layout = avio_rl32(pb); /* dwChannelMask */ ff_get_guid(pb, &subformat); if (!memcmp(subformat + 4, (const uint8_t[]){FF_MEDIASUBTYPE_BASE_GUID}, 12)) { |