diff options
author | James Courtier-Dutton <jcdutton@users.sourceforge.net> | 2003-09-01 13:19:28 +0000 |
---|---|---|
committer | James Courtier-Dutton <jcdutton@users.sourceforge.net> | 2003-09-01 13:19:28 +0000 |
commit | 86827e34dbf2aec4151c1735958644029a5d1e32 (patch) | |
tree | f14c5bf3bc0417d71de2864777dbcd5f3882539b /src/demuxers | |
parent | b822540787bcecffb5170ac808ebb7df9f01a0d1 (diff) | |
download | xine-lib-86827e34dbf2aec4151c1735958644029a5d1e32.tar.gz xine-lib-86827e34dbf2aec4151c1735958644029a5d1e32.tar.bz2 |
Add warning and check, so that xine does not try to play
.WAV files with badly contructed headers.
CVS patchset: 5325
CVS date: 2003/09/01 13:19:28
Diffstat (limited to 'src/demuxers')
-rw-r--r-- | src/demuxers/demux_wav.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/demuxers/demux_wav.c b/src/demuxers/demux_wav.c index d318c5998..f8370412f 100644 --- a/src/demuxers/demux_wav.c +++ b/src/demuxers/demux_wav.c @@ -22,7 +22,7 @@ * MS WAV File Demuxer by Mike Melanson (melanson@pcisys.net) * based on WAV specs that are available far and wide * - * $Id: demux_wav.c,v 1.46 2003/08/25 21:51:39 f1rmb Exp $ + * $Id: demux_wav.c,v 1.47 2003/09/01 13:19:28 jcdutton Exp $ */ #ifdef HAVE_CONFIG_H @@ -357,6 +357,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str input_plugin_t *input) { demux_wav_t *this; + uint32_t align; this = xine_xmalloc (sizeof (demux_wav_t)); this->stream = stream; @@ -409,8 +410,15 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str /* special block alignment hack so that the demuxer doesn't send * packets with individual PCM samples */ if ((this->wave->nAvgBytesPerSec / this->wave->nBlockAlign) == - this->wave->nSamplesPerSec) - this->wave->nBlockAlign = PCM_BLOCK_ALIGN; + this->wave->nSamplesPerSec) { + align = PCM_BLOCK_ALIGN / this->wave->nBlockAlign; + align = align * this->wave->nBlockAlign; + this->wave->nBlockAlign = align; + } else { + printf("demux_wav: WAV header inconsistent, cannot play WAV file.\n"); + free (this); + return NULL; + } return &this->demux_plugin; } |