mp3_hdr.h: fix mp_check_mp3_header()
[mplayer/glamo.git] / libmpdemux / mp3_hdr.h
bloba9b34ac12c1412bcf50796057a5a6b4dad80e665
1 /*
2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #ifndef MPLAYER_MP3_HDR_H
20 #define MPLAYER_MP3_HDR_H
22 #include <stddef.h>
24 int mp_get_mp3_header(unsigned char* hbuf,int* chans, int* freq, int* spf, int* mpa_layer, int* br);
26 #define mp_decode_mp3_header(hbuf) mp_get_mp3_header(hbuf,NULL,NULL,NULL,NULL,NULL)
28 static inline int mp_check_mp3_header(unsigned int head){
29 unsigned char tmp[4] = {head >> 24, head >> 16, head >> 8, head};
30 if( (head & 0xffe00000) != 0xffe00000 ||
31 (head & 0x00000c00) == 0x00000c00) return 0;
32 if(mp_decode_mp3_header(tmp)<=0) return 0;
33 return 1;
36 #endif /* MPLAYER_MP3_HDR_H */