[Mplayer-cvslog] CVS: main/libmpdemux demux_mov.c,1.18,1.19
Arpi of Ize
arpi at mplayer.dev.hu
Mon Oct 29 22:25:30 CET 2001
Update of /cvsroot/mplayer/main/libmpdemux
In directory mplayer:/var/tmp.root/cvs-serv1940
Modified Files:
demux_mov.c
Log Message:
cbr audio fix
Index: demux_mov.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mov.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- demux_mov.c 29 Oct 2001 21:01:00 -0000 1.18
+++ demux_mov.c 29 Oct 2001 21:25:10 -0000 1.19
@@ -424,13 +424,22 @@
sh->format=trak->fourcc;
mp_msg(MSGT_DEMUX, MSGL_INFO, "Audio bits: %d chans: %d\n",trak->stdata[19],trak->stdata[17]);
mp_msg(MSGT_DEMUX, MSGL_INFO, "Fourcc: %.4s\n",&trak->fourcc);
+#if 0
+ { FILE* f=fopen("stdata.dat","wb");
+ fwrite(trak->stdata,trak->stdata_len,1,f);
+ fclose(f); }
+ { FILE* f=fopen("tkdata.dat","wb");
+ fwrite(trak->tkdata,trak->tkdata_len,1,f);
+ fclose(f); }
+#endif
// Emulate WAVEFORMATEX struct:
sh->wf=malloc(sizeof(WAVEFORMATEX));
memset(sh->wf,0,sizeof(WAVEFORMATEX));
- sh->wf->nChannels=trak->stdata[17];
- sh->wf->wBitsPerSample=trak->stdata[19];
- sh->wf->nSamplesPerSec=trak->timescale;
- sh->wf->nAvgBytesPerSec=sh->wf->nChannels*((sh->wf->wBitsPerSample+7)/8)*sh->wf->nSamplesPerSec;
+ sh->wf->nChannels=(trak->stdata[16]<<8)+trak->stdata[17];
+ 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;
// Selection:
if(demuxer->audio->id==-1 || demuxer->audio->id==priv->track_db){
// (auto)selected audio track:
@@ -697,8 +706,20 @@
if(trak->pos>=trak->chunks_size) return 0; // EOF
stream_seek(demuxer->stream,trak->chunks[trak->pos].pos);
pts=(float)(trak->chunks[trak->pos].sample*trak->duration)/(float)trak->timescale;
- x=trak->chunks[trak->pos].size*trak->samplesize;
- x/=ds->ss_div; x*=ds->ss_mul; // compression ratio fix
+ x=trak->chunks[trak->pos].size;
+// x=trak->chunks[trak->pos].size*trak->samplesize;
+ if(trak->samplesize!=1) printf("WARNING! Samplesize=%d \n",trak->samplesize);
+ if(trak->stdata_len>=36){
+ // extended stsd header - works for CBR MP3:
+ x/=(trak->stdata[30]<<8)+trak->stdata[31]; // samples/packet
+ // x*=(trak->stdata[34]<<8)+trak->stdata[35]; // bytes/packet
+ x*=(trak->stdata[38]<<8)+trak->stdata[39]; // bytes/frame
+ } else {
+ // works for ima4: -- we should find this info in mov headers!
+ x/=ds->ss_div; x*=ds->ss_mul; // compression ratio fix ! HACK !
+ // x*=(trak->stdata[18]<<8)+trak->stdata[19];x/=8; // bits/sample
+
+ }
ds_read_packet(ds,demuxer->stream,x,pts,trak->chunks[trak->pos].pos,0);
if(ds==demuxer->audio) mp_msg(MSGT_DEMUX, MSGL_DBG2, "sample %d bytes pts %5.3f\n",trak->chunks[trak->pos].size*trak->samplesize,pts);
} else {
More information about the MPlayer-cvslog
mailing list