Difference between revisions of "Mcd.db"
(One intermediate revision by one other user not shown) | |||
Line 13: | Line 13: | ||
This document describes the format of the PhatDB file. |
This document describes the format of the PhatDB file. |
||
+ | |||
+ | A Free Software program and library to build mcd.db files is available here: |
||
+ | |||
+ | http://phatdb.sourceforge.net/ |
||
==== File Format ==== |
==== File Format ==== |
||
− | All multibyte types are stored in big endian (network) byte order. |
+ | All multibyte types are stored in big endian (network) byte order. They must be |
byte-swapped to be read on little-endian PC platforms. |
byte-swapped to be read on little-endian PC platforms. |
||
Latest revision as of 23:55, 11 March 2007
PhatDB
Introduction
Phatdb is the name I have given to the mcd.db file format created by PhatNoise Media Manager software to be playable by Kenwood Car Stereo head units supporting ACDrive Technology.
The PhatDB is a database of song metadata. It contains information on all tracks, artists, albums, genres and playlists in a compact format. The concept is similar to the itunesdb database found on ipods, though phatdb is less complex.
This document describes the format of the PhatDB file.
A Free Software program and library to build mcd.db files is available here:
http://phatdb.sourceforge.net/
File Format
All multibyte types are stored in big endian (network) byte order. They must be byte-swapped to be read on little-endian PC platforms.
The overall structure looks like this:
Header |
Tracks List |
Artist List |
Album List |
Genre List |
Playlists List |
Header
The file begins with a header containing the following elements:
Offset | Name | Type | Value | Description |
---|---|---|---|---|
0x00000000 | magic | uint32 | 0x3af7d87c | File Signature |
0x00000004 | unknown | uint32 | 0x00000002 | Version? |
0x00000008 | codepage | uint32 | 0x000001b6 | Codepage 437 |
0x0000000c | unknown | uint32 | 0x00000002 | Constant? |
0x00000010 | n_tracks | uint32 | Total Number of Tracks | |
0x00000014 | n_artists | uint32 | Total Number of Artists | |
0x00000018 | n_albums | uint32 | Total Number of Albums | |
0x0000001c | n_genres | uint32 | Total Number of Genres | |
0x00000020 | n_playlists | uint32 | Total Number of Playlists | |
0x00000024 | artists_len | uint32 | Len of Artists Array | |
0x00000028 | albums_len | uint32 | Len of Albumns Array | |
0x0000002c | genres_len | uint32 | Len of Genres Array | |
0x00000030 | playlists_len | uint32 | Len of Playlist Array | |
0x00000034 | unknown | uint32 | 0x00000000 | Constant? |
Track List
The File Header is immediately followed by an array of n_tracks track structures (offsets are relative to start of track structure). Tracks are stored in alphabetical order.:
Offset | Name | Type | Value | Description |
---|---|---|---|---|
0x00000000 | artists_id | uint32 | Artist ID | |
0x00000004 | album_id | uint32 | Album ID | |
0x00000008 | genre_id | uint32 | Genre ID | |
0x0000000c | unknown | uint32 | 0x00000000 | Constant? |
0x00000010 | title | phat_str | Track Title | |
0x0000xxxx | path | phat_str | Track Path |
Where the phat_str structure looks like this:
Offset | Name | Type | Value | Description |
---|---|---|---|---|
0x00000000 | string_length | uint16 | Length of String (bytes) | |
0x00000002 | string_width | uint16 | Width of String? | |
0x00000004 | data | string | Character Array |
When string_width is 2 (Track Title) data is UCS-2 encoded. When string_width is 1 (Track Path), data is CP437 encoded. data is null-terminated and padded to a multiple of 4 bytes. string_length is the length of data (including padding).
List Sections
Immediately following the track listing, there are sections for artists, albums and genres. All lists are in alphabetical order. Each section has the following format:
Offset | Name | Type | Value | Description |
---|---|---|---|---|
0x00000000 | item_list | phat_list[] | PhatDB Item List | |
0x00000xxx | track_item_arr | uint32[] | Track/Item Assignment Array | |
0x00000xxx | item_index | uint32[28] | Item Index |
The structure of the phat_list is as follows:
Offset | Name | Type | Value | Description |
---|---|---|---|---|
0x00000000 | array_offset | uint32 | Item Array Offset | |
0x00000004 | name | phat_str | Item Name String |
array_offset is an index into track_item_arr. This array contains a mapping of track id's relating to that item (artist, album, genre). The length of the each array is given by the fields in the header artists_len, albums_len and genre_len. item_index seems to be an index for skipping through large arrays, perhaps indexed alphabetically?
Playlists
The playlists section immediately follows the genre section. It is identical to the sections above except that it does not have the item_index.