changeset 7785:ffe8bfaa2851

fix & workaround possible sig8/sig11 in blocksize calculation
author arpi
date Thu, 17 Oct 2002 22:12:32 +0000
parents cb552fdb7b8a
children 9b594e4eb731
files libmpdemux/demux_avi.c
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_avi.c	Thu Oct 17 21:54:51 2002 +0000
+++ b/libmpdemux/demux_avi.c	Thu Oct 17 22:12:32 2002 +0000
@@ -31,9 +31,17 @@
 
   if(stream_id==demux->audio->id){
       if(!demux->audio->sh){
-        demux->audio->sh=demux->a_streams[stream_id];
+        sh_audio_t* sh;
+        sh=demux->audio->sh=demux->a_streams[stream_id];
         mp_msg(MSGT_DEMUX,MSGL_V,"Auto-selected AVI audio ID = %d\n",demux->audio->id);
-	demux->audio->block_size=((sh_audio_t*)(demux->audio->sh))->wf->nBlockAlign;
+	if(sh->wf){
+	  demux->audio->block_size=sh->wf->nBlockAlign;
+	  if(!demux->audio->block_size){
+	    // for PCM audio we can calculate the blocksize:
+	    if(sh->format==1) demux->audio->block_size=sh->wf->nChannels*(sh->wf->wBitsPerSample/8);
+	    if(!demux->audio->block_size) demux->audio->block_size=1; // bug!
+	  }
+	}
 	//printf("&&&&& setting blocksize to %d &&&&&\n",demux->audio->block_size);
       }
       return demux->audio;