summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/tagcache.c55
-rw-r--r--apps/tagcache.h56
2 files changed, 55 insertions, 56 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c
index a66f9658ae..bab450ffed 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -90,6 +90,61 @@
90#include "eeprom_settings.h" 90#include "eeprom_settings.h"
91#endif 91#endif
92 92
93/* Maximum length of a single tag. */
94#define TAG_MAXLEN (MAX_PATH*2)
95
96/* Allow a little drift to the filename ordering (should not be too high/low). */
97#define POS_HISTORY_COUNT 4
98
99/* How much to pre-load entries while committing to prevent seeking. */
100#define IDX_BUF_DEPTH 64
101
102/* Tag Cache Header version 'TCHxx'. Increment when changing internal structures. */
103#define TAGCACHE_MAGIC 0x54434810
104
105/* Dump store/restore header version 'TCSxx'. */
106#define TAGCACHE_STATEFILE_MAGIC 0x54435301
107
108/* How much to allocate extra space for ramcache. */
109#define TAGCACHE_RESERVE 32768
110
111/*
112 * Define how long one entry must be at least (longer -> less memory at commit).
113 * Must be at least 4 bytes in length for correct alignment.
114 */
115#define TAGFILE_ENTRY_CHUNK_LENGTH 8
116
117/* Used to guess the necessary buffer size at commit. */
118#define TAGFILE_ENTRY_AVG_LENGTH 16
119
120/* Always strict align entries for best performance and binary compatibility. */
121#define TAGCACHE_STRICT_ALIGN 1
122
123/* Max events in the internal tagcache command queue. */
124#define TAGCACHE_COMMAND_QUEUE_LENGTH 32
125
126/* Idle time before committing events in the command queue. */
127#define TAGCACHE_COMMAND_QUEUE_COMMIT_DELAY HZ*2
128
129/* Temporary database containing new tags to be committed to the main db. */
130#define TAGCACHE_FILE_TEMP ROCKBOX_DIR "/database_tmp.tcd"
131
132/* The main database master index and numeric data. */
133#define TAGCACHE_FILE_MASTER ROCKBOX_DIR "/database_idx.tcd"
134
135/* The main database string data. */
136#define TAGCACHE_FILE_INDEX ROCKBOX_DIR "/database_%d.tcd"
137
138/* ASCII dumpfile of the DB contents. */
139#define TAGCACHE_FILE_CHANGELOG ROCKBOX_DIR "/database_changelog.txt"
140
141/* Flags */
142#define FLAG_DELETED 0x0001 /* Entry has been removed from db */
143#define FLAG_DIRCACHE 0x0002 /* Filename is a dircache pointer */
144#define FLAG_DIRTYNUM 0x0004 /* Numeric data has been modified */
145#define FLAG_TRKNUMGEN 0x0008 /* Track number has been generated */
146#define FLAG_RESURRECTED 0x0010 /* Statistics data has been resurrected */
147
93#ifdef __PCTOOL__ 148#ifdef __PCTOOL__
94#define yield() do { } while(0) 149#define yield() do { } while(0)
95#define sim_sleep(timeout) do { } while(0) 150#define sim_sleep(timeout) do { } while(0)
diff --git a/apps/tagcache.h b/apps/tagcache.h
index 690506b308..f6cd03e972 100644
--- a/apps/tagcache.h
+++ b/apps/tagcache.h
@@ -44,61 +44,12 @@ enum tag_type { tag_artist = 0, tag_album, tag_genre, tag_title,
44 tag_virt_entryage, tag_virt_autoscore, 44 tag_virt_entryage, tag_virt_autoscore,
45 TAG_COUNT_ALL}; 45 TAG_COUNT_ALL};
46 46
47/* Maximum length of a single tag. */
48#define TAG_MAXLEN (MAX_PATH*2)
49
50/* Allow a little drift to the filename ordering (should not be too high/low). */
51#define POS_HISTORY_COUNT 4
52
53/* How much to pre-load entries while committing to prevent seeking. */
54#define IDX_BUF_DEPTH 64
55
56/* Tag Cache Header version 'TCHxx'. Increment when changing internal structures. */
57#define TAGCACHE_MAGIC 0x54434810
58
59/* Dump store/restore header version 'TCSxx'. */
60#define TAGCACHE_STATEFILE_MAGIC 0x54435301
61
62/* How much to allocate extra space for ramcache. */
63#define TAGCACHE_RESERVE 32768
64
65/**
66 * Define how long one entry must be at least (longer -> less memory at commit).
67 * Must be at least 4 bytes in length for correct alignment.
68 */
69#define TAGFILE_ENTRY_CHUNK_LENGTH 8
70
71/* Used to guess the necessary buffer size at commit. */
72#define TAGFILE_ENTRY_AVG_LENGTH 16
73
74/* How many entries to fetch to the seek table at once while searching. */ 47/* How many entries to fetch to the seek table at once while searching. */
75#define SEEK_LIST_SIZE 32 48#define SEEK_LIST_SIZE 32
76 49
77/* Always strict align entries for best performance and binary compatibility. */
78#define TAGCACHE_STRICT_ALIGN 1
79
80/* Max events in the internal tagcache command queue. */
81#define TAGCACHE_COMMAND_QUEUE_LENGTH 32
82/* Idle time before committing events in the command queue. */
83#define TAGCACHE_COMMAND_QUEUE_COMMIT_DELAY HZ*2
84
85#define TAGCACHE_MAX_FILTERS 4 50#define TAGCACHE_MAX_FILTERS 4
86#define TAGCACHE_MAX_CLAUSES 32 51#define TAGCACHE_MAX_CLAUSES 32
87 52
88/* Tag database files. */
89
90/* Temporary database containing new tags to be committed to the main db. */
91#define TAGCACHE_FILE_TEMP ROCKBOX_DIR "/database_tmp.tcd"
92
93/* The main database master index and numeric data. */
94#define TAGCACHE_FILE_MASTER ROCKBOX_DIR "/database_idx.tcd"
95
96/* The main database string data. */
97#define TAGCACHE_FILE_INDEX ROCKBOX_DIR "/database_%d.tcd"
98
99/* ASCII dumpfile of the DB contents. */
100#define TAGCACHE_FILE_CHANGELOG ROCKBOX_DIR "/database_changelog.txt"
101
102/* Serialized DB. */ 53/* Serialized DB. */
103#define TAGCACHE_STATEFILE ROCKBOX_DIR "/database_state.tcd" 54#define TAGCACHE_STATEFILE ROCKBOX_DIR "/database_state.tcd"
104 55
@@ -117,13 +68,6 @@ enum tag_type { tag_artist = 0, tag_album, tag_genre, tag_title,
117 68
118#define TAGCACHE_IS_NUMERIC(tag) (BIT_N(tag) & TAGCACHE_NUMERIC_TAGS) 69#define TAGCACHE_IS_NUMERIC(tag) (BIT_N(tag) & TAGCACHE_NUMERIC_TAGS)
119 70
120/* Flags */
121#define FLAG_DELETED 0x0001 /* Entry has been removed from db */
122#define FLAG_DIRCACHE 0x0002 /* Filename is a dircache pointer */
123#define FLAG_DIRTYNUM 0x0004 /* Numeric data has been modified */
124#define FLAG_TRKNUMGEN 0x0008 /* Track number has been generated */
125#define FLAG_RESURRECTED 0x0010 /* Statistics data has been resurrected */
126
127enum clause { clause_none, clause_is, clause_is_not, clause_gt, clause_gteq, 71enum clause { clause_none, clause_is, clause_is_not, clause_gt, clause_gteq,
128 clause_lt, clause_lteq, clause_contains, clause_not_contains, 72 clause_lt, clause_lteq, clause_contains, clause_not_contains,
129 clause_begins_with, clause_not_begins_with, clause_ends_with, 73 clause_begins_with, clause_not_begins_with, clause_ends_with,