Get the NSF internal playlists working again. Fix a few wrongdoings in the metadata...
[kugel-rb.git] / apps / mp3data.h
blobedda352aabc67fdd47519bd43622d54ffba0b3a6
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
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.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef _MP3DATA_H_
23 #define _MP3DATA_H_
25 #define MPEG_VERSION1 0
26 #define MPEG_VERSION2 1
27 #define MPEG_VERSION2_5 2
29 struct mp3info {
30 /* Standard MP3 frame header fields */
31 int version;
32 int layer;
33 int bitrate;
34 long frequency;
35 int padding;
36 int channel_mode;
37 int frame_size; /* Frame size in bytes */
38 int frame_samples;/* Samples per frame */
39 int ft_num; /* Numerator of frametime in milliseconds */
40 int ft_den; /* Denominator of frametime in milliseconds */
42 bool is_vbr; /* True if the file is VBR */
43 bool has_toc; /* True if there is a VBR header in the file */
44 unsigned char toc[100];
45 unsigned long frame_count; /* Number of frames in the file (if VBR) */
46 unsigned long byte_count; /* File size in bytes */
47 unsigned long file_time; /* Length of the whole file in milliseconds */
48 int enc_delay; /* Encoder delay, fetched from LAME header */
49 int enc_padding; /* Padded samples added to last frame. LAME header */
52 /* Xing header information */
53 #define VBR_FRAMES_FLAG 0x01
54 #define VBR_BYTES_FLAG 0x02
55 #define VBR_TOC_FLAG 0x04
56 #define VBR_QUALITY_FLAG 0x08
58 #define MAX_XING_HEADER_SIZE 576
60 unsigned long find_next_frame(int fd,
61 long *offset,
62 long max_offset,
63 unsigned long reference_header);
64 unsigned long mem_find_next_frame(int startpos,
65 long *offset,
66 long max_offset,
67 unsigned long reference_header);
68 int get_mp3file_info(int fd,
69 struct mp3info *info);
70 int count_mp3_frames(int fd,
71 int startpos,
72 int filesize,
73 void (*progressfunc)(int));
74 int create_xing_header(int fd,
75 long startpos,
76 long filesize,
77 unsigned char *buf,
78 unsigned long num_frames,
79 unsigned long rec_time,
80 unsigned long header_template,
81 void (*progressfunc)(int),
82 bool generate_toc);
84 extern unsigned long bytes2int(unsigned long b0,
85 unsigned long b1,
86 unsigned long b2,
87 unsigned long b3);
89 #endif