summaryrefslogtreecommitdiff
path: root/src/demuxers/demux_wav.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/demuxers/demux_wav.c')
-rw-r--r--src/demuxers/demux_wav.c14
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;
}