source: titan/minidlna-1.0.22/tagutils/tagutils-mp3.h @ 13567

Last change on this file since 13567 was 13567, checked in by obi, 11 years ago

[titan] add minidlna-1.0.22 first step

File size: 2.6 KB
Line 
1//=========================================================================
2// FILENAME     : tagutils-mp3.h
3// DESCRIPTION  : MP3 metadata reader
4//=========================================================================
5// Copyright (c) 2008- NETGEAR, Inc. All Rights Reserved.
6//=========================================================================
7
8/*
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23
24struct mp3_frameinfo {
25        int layer;                              // 1,2,3
26        int bitrate;                            // unit=kbps
27        int samplerate;                         // samp/sec
28        int stereo;                             // flag
29
30        int frame_length;                       // bytes
31        int crc_protected;                      // flag
32        int samples_per_frame;                  // calculated
33        int padding;                            // flag
34        int xing_offset;                        // for xing hdr
35        int number_of_frames;
36
37        int frame_offset;
38
39        short mpeg_version;
40        short id3_version;
41
42        int is_valid;
43};
44
45static int _get_mp3tags(char *file, struct song_metadata *psong);
46static int _get_mp3fileinfo(char *file, struct song_metadata *psong);
47static int _decode_mp3_frame(unsigned char *frame, struct mp3_frameinfo *pfi);
48
49// bitrate_tbl[layer_index][bitrate_index]
50static int bitrate_tbl[5][16] = {
51        { 0, 32, 64,  96,  128, 160, 192, 224,  256,   288,  320, 352,  384,  416, 448, 0 },    /* MPEG1, L1 */
52        { 0, 32, 48,  56,  64,  80,  96,  112,  128,   160,  192, 224,  256,  320, 384, 0 },    /* MPEG1, L2 */
53        { 0, 32, 40,  48,  56,  64,  80,  96,   112,   128,  160, 192,  224,  256, 320, 0 },    /* MPEG1, L3 */
54        { 0, 32, 48,  56,  64,  80,  96,  112,  128,   144,  160, 176,  192,  224, 256, 0 },    /* MPEG2/2.5, L1 */
55        { 0, 8,  16,  24,  32,  40,  48,  56,   64,    80,   96,  112,  128,  144, 160, 0 } /* MPEG2/2.5, L2/L3 */
56};
57
58// sample_rate[sample_index][samplerate_index]
59static int sample_rate_tbl[3][4] = {
60        { 44100, 48000, 32000, 0 },     /* MPEG 1 */
61        { 22050, 24000, 16000, 0 },     /* MPEG 2 */
62        { 11025, 12000, 8000,  0 } /* MPEG 2.5 */
63};
Note: See TracBrowser for help on using the repository browser.