Mercurial > mplayer.hg
comparison libmpdemux/mp3_hdr.c @ 15251:c39173a67cbb
wrong framesize calculation for layers 1 and 2 with lsf set
author | nicodvb |
---|---|
date | Sun, 24 Apr 2005 08:41:45 +0000 |
parents | 980910eb6f0c |
children | b5c2254d13f8 |
comparison
equal
deleted
inserted
replaced
15250:e891ff7a7b6c | 15251:c39173a67cbb |
---|---|
33 | 33 |
34 /* | 34 /* |
35 * return frame size or -1 (bad frame) | 35 * return frame size or -1 (bad frame) |
36 */ | 36 */ |
37 int mp_get_mp3_header(unsigned char* hbuf,int* chans, int* srate, int* spf, int* mpa_layer){ | 37 int mp_get_mp3_header(unsigned char* hbuf,int* chans, int* srate, int* spf, int* mpa_layer){ |
38 int stereo,ssize,lsf,framesize,padding,bitrate_index,sampling_frequency; | 38 int stereo,ssize,lsf,framesize,padding,bitrate_index,sampling_frequency, divisor; |
39 int layer, mult[3] = { 12000, 144000, 144000 }; | 39 int layer, mult[3] = { 12000, 144000, 144000 }; |
40 unsigned long newhead = | 40 unsigned long newhead = |
41 hbuf[0] << 24 | | 41 hbuf[0] << 24 | |
42 hbuf[1] << 16 | | 42 hbuf[1] << 16 | |
43 hbuf[2] << 8 | | 43 hbuf[2] << 8 | |
106 if(!framesize){ | 106 if(!framesize){ |
107 mp_msg(MSGT_DEMUXER,MSGL_DBG2,"invalid framesize/bitrate_index\n"); | 107 mp_msg(MSGT_DEMUXER,MSGL_DBG2,"invalid framesize/bitrate_index\n"); |
108 return -1; | 108 return -1; |
109 } | 109 } |
110 | 110 |
111 framesize /= freqs[sampling_frequency]<<lsf; | 111 divisor = (layer == 3 ? (freqs[sampling_frequency] << lsf) : freqs[sampling_frequency]); |
112 framesize /= divisor; | |
112 if(layer==1) | 113 if(layer==1) |
113 framesize = (framesize+padding)*4; | 114 framesize = (framesize+padding)*4; |
114 else | 115 else |
115 framesize += padding; | 116 framesize += padding; |
116 | 117 |