~ubuntu-branches/ubuntu/lucid/lastfm/lucid

« back to all changes in this revision

Viewing changes to src/mediadevices/gpod/libgpod/db-itunes-parser.h

  • Committer: Bazaar Package Importer
  • Author(s): Pedro Fragoso
  • Date: 2007-12-31 09:49:54 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20071231094954-ix1amvcsj9pk61ya
Tags: 1:1.4.1.57486.dfsg-1ubuntu1
* Merge from Debian unstable (LP: #180254), remaining changes:
  - debian/rules;
    - Added dh_icons
  - Modify Maintainer value to match Debian-Maintainer-Field Spec

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  Copyright (C) 2005 Christophe Fergeau
3
 
 *
4
 
 * 
5
 
 *  The code contained in this file is free software; you can redistribute
6
 
 *  it and/or modify it under the terms of the GNU Lesser General Public
7
 
 *  License as published by the Free Software Foundation; either version
8
 
 *  2.1 of the License, or (at your option) any later version.
9
 
 *  
10
 
 *  This file is distributed in the hope that it will be useful,
11
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 
 *  Lesser General Public License for more details.
14
 
 *  
15
 
 *  You should have received a copy of the GNU Lesser General Public
16
 
 *  License along with this code; if not, write to the Free Software
17
 
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
 
 * 
19
 
 *  iTunes and iPod are trademarks of Apple
20
 
 * 
21
 
 *  This product is not supported/written/published by Apple!
22
 
 *
23
 
 */
24
 
 
25
 
 
26
 
#ifndef DB_PARSER_H
27
 
#define DB_PARSER_H
28
 
 
29
 
#include <glib.h>
30
 
/*#include "ipod-db-parser.h"*/
31
 
 
32
 
#define ITUNESDB_MAX_SIZE 10 * 1024 * 1024
33
 
 
34
 
struct _MHeader {
35
 
        unsigned char header_id[4];
36
 
        gint32 header_len;
37
 
};
38
 
 
39
 
typedef struct _MHeader MHeader;
40
 
 
41
 
struct _MhlHeader {
42
 
        unsigned char header_id[4];
43
 
        gint32 header_len;
44
 
        gint32 num_children;
45
 
        unsigned char padding[];
46
 
};
47
 
 
48
 
typedef struct _MhlHeader MhlHeader;
49
 
 
50
 
 
51
 
typedef struct _MhbdHeader MhbdHeader;
52
 
typedef struct _ArtworkDB_MhsdHeader ArtworkDB_MhsdHeader;
53
 
/*typedef struct _MhsdHeader MhsdHeader;*/
54
 
typedef struct _MhltHeader MhltHeader;
55
 
typedef struct _MhlpHeader MhlpHeader;
56
 
typedef struct _MhypHeader MhypHeader;
57
 
typedef struct _MhipHeader MhipHeader;
58
 
typedef struct _MhitHeader MhitHeader;
59
 
typedef struct _ArtworkDB_MhodHeader ArtworkDB_MhodHeader;
60
 
/*typedef struct _MhodHeader MhodHeader;*/
61
 
typedef struct _MhfdHeader MhfdHeader;
62
 
typedef struct _MhliHeader MhliHeader;
63
 
typedef struct _MhiiHeader MhiiHeader;
64
 
typedef struct _MhniHeader MhniHeader;
65
 
typedef struct _MhlaHeader MhlaHeader;
66
 
typedef struct _MhbaHeader MhbaHeader;
67
 
typedef struct _MhlfHeader MhlfHeader;
68
 
typedef struct _MhifHeader MhifHeader;
69
 
typedef struct _MhiaHeader MhiaHeader;
70
 
 
71
 
typedef struct _MhitHeader471 MhitHeader471;
72
 
/* MHOD typedef mess */
73
 
typedef struct _ArtworkDB_MhodHeaderArtworkType3 ArtworkDB_MhodHeaderArtworkType3;
74
 
typedef struct _MhodHeaderString MhodHeaderString;
75
 
typedef struct _MhodHeaderArtworkType1 MhodHeaderArtworkType1;
76
 
/* typedef struct _MhodHeaderArtworkType3 MhodHeaderArtworkType3; */
77
 
typedef struct _MhodHeaderSmartPlaylistData MhodHeaderSmartPlaylistData;
78
 
typedef struct _MhodHeaderSmartPlaylistRuleString MhodHeaderSmartPlaylistRuleString; 
79
 
typedef struct _MhodHeaderSmartPlaylistRuleNonString MhodHeaderSmartPlaylistRuleNonString;
80
 
typedef struct _MhodHeaderSmartPlaylistRule MhodHeaderSmartPlaylistRule;
81
 
 
82
 
struct _MhbdHeader {
83
 
        unsigned char header_id[4];
84
 
        gint32 header_len;
85
 
        gint32 total_len;
86
 
        gint32 unknown1;
87
 
        gint32 version;
88
 
        gint32 num_children;
89
 
        gint64 db_id;
90
 
        gint32 unknown2;
91
 
        unsigned char padding[];
92
 
};
93
 
 
94
 
enum MhsdIndexType {
95
 
        MHSD_TRACK_LIST = 1,
96
 
        MHSD_PLAYLIST_LIST = 2
97
 
};
98
 
 
99
 
enum MhsdPhotoIndexType {
100
 
        MHSD_IMAGE_LIST = 1,
101
 
        MHSD_ALBUM_LIST = 2,
102
 
        MHSD_FILE_LIST = 3
103
 
};
104
 
 
105
 
struct _ArtworkDB_MhsdHeader {
106
 
        unsigned char header_id[4];
107
 
        gint32 header_len;
108
 
        gint32 total_len;
109
 
        /* Strangely, the following field is only 16 bits long in the
110
 
         * ArtworkDB (it's definitely 32 bits in the iTunesDB). This
111
 
         * could well be an error with the first generation of mobile
112
 
         * phones with iPod support).
113
 
         */
114
 
        gint16 index;
115
 
        gint16 unknown014;
116
 
        unsigned char padding[];
117
 
};
118
 
 
119
 
struct _iTunesDB_MhsdHeader {
120
 
        unsigned char header_id[4];
121
 
        gint32 header_len;
122
 
        gint32 total_len;
123
 
        gint32 index;
124
 
        unsigned char padding[];
125
 
};
126
 
struct _MhltHeader {
127
 
        unsigned char header_id[4];
128
 
        gint32 header_len;
129
 
        gint32 num_songs;
130
 
        unsigned char padding[];
131
 
};
132
 
 
133
 
struct _MhlpHeader {
134
 
        unsigned char header_id[4];
135
 
        gint32 header_len;
136
 
        gint32 num_playlists;
137
 
        unsigned char padding[];
138
 
};
139
 
 
140
 
struct _MhypHeader {
141
 
        unsigned char header_id[4];
142
 
        gint32 header_len;
143
 
        gint32 total_len;
144
 
        gint32 num_mhod;
145
 
        gint32 num_items;
146
 
        gint32 hidden;
147
 
        gint32 timestamp;
148
 
        gint32 playlist_id;
149
 
        gint32 unknown3;
150
 
        gint32 unknown4;
151
 
        gint32 unknown5;
152
 
        unsigned char padding[];
153
 
};
154
 
 
155
 
struct _MhipHeader {
156
 
        unsigned char header_id[4];
157
 
        gint32 header_len;
158
 
        gint32 total_len;
159
 
        gint32 unknown1;
160
 
        gint32 correlation_id;
161
 
        gint32 unknown2;
162
 
        gint32 track_id;
163
 
        gint32 timestamp;
164
 
        unsigned char padding[];
165
 
};
166
 
 
167
 
/* MHIT header as written by iTunes 4.7.1, the added fields (from unknown17 to
168
 
 * the end of the struct) are pretty useless, so we don't use this struct
169
 
 */
170
 
struct _MhitHeader471 {
171
 
        unsigned char header_id[4];
172
 
        gint32 header_len;
173
 
        gint32 total_len;
174
 
        gint32 num_mhod;
175
 
        gint32 track_id;
176
 
        gint32 visible;
177
 
        gint32 filetype;
178
 
        /* FIXME: endianness issue with the order of the 3 fields above ? */
179
 
        gint16 type;
180
 
        gchar  compilation;
181
 
        gchar  rating;
182
 
        gint32 date_added;
183
 
        gint32 size;
184
 
        gint32 length;
185
 
        gint32 track_number;
186
 
        gint32 track_total;
187
 
        gint32 year;
188
 
        gint32 bitrate;
189
 
        /* FIXME: endianness issue with the order of the 2 fields above ? */
190
 
        gint16 unknown;
191
 
        gint16 sample_rate;
192
 
        gint32 volume;
193
 
        gint32 start_time;
194
 
        gint32 stop_time;
195
 
        gint32 sound_check;
196
 
        gint32 play_count;
197
 
        gint32 play_count2;
198
 
        gint32 last_played;
199
 
        gint32 disc_number;
200
 
        gint32 disc_total;
201
 
        gint32 user_id;
202
 
        gint32 last_modified;
203
 
        gint32 bookmark_time;
204
 
        gint64 song_id;
205
 
        /* FIXME: endianness issue with the order of the 5 fields above ? */
206
 
        gchar  checked;
207
 
        gchar  app_rating;
208
 
        gint16 bpm;
209
 
        gint16 artwork_count;
210
 
        gint16 unknown9;
211
 
        gint32 artwork_size;
212
 
        gint32 unknown11;
213
 
        gint32 sample_rate2;
214
 
        gint32 unknown13;
215
 
        gint32 unknown14;
216
 
        gint32 unknown15;
217
 
        gint32 unknown16;
218
 
        gint32 unknown17;
219
 
        gint32 unknown18;
220
 
        gint32 unknown19;
221
 
        gint64 song_id2;
222
 
        gint32 unknown20;
223
 
        gint32 unknown21;
224
 
        gint32 unknown22;
225
 
        gint32 unknown23;
226
 
        gint32 unknown24;
227
 
        gint32 unknown25;
228
 
        gint32 unknown26;
229
 
        gint32 unknown27;
230
 
        gint32 unknown28;
231
 
        gint32 unknown29;
232
 
        gint32 unknown30;
233
 
        gint32 unknown31;
234
 
        gint32 unknown32;
235
 
        gint32 unknown33;
236
 
        gint32 unknown34;
237
 
        gint32 unknown35;
238
 
        gint32 unknown36;
239
 
        unsigned char padding[];
240
 
};
241
 
 
242
 
struct _MhitHeader {
243
 
        unsigned char header_id[4];
244
 
        gint32 header_len;
245
 
        gint32 total_len;
246
 
        gint32 num_mhod;
247
 
        gint32 track_id;
248
 
        gint32 visible;
249
 
        gint32 filetype;
250
 
        /* FIXME: endianness issue with the order of the 3 fields above ? */
251
 
        gint16 type;
252
 
        gchar  compilation;
253
 
        gchar  rating;
254
 
        gint32 date_added;
255
 
        gint32 size;
256
 
        gint32 length;
257
 
        gint32 track_number;
258
 
        gint32 track_total;
259
 
        gint32 year;
260
 
        gint32 bitrate;
261
 
        /* FIXME: endianness issue with the order of the 2 fields above ? */
262
 
        gint16 unknown;
263
 
        gint16 sample_rate;
264
 
        gint32 volume;
265
 
        gint32 start_time;
266
 
        gint32 stop_time;
267
 
        gint32 sound_check;
268
 
        gint32 play_count;
269
 
        gint32 play_count2;
270
 
        gint32 last_played;
271
 
        gint32 disc_number;
272
 
        gint32 disc_total;
273
 
        gint32 user_id;
274
 
        gint32 last_modified;
275
 
        gint32 bookmark_time;
276
 
        gint64 song_id;
277
 
        /* FIXME: endianness issue with the order of the 5 fields above ? */
278
 
        gchar  checked;
279
 
        gchar  app_rating;
280
 
        gint16 bpm;
281
 
        gint16 artwork_count;
282
 
        gint16 unknown9;
283
 
        gint32 artwork_size;
284
 
        gint32 unknown11;
285
 
        gint32 sample_rate2;
286
 
        gint32 unknown13;
287
 
        gint32 unknown14;
288
 
        gint32 unknown15;
289
 
        gint32 unknown16;
290
 
        unsigned char padding[];
291
 
};
292
 
 
293
 
enum MhodEncoding {
294
 
        MHOD_ENCODING_UTF16 = 0,
295
 
        MHOD_ENCODING_UTF8 = 1
296
 
};
297
 
 
298
 
enum MhodType {
299
 
        MHOD_TYPE_TITLE = 1,
300
 
        MHOD_TYPE_LOCATION = 2,
301
 
        MHOD_TYPE_ALBUM = 3,
302
 
        MHOD_TYPE_ARTIST = 4,
303
 
        MHOD_TYPE_GENRE = 5,
304
 
        MHOD_TYPE_FILETYPE = 6,
305
 
        MHOD_TYPE_EQ_SETTING = 7,
306
 
        MHOD_TYPE_COMMENT = 8,
307
 
        MHOD_TYPE_COMPOSER = 12,
308
 
        MHOD_TYPE_GROUPING = 13,
309
 
        MHOD_TYPE_SMART_PLAYLIST_DATA = 50,
310
 
        MHOD_TYPE_SMART_PLAYLIST_RULES = 51,
311
 
        MHOD_TYPE_LIBRARY_PLAYLIST_INDEX = 52,
312
 
        MHOD_TYPE_100 = 100
313
 
};
314
 
 
315
 
struct _MhodHeader {
316
 
        unsigned char header_id[4];
317
 
        gint32 header_len;
318
 
        gint32 total_len;
319
 
        gint32 type;
320
 
        gint32 unknown1;
321
 
        gint32 unknown2;
322
 
};
323
 
 
324
 
struct _ArtworkDB_MhodHeader {
325
 
        unsigned char header_id[4];
326
 
        gint32 header_len;
327
 
        gint32 total_len;
328
 
    /* Strangely, the following field is only 16 bits long in the
329
 
         * ArtworkDB (it's definitely 32 bits in the iTunesDB). This
330
 
         * could well be an error with the first generation of mobile
331
 
         * phones with iPod support).
332
 
         */
333
 
        gint16 type;
334
 
    gint16 unknown014;
335
 
        gint32 unknown1;
336
 
        gint32 unknown2;
337
 
};
338
 
 
339
 
struct _MhodHeaderString {
340
 
        unsigned char header_id[4];
341
 
        gint32 header_len;
342
 
        gint32 total_len;
343
 
        gint32 type; /* < 50 */
344
 
        gint32 unknown1;
345
 
        gint32 unknown2;
346
 
        gint32 position;
347
 
        gint32 string_len;
348
 
        gint32 unknown3; /* It was thought that this was string encoding:
349
 
                          * 0 == UTF-16, 1 == UTF-8, however, recent iTunesDB
350
 
                          * files have had this set to 1 even with UTF-16 strings.
351
 
                          * Therefore this is definitely incorrect, and the
352
 
                          * correct meaning has not yet been discovered yet. */
353
 
        gint32 unknown4;
354
 
        unsigned char string[];
355
 
};
356
 
 
357
 
enum MhodArtworkType {
358
 
        MHOD_ARTWORK_TYPE_ALBUM_NAME = 1, /* string:    album name (in the Photo Database) */
359
 
        MHOD_ARTWORK_TYPE_THUMBNAIL  = 2, /* container: thumbnail image */
360
 
        MHOD_ARTWORK_TYPE_FILE_NAME  = 3, /* string:    file name */
361
 
        MHOD_ARTWORK_TYPE_IMAGE      = 5  /* container: full resolution image (in the Photo Database) */
362
 
};
363
 
 
364
 
struct _MhodHeaderArtworkType1 {
365
 
        unsigned char header_id[4];
366
 
        gint32 header_len;
367
 
        gint32 total_len;
368
 
        gint16 type; 
369
 
        gint8 unknown;
370
 
        gint8 padding;
371
 
        gint32 unknown1;
372
 
        gint32 unknown2;
373
 
        gint32 string_len;
374
 
        gint32 unknown3; /* might be the string encoding */
375
 
        gint32 unknown4; /* always zero? */
376
 
        unsigned char string[];
377
 
};
378
 
 
379
 
struct _MhodHeaderArtworkType3 {
380
 
        unsigned char header_id[4];
381
 
        gint32 header_len;
382
 
        gint32 total_len;
383
 
        gint16 type; /* 3 */
384
 
        gint16 padding; /* high byte is padding length (0-3) */
385
 
        gint32 unknown1;
386
 
        gint32 unknown2;
387
 
        gint32 string_len;
388
 
        gint32 mhod_version;
389
 
        gint32 unknown4;
390
 
        gunichar2 string[];
391
 
};
392
 
 
393
 
struct _ArtworkDB_MhodHeaderArtworkType3 {
394
 
        unsigned char header_id[4];
395
 
        gint32 header_len;
396
 
        gint32 total_len;
397
 
        gint16 type; /* 3 */
398
 
        gint8  unknown13;
399
 
        gint8  padding;
400
 
        gint32 unknown1;
401
 
        gint32 unknown2;
402
 
        gint32 string_len;
403
 
        gint8 mhod_version; /* 0,1: string is UTF8, 2: string is
404
 
                               UTF16-LE */
405
 
        gint8 unknown5;
406
 
        gint16 unknown6;
407
 
        gint32 unknown4;
408
 
        gchar  string[];
409
 
};
410
 
 
411
 
 
412
 
enum MhodLimitType {
413
 
        MHOD_LIMIT_MINUTES = 1,
414
 
        MHOD_LIMIT_MEGABYTES = 2,
415
 
        MHOD_LIMIT_SONGS = 3,
416
 
        MHOD_LIMIT_HOURS = 4,
417
 
        MHOD_LIMIT_GIGABYTES = 5
418
 
};
419
 
 
420
 
enum MhodLimitSortType {
421
 
        MHOD_LIMIT_SORT_RANDOM = 0x02,
422
 
        MHOD_LIMIT_SORT_SONG_NAME = 0x03,
423
 
        MHOD_LIMIT_SORT_ALBUM = 0x04,
424
 
        MHOD_LIMIT_SORT_ARTIST = 0x05,
425
 
        MHOD_LIMIT_SORT_GENRE = 0x07,
426
 
        MHOD_LIMIT_SORT_MOST_RECENTLY_ADDED = 0x10,
427
 
        MHOD_LIMIT_SORT_MOST_OFTEN_PLAYED = 0x14,
428
 
        MHOD_LIMIT_SORT_MOST_RECENTLY_PLAYED = 0x15,
429
 
        MHOD_LIMIT_SORT_HIGHEST_RATING = 0x17
430
 
};
431
 
 
432
 
struct _MhodHeaderSmartPlaylistData {
433
 
        unsigned char header_id[4];
434
 
        gint32 header_len;
435
 
        gint32 total_len;
436
 
        gint32 type; /* 50 */
437
 
        gint32 unknown1;
438
 
        gint32 unknown2;
439
 
        gchar  live_update;
440
 
        gchar  rules_enable;
441
 
        gchar  limit_enable;
442
 
        gchar  limit_type;
443
 
        gchar  limit_sort;
444
 
        gchar  unknow3[3];
445
 
        gint32 limit;
446
 
        gchar  match_checked_only;
447
 
        gchar  reverse_limit_sort;
448
 
        unsigned char padding[];
449
 
};
450
 
 
451
 
 
452
 
enum MhodSmartPlaylistRuleFieldType {
453
 
        MHOD_FIELD_SONG_NAME = 0x02,
454
 
        MHOD_FIELD_ALBUM = 0x03,
455
 
        MHOD_FIELD_ARTIST = 0x04,
456
 
        MHOD_FIELD_BITRATE = 0x05,
457
 
        MHOD_FIELD_SAMPLE_RATE = 0x06,
458
 
        MHOD_FIELD_YEAR = 0x07,
459
 
        MHOD_FIELD_GENRE = 0x08,
460
 
        MHOD_FIELD_KIND = 0x09, 
461
 
        MHOD_FIELD_DATE_MODIFIED = 0x0a,
462
 
        MHOD_FIELD_TRACK_NUMBER = 0x0b,
463
 
        MHOD_FIELD_SIZE = 0x0c,
464
 
        MHOD_FIELD_TIME = 0x0d,
465
 
        MHOD_FIELD_COMMENT = 0x0e,
466
 
        MHOD_FIELD_DATE_ADDED = 0x10,
467
 
        MHOD_FIELD_COMPOSER = 0x12,
468
 
        MHOD_FIELD_PLAY_COUNT = 0x16,
469
 
        MHOD_FIELD_LAST_PLAYED = 0x17,
470
 
        MHOD_FIELD_DISC_NUMBER = 0x18,
471
 
        MHOD_FIELD_RATING = 0x19,
472
 
        MHOD_FIELD_COMPILATION = 0x1f,
473
 
        MHOD_FIELD_BPM = 0x23,
474
 
        MHOD_FIELD_GROUPING = 0x27,
475
 
        MHOD_FIELD_PLAYLIST = 0x28
476
 
};
477
 
 
478
 
enum MhodSmartPlaylistRuleAction {
479
 
        MHOD_RULE_IS = 1 << 0, 
480
 
        MHOD_RULE_CONTAINS = 1 << 1,
481
 
        MHOD_RULE_BEGINS_WITH = 1 << 2,
482
 
        MHOD_RULE_ENDS_WITH = 1 << 3,
483
 
        MHOD_RULE_GREATER_THAN = 1 << 4,
484
 
        MHOD_RULE_GREATER_THAN_OR_EQUAL_TO = 1 << 5,
485
 
        MHOD_RULE_LESS_THAN = 1 << 6,
486
 
        MHOD_RULE_LESS_THAN_OR_EQUAL_TO = 1 << 7,
487
 
        MHOD_RULE_IN_THE_RANGE = 1 << 8,
488
 
        MHOD_RULE_IS_THE_LAST = 1 << 9,
489
 
        MHOD_RULE_NOT = 1 << 24,
490
 
        MHOD_RULE_STRING = 1 << 25
491
 
};
492
 
 
493
 
 
494
 
struct _MhodHeaderSmartPlaylistRuleString {
495
 
        /* Big endian fields */
496
 
        gint32 field;
497
 
        gint32 action;
498
 
        gchar  padding[44];
499
 
        gint32 string_len;
500
 
        gchar  string[];
501
 
};
502
 
 
503
 
struct _MhodHeaderSmartPlaylistRuleNonString {
504
 
        /* Big endian fields */
505
 
        gint32  field;
506
 
        gint32  action;
507
 
        gchar   padding[44];
508
 
        gint32  length;
509
 
        guint64 from_value;
510
 
        gint64  from_date;
511
 
        guint64 from_unit;
512
 
        guint64 to_value;
513
 
        gint64  to_date;
514
 
        guint64 to_unit;
515
 
        gchar   unknown[20];
516
 
};
517
 
 
518
 
struct _MhodHeaderSmartPlaylistRule {
519
 
        unsigned char header_id[4];
520
 
        gint32 header_len;
521
 
        gint32 total_len;
522
 
        gint32 type; /* 51 */
523
 
        gint32 unknown1;
524
 
        gint32 unknown2;
525
 
        gchar  rules_id[4];
526
 
        /* Fields stored in big-endian from there */
527
 
        gint32 unknown5;
528
 
        gint32 number_of_rules;
529
 
        gint32 rules_operator;
530
 
        gchar  padding[120];
531
 
        union {
532
 
                MhodHeaderSmartPlaylistRuleString rule_string;
533
 
                MhodHeaderSmartPlaylistRuleNonString rule_non_string;
534
 
        } rule;
535
 
};
536
 
 
537
 
 
538
 
 
539
 
struct _MhfdHeader {
540
 
        unsigned char header_id[4];
541
 
        gint32 header_len;
542
 
        gint32 total_len;
543
 
        gint32 unknown1;
544
 
        gint32 unknown2;
545
 
        gint32 num_children;
546
 
        gint32 unknown3;
547
 
        gint32 next_id;
548
 
        gint64 unknown5;
549
 
        gint64 unknown6;
550
 
        gint8  unknown_flag1;
551
 
        gint8  unknown_flag2;
552
 
        gint8  unknown_flag3;
553
 
        gint8  unknown_flag4;
554
 
        gint32 unknown8;
555
 
        gint32 unknown9;
556
 
        gint32 unknown10;
557
 
        gint32 unknown11;
558
 
        unsigned char padding[];
559
 
};
560
 
 
561
 
struct _MhliHeader {
562
 
        unsigned char header_id[4];
563
 
        gint32 header_len;
564
 
        gint32 num_children;
565
 
        unsigned char padding[];
566
 
};
567
 
 
568
 
struct _MhiiHeader {
569
 
        unsigned char header_id[4];
570
 
        gint32 header_len;
571
 
        gint32 total_len;
572
 
        gint32 num_children;
573
 
        gint32 image_id;
574
 
        gint64 song_id;
575
 
        gint32 unknown4;
576
 
        gint32 unknown5;
577
 
        gint32 unknown6;
578
 
        gint32 orig_date;
579
 
        gint32 digitised_date;
580
 
        gint32 orig_img_size;
581
 
        unsigned char padding[];
582
 
} __attribute__((__packed__));
583
 
/* I we don't put the 'packed' attribute above, some 64 bit systems
584
 
 * will pad the 64 bit integer to be aligned to an 8-byte boundary.
585
 
 * Hopefully there won't be any systems around that crash when
586
 
 * accessing 64 bit integers not aligned to 8-byte boundaries. */
587
 
 
588
 
 
589
 
struct _MhniHeader {
590
 
        unsigned char header_id[4];
591
 
        gint32 header_len;
592
 
        gint32 total_len;
593
 
        gint32 num_children;
594
 
        gint32 correlation_id;
595
 
        gint32 ithmb_offset;
596
 
        gint32 image_size;
597
 
        gint16 vertical_padding;
598
 
        gint16 horizontal_padding;
599
 
        gint16 image_height;
600
 
        gint16 image_width;
601
 
        unsigned char padding[];
602
 
};
603
 
 
604
 
struct _MhlaHeader {
605
 
        unsigned char header_id[4];
606
 
        gint32 header_len;
607
 
        gint32 num_children;
608
 
        unsigned char padding[];
609
 
};
610
 
 
611
 
struct _MhbaHeader {
612
 
        unsigned char header_id[4];
613
 
        gint32 header_len;
614
 
        gint32 total_len;
615
 
        gint32 num_mhods; /* number of Data Objects in the List, probably always 1 */
616
 
        gint32 num_mhias; /* number of pictures in the album */
617
 
        gint32 playlist_id; /* starts out at $64 and increments by 1 */
618
 
        gint32 unknown2; /* unknown, seems to be always 0 */
619
 
        gint16 unknown3; /* unknown, seems to be always 0 */
620
 
        gchar master;
621
 
        /* FIXME: not sure if I have these right; iPod doesn't seem to listen to them */
622
 
        guint8 playmusic;
623
 
        guint8 repeat;
624
 
        guint8 random;
625
 
        guint8 show_titles;
626
 
        guint8 transition_direction;
627
 
        gint32 slide_duration;
628
 
        gint32 transition_duration;
629
 
        gint32 unknown4;
630
 
        gint32 unknown5;
631
 
        gint64 song_id;
632
 
        gint32 prev_playlist_id; /* the id of the previous playlist */
633
 
        unsigned char padding[];
634
 
};
635
 
 
636
 
struct _MhlfHeader {
637
 
        unsigned char header_id[4];
638
 
        gint32 header_len;
639
 
        gint32 num_files;
640
 
        unsigned char padding[];
641
 
};
642
 
 
643
 
struct _MhifHeader {
644
 
        unsigned char header_id[4];
645
 
        gint32 header_len;
646
 
        gint32 total_len;
647
 
        gint32 unknown1;
648
 
        gint32 correlation_id;
649
 
        gint32 image_size;
650
 
        unsigned char padding[];
651
 
};
652
 
 
653
 
struct _MhiaHeader {
654
 
        unsigned char header_id[4];
655
 
        gint32 header_len;
656
 
        gint32 total_len; /* probably the size of the header and all child records;
657
 
                           * as there aren't any child records this is equal to header length */
658
 
        gint32 unknown1; /* seems to be zero */
659
 
        gint32 image_id; /* the id of the mhii record this mhia refers to */
660
 
        unsigned char padding[];
661
 
};
662
 
 
663
 
 
664
 
#endif /* PARSE_DB_H */