add plugins categories file to tarball. Should fix FS#7567.
[Rockbox.git] / firmware / export / mp3data.h
blob6ae97376c8c269275416d0ea1e5525a31cd1e58f
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
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.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #ifndef _MP3DATA_H_
21 #define _MP3DATA_H_
23 #define MPEG_VERSION1 0
24 #define MPEG_VERSION2 1
25 #define MPEG_VERSION2_5 2
27 struct mp3info {
28 /* Standard MP3 frame header fields */
29 int version;
30 int layer;
31 bool protection;
32 int bitrate;
33 long 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_samples; /* Samples per frame */
40 int ft_num; /* Numerator of frametime in milliseconds */
41 int ft_den; /* Denominator of frametime in milliseconds */
43 bool is_vbr; /* True if the file is VBR */
44 bool has_toc; /* True if there is a VBR header in the file */
45 bool is_xing_vbr; /* True if the VBR header is of Xing type */
46 bool is_vbri_vbr; /* True if the VBR header is of VBRI type */
47 unsigned char toc[100];
48 unsigned long frame_count; /* Number of frames in the file (if VBR) */
49 unsigned long byte_count; /* File size in bytes */
50 unsigned long file_time; /* Length of the whole file in milliseconds */
51 unsigned long vbr_header_pos;
52 int enc_delay; /* Encoder delay, fetched from LAME header */
53 int enc_padding; /* Padded samples added to last frame. LAME header */
56 /* Xing header information */
57 #define VBR_FRAMES_FLAG 0x01
58 #define VBR_BYTES_FLAG 0x02
59 #define VBR_TOC_FLAG 0x04
60 #define VBR_QUALITY_FLAG 0x08
62 #define MAX_XING_HEADER_SIZE 576
64 unsigned long find_next_frame(int fd, long *offset, long max_offset,
65 unsigned long last_header);
66 unsigned long mem_find_next_frame(int startpos, long *offset, long max_offset,
67 unsigned long last_header);
68 int get_mp3file_info(int fd, struct mp3info *info);
69 int count_mp3_frames(int fd, int startpos, int filesize,
70 void (*progressfunc)(int));
71 int create_xing_header(int fd, long startpos, long filesize,
72 unsigned char *buf, unsigned long num_frames,
73 unsigned long rec_time, unsigned long header_template,
74 void (*progressfunc)(int), bool generate_toc);
76 extern unsigned long bytes2int(unsigned long b0,
77 unsigned long b1,
78 unsigned long b2,
79 unsigned long b3);
81 #endif