[FFmpeg-cvslog] riff: don't overwrite bps from WAVEFORMATEX if EXTENSIBLE doesn' t contain that data.
Hendrik Leppkes
git at videolan.org
Thu Jun 21 13:35:35 CEST 2012
ffmpeg | branch: master | Hendrik Leppkes <h.leppkes at gmail.com> | Wed May 2 16:34:45 2012 +0200| [24e7a22e1fda8b5b18307a35f0511e659de76389] | committer: Michael Niedermayer
riff: don't overwrite bps from WAVEFORMATEX if EXTENSIBLE doesn't contain that data.
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
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=24e7a22e1fda8b5b18307a35f0511e659de76389
---
libavformat/riff.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libavformat/riff.c b/libavformat/riff.c
index 3fc4fb2..7c91b42 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -596,7 +596,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 bps = avio_rl16(pb);
+ if (bps)
+ codec->bits_per_coded_sample = bps;
codec->channel_layout = avio_rl32(pb); /* dwChannelMask */
ff_get_guid(pb, &subformat);
if (!memcmp(subformat + 4, (const uint8_t[]){FF_MEDIASUBTYPE_BASE_GUID}, 12)) {
More information about the ffmpeg-cvslog
mailing list