[MPlayer-cvslog] CVS: main/libmpdemux mp3_hdr.c,1.10,1.11

Nico Sabbi CVS syncmail at mplayerhq.hu
Sun Apr 24 10:41:48 CEST 2005


CVS change done by Nico Sabbi CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv14756

Modified Files:
	mp3_hdr.c 
Log Message:
wrong framesize calculation for layers 1 and 2 with lsf set

Index: mp3_hdr.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/mp3_hdr.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- mp3_hdr.c	17 Apr 2005 09:42:51 -0000	1.10
+++ mp3_hdr.c	24 Apr 2005 08:41:45 -0000	1.11
@@ -35,7 +35,7 @@
  * return frame size or -1 (bad frame)
  */
 int mp_get_mp3_header(unsigned char* hbuf,int* chans, int* srate, int* spf, int* mpa_layer){
-    int stereo,ssize,lsf,framesize,padding,bitrate_index,sampling_frequency;
+    int stereo,ssize,lsf,framesize,padding,bitrate_index,sampling_frequency, divisor;
     int layer, mult[3] = { 12000, 144000, 144000 };
     unsigned long newhead = 
       hbuf[0] << 24 |
@@ -108,7 +108,8 @@
 	return -1;
     }
 
-    framesize /= freqs[sampling_frequency]<<lsf;
+    divisor = (layer == 3 ? (freqs[sampling_frequency] << lsf) : freqs[sampling_frequency]); 
+    framesize /= divisor;
     if(layer==1)
       framesize = (framesize+padding)*4;
     else




More information about the MPlayer-cvslog mailing list