diff options
author | Björn Stenberg <bjorn@haxx.se> | 2008-10-15 06:38:51 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2008-10-15 06:38:51 +0000 |
commit | 51b45d56029eb8b928be64fc50332f3ba10e0228 (patch) | |
tree | 675370fb2fd6c8f09f51c214567fa82a38155ad6 /apps/mp3data.h | |
parent | a18ef2efd389b1874b09264d497232ccc9386e9e (diff) | |
download | rockbox-51b45d56029eb8b928be64fc50332f3ba10e0228.tar.gz rockbox-51b45d56029eb8b928be64fc50332f3ba10e0228.zip |
Split id3.c/h into metadata.c/h and metadata/mp3.c. Updated all references. Moved mp3data.c/h from firmware to apps.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18814 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/mp3data.h')
-rw-r--r-- | apps/mp3data.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/apps/mp3data.h b/apps/mp3data.h new file mode 100644 index 0000000000..2a6a27ac2d --- /dev/null +++ b/apps/mp3data.h | |||
@@ -0,0 +1,83 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #ifndef _MP3DATA_H_ | ||
23 | #define _MP3DATA_H_ | ||
24 | |||
25 | #define MPEG_VERSION1 0 | ||
26 | #define MPEG_VERSION2 1 | ||
27 | #define MPEG_VERSION2_5 2 | ||
28 | |||
29 | struct mp3info { | ||
30 | /* Standard MP3 frame header fields */ | ||
31 | int version; | ||
32 | int layer; | ||
33 | bool protection; | ||
34 | int bitrate; | ||
35 | long frequency; | ||
36 | int padding; | ||
37 | int channel_mode; | ||
38 | int mode_extension; | ||
39 | int emphasis; | ||
40 | int frame_size; /* Frame size in bytes */ | ||
41 | int frame_samples; /* Samples per frame */ | ||
42 | int ft_num; /* Numerator of frametime in milliseconds */ | ||
43 | int ft_den; /* Denominator of frametime in milliseconds */ | ||
44 | |||
45 | bool is_vbr; /* True if the file is VBR */ | ||
46 | bool has_toc; /* True if there is a VBR header in the file */ | ||
47 | bool is_xing_vbr; /* True if the VBR header is of Xing type */ | ||
48 | bool is_vbri_vbr; /* True if the VBR header is of VBRI type */ | ||
49 | unsigned char toc[100]; | ||
50 | unsigned long frame_count; /* Number of frames in the file (if VBR) */ | ||
51 | unsigned long byte_count; /* File size in bytes */ | ||
52 | unsigned long file_time; /* Length of the whole file in milliseconds */ | ||
53 | unsigned long vbr_header_pos; | ||
54 | int enc_delay; /* Encoder delay, fetched from LAME header */ | ||
55 | int enc_padding; /* Padded samples added to last frame. LAME header */ | ||
56 | }; | ||
57 | |||
58 | /* Xing header information */ | ||
59 | #define VBR_FRAMES_FLAG 0x01 | ||
60 | #define VBR_BYTES_FLAG 0x02 | ||
61 | #define VBR_TOC_FLAG 0x04 | ||
62 | #define VBR_QUALITY_FLAG 0x08 | ||
63 | |||
64 | #define MAX_XING_HEADER_SIZE 576 | ||
65 | |||
66 | unsigned long find_next_frame(int fd, long *offset, long max_offset, | ||
67 | unsigned long last_header); | ||
68 | unsigned long mem_find_next_frame(int startpos, long *offset, long max_offset, | ||
69 | unsigned long last_header); | ||
70 | int get_mp3file_info(int fd, struct mp3info *info); | ||
71 | int count_mp3_frames(int fd, int startpos, int filesize, | ||
72 | void (*progressfunc)(int)); | ||
73 | int create_xing_header(int fd, long startpos, long filesize, | ||
74 | unsigned char *buf, unsigned long num_frames, | ||
75 | unsigned long rec_time, unsigned long header_template, | ||
76 | void (*progressfunc)(int), bool generate_toc); | ||
77 | |||
78 | extern unsigned long bytes2int(unsigned long b0, | ||
79 | unsigned long b1, | ||
80 | unsigned long b2, | ||
81 | unsigned long b3); | ||
82 | |||
83 | #endif | ||