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 @@ #include "eeprom_settings.h" #endif +/* Maximum length of a single tag. */ +#define TAG_MAXLEN (MAX_PATH*2) + +/* Allow a little drift to the filename ordering (should not be too high/low). */ +#define POS_HISTORY_COUNT 4 + +/* How much to pre-load entries while committing to prevent seeking. */ +#define IDX_BUF_DEPTH 64 + +/* Tag Cache Header version 'TCHxx'. Increment when changing internal structures. */ +#define TAGCACHE_MAGIC 0x54434810 + +/* Dump store/restore header version 'TCSxx'. */ +#define TAGCACHE_STATEFILE_MAGIC 0x54435301 + +/* How much to allocate extra space for ramcache. */ +#define TAGCACHE_RESERVE 32768 + +/* + * Define how long one entry must be at least (longer -> less memory at commit). + * Must be at least 4 bytes in length for correct alignment. + */ +#define TAGFILE_ENTRY_CHUNK_LENGTH 8 + +/* Used to guess the necessary buffer size at commit. */ +#define TAGFILE_ENTRY_AVG_LENGTH 16 + +/* Always strict align entries for best performance and binary compatibility. */ +#define TAGCACHE_STRICT_ALIGN 1 + +/* Max events in the internal tagcache command queue. */ +#define TAGCACHE_COMMAND_QUEUE_LENGTH 32 + +/* Idle time before committing events in the command queue. */ +#define TAGCACHE_COMMAND_QUEUE_COMMIT_DELAY HZ*2 + +/* Temporary database containing new tags to be committed to the main db. */ +#define TAGCACHE_FILE_TEMP ROCKBOX_DIR "/database_tmp.tcd" + +/* The main database master index and numeric data. */ +#define TAGCACHE_FILE_MASTER ROCKBOX_DIR "/database_idx.tcd" + +/* The main database string data. */ +#define TAGCACHE_FILE_INDEX ROCKBOX_DIR "/database_%d.tcd" + +/* ASCII dumpfile of the DB contents. */ +#define TAGCACHE_FILE_CHANGELOG ROCKBOX_DIR "/database_changelog.txt" + +/* Flags */ +#define FLAG_DELETED 0x0001 /* Entry has been removed from db */ +#define FLAG_DIRCACHE 0x0002 /* Filename is a dircache pointer */ +#define FLAG_DIRTYNUM 0x0004 /* Numeric data has been modified */ +#define FLAG_TRKNUMGEN 0x0008 /* Track number has been generated */ +#define FLAG_RESURRECTED 0x0010 /* Statistics data has been resurrected */ + #ifdef __PCTOOL__ #define yield() do { } while(0) #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, tag_virt_entryage, tag_virt_autoscore, TAG_COUNT_ALL}; -/* Maximum length of a single tag. */ -#define TAG_MAXLEN (MAX_PATH*2) - -/* Allow a little drift to the filename ordering (should not be too high/low). */ -#define POS_HISTORY_COUNT 4 - -/* How much to pre-load entries while committing to prevent seeking. */ -#define IDX_BUF_DEPTH 64 - -/* Tag Cache Header version 'TCHxx'. Increment when changing internal structures. */ -#define TAGCACHE_MAGIC 0x54434810 - -/* Dump store/restore header version 'TCSxx'. */ -#define TAGCACHE_STATEFILE_MAGIC 0x54435301 - -/* How much to allocate extra space for ramcache. */ -#define TAGCACHE_RESERVE 32768 - -/** - * Define how long one entry must be at least (longer -> less memory at commit). - * Must be at least 4 bytes in length for correct alignment. - */ -#define TAGFILE_ENTRY_CHUNK_LENGTH 8 - -/* Used to guess the necessary buffer size at commit. */ -#define TAGFILE_ENTRY_AVG_LENGTH 16 - /* How many entries to fetch to the seek table at once while searching. */ #define SEEK_LIST_SIZE 32 -/* Always strict align entries for best performance and binary compatibility. */ -#define TAGCACHE_STRICT_ALIGN 1 - -/* Max events in the internal tagcache command queue. */ -#define TAGCACHE_COMMAND_QUEUE_LENGTH 32 -/* Idle time before committing events in the command queue. */ -#define TAGCACHE_COMMAND_QUEUE_COMMIT_DELAY HZ*2 - #define TAGCACHE_MAX_FILTERS 4 #define TAGCACHE_MAX_CLAUSES 32 -/* Tag database files. */ - -/* Temporary database containing new tags to be committed to the main db. */ -#define TAGCACHE_FILE_TEMP ROCKBOX_DIR "/database_tmp.tcd" - -/* The main database master index and numeric data. */ -#define TAGCACHE_FILE_MASTER ROCKBOX_DIR "/database_idx.tcd" - -/* The main database string data. */ -#define TAGCACHE_FILE_INDEX ROCKBOX_DIR "/database_%d.tcd" - -/* ASCII dumpfile of the DB contents. */ -#define TAGCACHE_FILE_CHANGELOG ROCKBOX_DIR "/database_changelog.txt" - /* Serialized DB. */ #define TAGCACHE_STATEFILE ROCKBOX_DIR "/database_state.tcd" @@ -117,13 +68,6 @@ enum tag_type { tag_artist = 0, tag_album, tag_genre, tag_title, #define TAGCACHE_IS_NUMERIC(tag) (BIT_N(tag) & TAGCACHE_NUMERIC_TAGS) -/* Flags */ -#define FLAG_DELETED 0x0001 /* Entry has been removed from db */ -#define FLAG_DIRCACHE 0x0002 /* Filename is a dircache pointer */ -#define FLAG_DIRTYNUM 0x0004 /* Numeric data has been modified */ -#define FLAG_TRKNUMGEN 0x0008 /* Track number has been generated */ -#define FLAG_RESURRECTED 0x0010 /* Statistics data has been resurrected */ - enum clause { clause_none, clause_is, clause_is_not, clause_gt, clause_gteq, clause_lt, clause_lteq, clause_contains, clause_not_contains, clause_begins_with, clause_not_begins_with, clause_ends_with,