diff options
Diffstat (limited to 'firmware/export')
-rw-r--r-- | firmware/export/id3.h | 9 | ||||
-rw-r--r-- | firmware/export/mp3data.h | 66 | ||||
-rw-r--r-- | firmware/export/mpeg.h | 1 |
3 files changed, 71 insertions, 5 deletions
diff --git a/firmware/export/id3.h b/firmware/export/id3.h index 55ce002c2e..30be4bf883 100644 --- a/firmware/export/id3.h +++ b/firmware/export/id3.h | |||
@@ -39,15 +39,18 @@ struct mp3entry { | |||
39 | unsigned int first_frame_offset; /* Byte offset to first real MP3 frame. | 39 | unsigned int first_frame_offset; /* Byte offset to first real MP3 frame. |
40 | Used for skipping leading garbage to | 40 | Used for skipping leading garbage to |
41 | avoid gaps between tracks. */ | 41 | avoid gaps between tracks. */ |
42 | unsigned int xing_header_pos; | ||
42 | unsigned int filesize; /* in bytes */ | 43 | unsigned int filesize; /* in bytes */ |
43 | unsigned int length; /* song length */ | 44 | unsigned int length; /* song length */ |
44 | unsigned int elapsed; /* ms played */ | 45 | unsigned int elapsed; /* ms played */ |
46 | |||
47 | /* MP3 stream specific info */ | ||
45 | long bpf; /* bytes per frame */ | 48 | long bpf; /* bytes per frame */ |
46 | long tpf; /* time per frame */ | 49 | long tpf; /* time per frame */ |
47 | 50 | ||
48 | /* Xing VBR fields */ | 51 | /* Xing VBR fields */ |
49 | bool vbr; | 52 | bool vbr; |
50 | unsigned char vbrflags; | 53 | bool has_toc; /* True if there is a VBR header in the file */ |
51 | unsigned char toc[100];/* table of contents */ | 54 | unsigned char toc[100];/* table of contents */ |
52 | 55 | ||
53 | /* these following two fields are used for local buffering */ | 56 | /* these following two fields are used for local buffering */ |
@@ -59,10 +62,6 @@ struct mp3entry { | |||
59 | int index; /* playlist index */ | 62 | int index; /* playlist index */ |
60 | }; | 63 | }; |
61 | 64 | ||
62 | #define VBR_FRAMES_FLAG 0x01 | ||
63 | #define VBR_BYTES_FLAG 0x02 | ||
64 | #define VBR_TOC_FLAG 0x04 | ||
65 | |||
66 | enum { | 65 | enum { |
67 | ID3_VER_1_0 = 1, | 66 | ID3_VER_1_0 = 1, |
68 | ID3_VER_1_1, | 67 | ID3_VER_1_1, |
diff --git a/firmware/export/mp3data.h b/firmware/export/mp3data.h new file mode 100644 index 0000000000..a1018ebaa2 --- /dev/null +++ b/firmware/export/mp3data.h | |||
@@ -0,0 +1,66 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #ifndef _MP3DATA_H_ | ||
21 | #define _MP3DATA_H_ | ||
22 | |||
23 | #define MPEG_VERSION2_5 0 | ||
24 | #define MPEG_VERSION1 1 | ||
25 | #define MPEG_VERSION2 2 | ||
26 | |||
27 | struct mp3info { | ||
28 | /* Standard MP3 frame header fields */ | ||
29 | int version; | ||
30 | int layer; | ||
31 | bool protection; | ||
32 | int bitrate; | ||
33 | int frequency; | ||
34 | int padding; | ||
35 | int channel_mode; | ||
36 | int mode_extension; | ||
37 | int emphasis; | ||
38 | int frame_size; /* Frame size in bytes */ | ||
39 | int frame_time; /* Frame duration in milliseconds */ | ||
40 | |||
41 | bool is_vbr; /* True if the file is VBR */ | ||
42 | bool has_toc; /* True if there is a VBR header in the file */ | ||
43 | bool is_xing_vbr; /* True if the VBR header is of Xing type */ | ||
44 | bool is_vbri_vbr; /* True if the VBR header is of VBRI type */ | ||
45 | unsigned char toc[100]; | ||
46 | int frame_count; /* Number of frames in the file (if VBR) */ | ||
47 | int byte_count; /* File size in bytes */ | ||
48 | int file_time; /* Length of the whole file in milliseconds */ | ||
49 | int xing_header_pos; | ||
50 | }; | ||
51 | |||
52 | /* Xing header information */ | ||
53 | #define VBR_FRAMES_FLAG 0x01 | ||
54 | #define VBR_BYTES_FLAG 0x02 | ||
55 | #define VBR_TOC_FLAG 0x04 | ||
56 | |||
57 | |||
58 | unsigned long find_next_frame(int fd, int *offset, int max_offset, unsigned long last_header); | ||
59 | int get_mp3file_info(int fd, struct mp3info *info); | ||
60 | int count_mp3_frames(int fd, int startpos, int filesize, | ||
61 | void (*progressfunc)(int)); | ||
62 | int create_xing_header(int fd, int startpos, int filesize, | ||
63 | unsigned char *buf, int num_frames, | ||
64 | void (*progressfunc)(int)); | ||
65 | |||
66 | #endif | ||
diff --git a/firmware/export/mpeg.h b/firmware/export/mpeg.h index 6b44363f8f..9ce03daa7d 100644 --- a/firmware/export/mpeg.h +++ b/firmware/export/mpeg.h | |||
@@ -90,6 +90,7 @@ unsigned long mpeg_num_recorded_bytes(void); | |||
90 | #endif | 90 | #endif |
91 | void mpeg_get_debugdata(struct mpeg_debug *dbgdata); | 91 | void mpeg_get_debugdata(struct mpeg_debug *dbgdata); |
92 | void mpeg_set_buffer_margin(int seconds); | 92 | void mpeg_set_buffer_margin(int seconds); |
93 | int mpeg_create_xing_header(char *filename, void (*progressfunc)(int)); | ||
93 | 94 | ||
94 | #define SOUND_VOLUME 0 | 95 | #define SOUND_VOLUME 0 |
95 | #define SOUND_BASS 1 | 96 | #define SOUND_BASS 1 |