Rework Display Options and File View.
[Rockbox.git] / apps / database.h
blob3c9bef516ccf6041810dd5866e6722e8d49468f3
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2005 by Michiel van der Kolk
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 ****************************************************************************/
19 #ifndef DATABASE_H
20 #define DATABASE_H
22 #ifdef ROCKBOX_LITTLE_ENDIAN
23 #define BE32(_x_) (((_x_ & 0xff000000) >> 24) | \
24 ((_x_ & 0x00ff0000) >> 8) | \
25 ((_x_ & 0x0000ff00) << 8) | \
26 ((_x_ & 0x000000ff) << 24))
27 #define BE16(_x_) ( ((_x_&0xFF00) >> 8)|((_x_&0xFF)<<8))
28 #else
29 #define BE32(_x_) _x_
30 #define BE16(_x_) _x_
31 #endif
33 #define SONGENTRY_SIZE (tagdbheader.songlen+12+tagdbheader.genrelen+12)
34 #define FILEENTRY_SIZE (tagdbheader.filelen+12)
35 #define ALBUMENTRY_SIZE (tagdbheader.albumlen+4+tagdbheader.songarraylen*4)
36 #define ARTISTENTRY_SIZE (tagdbheader.artistlen+tagdbheader.albumarraylen*4)
38 #define FILERECORD2OFFSET(_x_) (tagdbheader.filestart + _x_ * FILEENTRY_SIZE)
40 extern int tagdb_initialized;
42 struct tagdb_header {
43 int version;
44 int artiststart;
45 int albumstart;
46 int songstart;
47 int filestart;
48 int artistcount;
49 int albumcount;
50 int songcount;
51 int filecount;
52 int artistlen;
53 int albumlen;
54 int songlen;
55 int genrelen;
56 int filelen;
57 int songarraylen;
58 int albumarraylen;
59 int rundbdirty;
62 extern struct tagdb_header tagdbheader;
63 extern int tagdb_fd;
65 int tagdb_init(void);
66 void tagdb_shutdown(void);
68 #define TAGDB_VERSION 3
70 extern int rundb_fd, rundb_initialized;
71 extern struct rundb_header rundbheader;
73 struct rundb_header {
74 int version;
75 int entrycount;
79 extern struct rundb_header rundbheader;
81 #define RUNDB_VERSION 1
83 void tagdb_shutdown(void);
84 void addrundbentry(struct mp3entry *id);
85 void loadruntimeinfo(struct mp3entry *id);
86 void writeruntimeinfo(struct mp3entry *id);
87 int rundb_init(void);
88 void rundb_shutdown(void);
89 #endif