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