diff options
author | nicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-04-17 09:42:51 +0000 |
---|---|---|
committer | nicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-04-17 09:42:51 +0000 |
commit | aa8b3279f9afd3f933ffc64bf8b9d67edf306b3e (patch) | |
tree | 712f62186dcf298614b21fc96f243c2fcdf06232 /libmpdemux/mp3_hdr.c | |
parent | 1e12bf4d7190c4b3b01f58b92826459fcef8e538 (diff) | |
download | mpv-aa8b3279f9afd3f933ffc64bf8b9d67edf306b3e.tar.bz2 mpv-aa8b3279f9afd3f933ffc64bf8b9d67edf306b3e.tar.xz |
assign correct tag, dwScale and dwBlockAlign to mpeg audio; optionally assign layer and samples_per_frame when parsing mpa header
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15200 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/mp3_hdr.c')
-rw-r--r-- | libmpdemux/mp3_hdr.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libmpdemux/mp3_hdr.c b/libmpdemux/mp3_hdr.c index e431681dd6..4171bc4979 100644 --- a/libmpdemux/mp3_hdr.c +++ b/libmpdemux/mp3_hdr.c @@ -34,7 +34,7 @@ int mp_mp3_get_lsf(unsigned char* hbuf){ /* * return frame size or -1 (bad frame) */ -int mp_get_mp3_header(unsigned char* hbuf,int* chans, int* srate){ +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 layer, mult[3] = { 12000, 144000, 144000 }; unsigned long newhead = @@ -115,7 +115,20 @@ int mp_get_mp3_header(unsigned char* hbuf,int* chans, int* srate){ framesize += padding; // if(framesize<=0 || framesize>MAXFRAMESIZE) return FALSE; - if(srate) *srate = freqs[sampling_frequency]; + if(srate) { + *srate = freqs[sampling_frequency]; + if(spf) { + if(layer == 1) + *spf = 384; + else if(layer == 2) + *spf = 1152; + else if(*srate < 32000) + *spf = 576; + else + *spf = 1152; + } + } + if(mpa_layer) *mpa_layer = layer; if(chans) *chans = stereo; return framesize; |