[Mplayer-cvslog] CVS: main/libmpdemux demux_mov.c,1.41,1.42

Atmosfear atmos4 at mplayer.dev.hu
Wed Mar 20 05:22:17 CET 2002


Update of /cvsroot/mplayer/main/libmpdemux
In directory mplayer:/var/tmp.root/cvs-serv5795/libmpdemux

Modified Files:
	demux_mov.c 
Log Message:
add alternative samplerate calculation for files with timescale\!=samplerate

Index: demux_mov.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mov.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- demux_mov.c	19 Mar 2002 21:48:55 -0000	1.41
+++ demux_mov.c	20 Mar 2002 04:22:14 -0000	1.42
@@ -627,12 +627,33 @@
 
 		sh->samplesize=char2short(trak->stdata,18)/8;
 		sh->channels=char2short(trak->stdata,16);
+		/*printf("MOV: timescale: %d samplerate: %d durmap: %d (%d) -> %d (%d)\n",
+		    trak->timescale, char2short(trak->stdata,24), trak->durmap[0].dur,
+		    trak->durmap[0].num, trak->timescale/trak->durmap[0].dur,
+		    char2short(trak->stdata,24)/trak->durmap[0].dur);*/
 		sh->samplerate=char2short(trak->stdata,24);
+		if((sh->samplerate < 8000) && trak->durmap) {
+		  switch(char2short(trak->stdata,24)/trak->durmap[0].dur) {
+		    // TODO: add more cases.
+		    case 31:
+		      sh->samplerate = 32000; break;
+		    case 43:
+		      sh->samplerate = 44100; break;
+		    case 47:
+		      sh->samplerate = 48000; break;
+		    default:
+		      mp_msg(MSGT_DEMUX, MSGL_WARN,
+			  "MOV: unable to determine audio samplerate, "
+			  "assuming 44.1kHz (got %d)\n",
+			  char2short(trak->stdata,24)/trak->durmap[0].dur);
+		      sh->samplerate = 44100;
+		  }  
+		}  
 
 		mp_msg(MSGT_DEMUX, MSGL_INFO, "Audio bits: %d  chans: %d\n",
 		    trak->stdata[19],trak->stdata[17]);
 		mp_msg(MSGT_DEMUX, MSGL_INFO, "Audio sample rate: %d\n",
-		    char2short(trak->stdata,24));
+		    sh->samplerate/*char2short(trak->stdata,24)*/);
 		if((trak->stdata[9]==0) && trak->stdata_len >= 36) { // version 0 with extra atoms
 		    int atom_len = char2int(trak->stdata,28);
 		    switch(char2int(trak->stdata,32)) { // atom type




More information about the MPlayer-cvslog mailing list