Mercurial > mplayer.hg
annotate libmpdemux/mp3_hdr.h @ 36418:155e6100949c
Code changes to avoid additional unnecessary re-inits.
author | reimar |
---|---|
date | Sat, 16 Nov 2013 23:23:46 +0000 |
parents | 7b4f8ecdc33b |
children |
rev | line source |
---|---|
29238
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26143
diff
changeset
|
1 /* |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26143
diff
changeset
|
2 * This file is part of MPlayer. |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26143
diff
changeset
|
3 * |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26143
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26143
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26143
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26143
diff
changeset
|
7 * (at your option) any later version. |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26143
diff
changeset
|
8 * |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26143
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26143
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26143
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26143
diff
changeset
|
12 * GNU General Public License for more details. |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26143
diff
changeset
|
13 * |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26143
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26143
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26143
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26143
diff
changeset
|
17 */ |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26143
diff
changeset
|
18 |
26029 | 19 #ifndef MPLAYER_MP3_HDR_H |
20 #define MPLAYER_MP3_HDR_H | |
4710 | 21 |
26143
268ecf0e1ba4
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
22 #include <stddef.h> |
268ecf0e1ba4
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
23 |
16162
b5c2254d13f8
set i_bps in demux_audio for WAV and MP3 to avoid division by zero before
reimar
parents:
15199
diff
changeset
|
24 int mp_get_mp3_header(unsigned char* hbuf,int* chans, int* freq, int* spf, int* mpa_layer, int* br); |
6763 | 25 |
16162
b5c2254d13f8
set i_bps in demux_audio for WAV and MP3 to avoid division by zero before
reimar
parents:
15199
diff
changeset
|
26 #define mp_decode_mp3_header(hbuf) mp_get_mp3_header(hbuf,NULL,NULL,NULL,NULL,NULL) |
4710 | 27 |
28 static inline int mp_check_mp3_header(unsigned int head){ | |
32605
7b4f8ecdc33b
Fix mp_check_mp3_header: it checked for a byte-swapped MP3-header
reimar
parents:
29263
diff
changeset
|
29 unsigned char tmp[4] = {head >> 24, head >> 16, head >> 8, head}; |
7b4f8ecdc33b
Fix mp_check_mp3_header: it checked for a byte-swapped MP3-header
reimar
parents:
29263
diff
changeset
|
30 if( (head & 0xffe00000) != 0xffe00000 || |
7b4f8ecdc33b
Fix mp_check_mp3_header: it checked for a byte-swapped MP3-header
reimar
parents:
29263
diff
changeset
|
31 (head & 0x00000c00) == 0x00000c00) return 0; |
7b4f8ecdc33b
Fix mp_check_mp3_header: it checked for a byte-swapped MP3-header
reimar
parents:
29263
diff
changeset
|
32 if(mp_decode_mp3_header(tmp)<=0) return 0; |
4710 | 33 return 1; |
34 } | |
25553
6ac1ece1f9fe
Add multiple inclusion guards to all header files that lack them.
diego
parents:
16162
diff
changeset
|
35 |
26029 | 36 #endif /* MPLAYER_MP3_HDR_H */ |