changeset 8009:302708769c69

set up nBlockAlign, nBytesPerSec correctly if extended audio header avail.
author arpi
date Thu, 31 Oct 2002 23:16:27 +0000
parents 35d663ad0d95
children 329e9a5a154f
files libmpdemux/demux_mov.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mov.c	Thu Oct 31 23:11:34 2002 +0000
+++ b/libmpdemux/demux_mov.c	Thu Oct 31 23:16:27 2002 +0000
@@ -865,7 +865,15 @@
 		sh->wf->wBitsPerSample=(trak->stdata[18]<<8)+trak->stdata[19];
 		// sh->wf->nSamplesPerSec=trak->timescale;
 		sh->wf->nSamplesPerSec=(trak->stdata[24]<<8)+trak->stdata[25];
-		sh->wf->nAvgBytesPerSec=sh->wf->nChannels*sh->wf->wBitsPerSample*sh->wf->nSamplesPerSec/8;
+		if(trak->stdata_len >= 44 && trak->stdata[9]>=1){
+		//Audio header: samp/pack=4096 bytes/pack=743 bytes/frame=1486 bytes/samp=2
+		  sh->wf->nAvgBytesPerSec=(sh->wf->nChannels*sh->wf->nSamplesPerSec*
+		      char2int(trak->stdata,32)+char2int(trak->stdata,28)/2)
+		      /char2int(trak->stdata,28);
+		  sh->wf->nBlockAlign=char2int(trak->stdata,36);
+		} else {
+		  sh->wf->nAvgBytesPerSec=sh->wf->nChannels*sh->wf->wBitsPerSample*sh->wf->nSamplesPerSec/8;
+		}
 		// Selection:
 		if(demuxer->audio->id==-1 || demuxer->audio->id==priv->track_db){
 		    // (auto)selected audio track: