changeset 4720:10ad330c1733

fixed WAV demuxer so that it skips to the actual start of the audio data
author melanson
date Sat, 16 Feb 2002 05:45:16 +0000
parents 62eb233b12ed
children e441ca06638d
files libmpdemux/demux_audio.c
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_audio.c	Sat Feb 16 01:30:11 2002 +0000
+++ b/libmpdemux/demux_audio.c	Sat Feb 16 05:45:16 2002 +0000
@@ -133,6 +133,8 @@
     }
     break;
   case WAV: {
+    unsigned int chunk_type;
+    unsigned int chunk_size;
     WAVEFORMATEX* w;
     int l;
     sh_audio->wf = w = (WAVEFORMATEX*)malloc(sizeof(WAVEFORMATEX));
@@ -152,6 +154,13 @@
     l -= 16;
     if(l)
       stream_skip(s,l);
+    do
+    {
+      chunk_type = stream_read_fourcc(demuxer->stream);
+      chunk_size = stream_read_dword_le(demuxer->stream);
+      if (chunk_type != mmioFOURCC('d', 'a', 't', 'a'))
+        stream_skip(demuxer->stream, chunk_size);
+    } while (chunk_type != mmioFOURCC('d', 'a', 't', 'a'));
     demuxer->movi_start = stream_tell(s);
     demuxer->movi_end = s->end_pos;
   } break;
@@ -219,7 +228,7 @@
     return 1;
   }
   default:
-    printf("Audio demuxer : unknow format %d\n",priv->frmt);
+    printf("Audio demuxer : unknown format %d\n",priv->frmt);
   }