changeset 8059:e64ff1e1593c

workaround old mencoder's cbr-mp3 header bug
author arpi
date Sat, 02 Nov 2002 21:52:48 +0000
parents 9246adcf95f0
children af1cf8a7e9d2
files libmpdemux/demux_avi.c
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_avi.c	Sat Nov 02 20:10:18 2002 +0000
+++ b/libmpdemux/demux_avi.c	Sat Nov 02 21:52:48 2002 +0000
@@ -46,11 +46,18 @@
 		priv->audio_block_size=sh->wf->nChannels*(sh->wf->wBitsPerSample/8);
 	    else
 		priv->audio_block_size=1; // hope the best...
+	  } else {
+	    // workaround old mencoder's bug:
+	    if(sh->audio.dwSampleSize==1 && sh->audio.dwScale==1 &&
+	       (sh->wf->nBlockAlign==1152 || sh->wf->nBlockAlign==576)){
+		mp_msg(MSGT_DEMUX,MSGL_WARN,"AVI: Workarounding CBR-MP3 nBlockAlign header bug!\n");
+		priv->audio_block_size=1;
+	    }
 	  }
 	} else {
 	  priv->audio_block_size=sh->audio.dwSampleSize;
 	}
-	//printf("&&&&& setting blocksize to %d &&&&&\n",demux->audio->block_size);
+//	printf("&&&&& setting blocksize to %d &&&&&\n",priv->audio_block_size);
       }
       return demux->audio;
   }
@@ -125,6 +132,7 @@
       // update blockcount:
       priv->audio_block_no+=priv->audio_block_size ?
 	((len+priv->audio_block_size-1)/priv->audio_block_size) : 1;
+//      printf("\raudio_block_no=%d      \n",priv->audio_block_no);
   } else 
   if(ds==demux->video){
      // video
@@ -151,6 +159,7 @@
   
   if(ds){
     mp_dbg(MSGT_DEMUX,MSGL_DBG2,"DEMUX_AVI: Read %d data bytes from packet %04X\n",len,id);
+//    printf("READ[%c] %5.3f  (%d)   \n",ds==demux->video?'V':'A',pts,len);
     ds_read_packet(ds,demux->stream,len,pts,idxpos,flags);
     skip-=len;
   }