annotate libmpdemux/mp3_hdr.h @ 36938:c53705079a9d

Cosmetic: Adjust indent.
author ib
date Fri, 21 Mar 2014 15:13:44 +0000
parents 7b4f8ecdc33b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25553
diff changeset
19 #ifndef MPLAYER_MP3_HDR_H
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25553
diff changeset
20 #define MPLAYER_MP3_HDR_H
4710
701976d7a7d1 fast header checker added
arpi
parents:
diff changeset
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
e29f95ed5d36 Fix vbr muxing and win32 codec crash on init
albeu
parents: 4710
diff changeset
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
701976d7a7d1 fast header checker added
arpi
parents:
diff changeset
27
701976d7a7d1 fast header checker added
arpi
parents:
diff changeset
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
701976d7a7d1 fast header checker added
arpi
parents:
diff changeset
33 return 1;
701976d7a7d1 fast header checker added
arpi
parents:
diff changeset
34 }
25553
6ac1ece1f9fe Add multiple inclusion guards to all header files that lack them.
diego
parents: 16162
diff changeset
35
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25553
diff changeset
36 #endif /* MPLAYER_MP3_HDR_H */