diff options
| author | Jorg Schuler <jcsjcs@users.sourceforge.net> | 2007-01-08 10:23:15 +0000 |
|---|---|---|
| committer | Jorg Schuler <jcsjcs@users.sourceforge.net> | 2007-01-08 10:23:15 +0000 |
| commit | 3b3476cdce7ec18f0e758d4045044b52b12182a5 (patch) | |
| tree | f1bc1eceadde12d78ecccb9ccfc5789f3b1f2835 /src | |
| parent | 867195c87012e672a1229b792e8a6bd5d8194305 (diff) | |
| download | libgpod-3b3476cdce7ec18f0e758d4045044b52b12182a5.tar.gz libgpod-3b3476cdce7ec18f0e758d4045044b52b12182a5.tar.xz libgpod-3b3476cdce7ec18f0e758d4045044b52b12182a5.zip | |
* tests/Makefile.am: cleanup
* src/itdb.h
src/itdb_itunesdb.c: renamed unk156 to skipcount and unk160 to
last_skipped.
Added unk244, gapless_data, unk252, gapless_track_flag,
gapless_album_flag, recent_skipcount.
Added handling of skipcount and last_skipped to playount file
handling.
* src/itdb_private.h: added skipcount and last_skipped to struct
playcount.
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1348 f01d2545-417e-4e96-918e-98f8d0dbbcb6
Diffstat (limited to 'src')
| -rw-r--r-- | src/itdb.h | 23 | ||||
| -rw-r--r-- | src/itdb_itunesdb.c | 60 | ||||
| -rw-r--r-- | src/itdb_private.h | 4 |
3 files changed, 66 insertions, 21 deletions
@@ -1,4 +1,4 @@ -/* Time-stamp: <2006-11-24 20:51:44 jcs> +/* Time-stamp: <2007-01-06 20:47:00 jcs> | | Copyright (C) 2002-2006 Jorg Schuler <jcsjcs at users sourceforge net> | Part of the gtkpod project. @@ -741,7 +741,12 @@ struct _Itdb_Track guint32 unk148; /* unknown - used for Apple Store DRM songs (always 0x01010100?), zero otherwise */ guint32 unk152; /* unknown */ - guint32 unk156, unk160; + guint32 skipcount; /* Number of times the track has been skipped. + Formerly unk156 (added in dbversion 0x0c) */ + guint32 recent_skipcount; /* number of times track was skipped since + last sync */ + guint32 last_skipped;/* Date/time last skipped. Formerly unk160 + (added in dbversion 0x0c) */ guint8 has_artwork; /* 0x01: artwork is present. 0x02: no artwork is present for this track (used by the iPod to decide whether to display Artwork or not) */ @@ -813,7 +818,19 @@ struct _Itdb_Track guint32 unk220; /* Has something to do with protected files - set to 0x0 for non-protected files. */ guint32 unk224; - guint32 unk228, unk232, unk236, unk240; + guint32 unk228, unk232, unk236, unk240, unk244; + guint32 gapless_data;/* some magic number needed for gapless playback + (added in dbversion 0x13) It has been observed + that gapless playback does not work if this is + set to zero. This number is related to the the + filesize in bytes, but it is a couple of bytes + less than the filesize. Maybe ID3 tags + etc... taken off? */ + guint32 unk252; + guint16 gapless_track_flag; /* if 1, this track has gapless playback data + (added in dbversion 0x13) */ + guint16 gapless_album_flag; /* if 1, this track does not use crossfading + in iTunes (added in dbversion 0x13) */ /* Chapter data: defines where the chapter stops are in the track, as well as what info should be displayed for each section of diff --git a/src/itdb_itunesdb.c b/src/itdb_itunesdb.c index 42ee2b2..eff1dd4 100644 --- a/src/itdb_itunesdb.c +++ b/src/itdb_itunesdb.c @@ -1,4 +1,4 @@ -/* Time-stamp: <2006-11-24 20:50:01 jcs> +/* Time-stamp: <2007-01-06 20:47:47 jcs> | | Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net> | Part of the gtkpod project. @@ -844,7 +844,8 @@ static gboolean playcounts_read (FImport *fimp, FContents *cts) entry_length = get32lint (cts, 8); CHECK_ERROR (fimp, FALSE); /* all the entries I know are 0x0c (firmware 1.3) or 0x10 - * (firmware 2.0) or 0x14 (iTunesDB version 0x0d) in length */ + * (firmware 2.0), 0x14 (iTunesDB version 0x0d) or 0x1c (iTunesDB + * version 0x13) in length */ if (entry_length < 0x0c) { g_set_error (&fimp->error, @@ -862,13 +863,13 @@ static gboolean playcounts_read (FImport *fimp, FContents *cts) struct playcount *playcount = g_new0 (struct playcount, 1); glong seek = header_length + i*entry_length; + check_seek (cts, seek, entry_length); + CHECK_ERROR (fimp, FALSE); + fimp->playcounts = g_list_append (fimp->playcounts, playcount); playcount->playcount = get32lint (cts, seek); - CHECK_ERROR (fimp, FALSE); playcount->time_played = get32lint (cts, seek+4); - CHECK_ERROR (fimp, FALSE); playcount->bookmark_time = get32lint (cts, seek+8); - CHECK_ERROR (fimp, FALSE); /* NOTE: * * The iPod (firmware 1.3, 2.0, ...?) doesn't seem to use the @@ -883,7 +884,6 @@ static gboolean playcounts_read (FImport *fimp, FContents *cts) if (entry_length >= 0x10) { playcount->rating = get32lint (cts, seek+12); - CHECK_ERROR (fimp, FALSE); } else { @@ -893,11 +893,13 @@ static gboolean playcounts_read (FImport *fimp, FContents *cts) if (entry_length >= 0x14) { playcount->pc_unk16 = get32lint (cts, seek+16); - CHECK_ERROR (fimp, FALSE); } - else + /* skip_count and last_skipped only exists if the entry length + is at least 0x1c */ + if (entry_length >= 0x1c) { - playcount->pc_unk16 = 0; + playcount->skipcount = get32lint (cts, seek+20); + playcount->last_skipped = get32lint (cts, seek+24); } } return TRUE; @@ -1170,7 +1172,7 @@ Itdb_iTunesDB *itdb_new (void) g_once (&g_type_init_once, (GThreadFunc)g_type_init, NULL); itdb = g_new0 (Itdb_iTunesDB, 1); itdb->device = itdb_device_new (); - itdb->version = 0x09; + itdb->version = 0x13; itdb->id = ((guint64)g_random_int () << 32) | ((guint64)g_random_int ()); return itdb; @@ -2114,8 +2116,8 @@ static glong get_mhit (FImport *fimp, glong mhit_seek) } if (header_len >= 0xf4) { - track->unk156 = get32lint (cts, seek+156); - track->unk160 = get32lint (cts, seek+160); + track->skipcount = get32lint (cts, seek+156); + track->last_skipped = get32lint (cts, seek+160); track->has_artwork = get8int (cts, seek+164); track->skip_when_shuffling = get8int (cts, seek+165); track->remember_playback_position = get8int (cts, seek+166); @@ -2141,6 +2143,14 @@ static glong get_mhit (FImport *fimp, glong mhit_seek) track->unk236 = get32lint (cts, seek+236); track->unk240 = get32lint (cts, seek+240); } + if (header_len >= 0x148) + { + track->unk244 = get32lint (cts, seek+244); + track->gapless_data = get32lint (cts, seek+248); + track->unk252 = get32lint (cts, seek+252); + track->gapless_track_flag = get16lint (cts, seek+256); + track->gapless_album_flag = get16lint (cts, seek+258); + } track->transferred = TRUE; /* track is on iPod! */ @@ -2255,6 +2265,10 @@ static glong get_mhit (FImport *fimp, glong mhit_seek) track->mark_unplayed = 0x01; } track->recent_playcount = playcount->playcount; + + track->skipcount += playcount->skipcount; + track->recent_skipcount = playcount->skipcount; + g_free (playcount); } itdb_track_add (fimp->itdb, track, -1); @@ -3191,8 +3205,14 @@ static void mk_mhbd (FExport *fexp, guint32 children) 0x0a: iTunes 4.5 0x0b: iTunes 4.7 0x0c: iTunes 4.71/4.8 (required for shuffle) - 0x0d: iTunes 4.9 */ - fexp->itdb->version = 0x0d; + 0x0d: iTunes 4.9 + 0x0e: iTunes 5 + 0x0f: iTunes 6 + 0x10: iTunes 6.0.1(?) + 0x11: iTunes 6.0.2 + 0x12 = iTunes 6.0.5. + 0x13 = iTunes 7 */ + fexp->itdb->version = 0x13; put32lint (cts, fexp->itdb->version); put32lint (cts, children); put64lint (cts, fexp->itdb->id); @@ -3251,7 +3271,7 @@ static void mk_mhit (WContents *cts, Itdb_Track *track) g_return_if_fail (track); put_header (cts, "mhit"); - put32lint (cts, 0xf4); /* header size */ + put32lint (cts, 0x148);/* header size */ put32lint (cts, -1); /* size of whole mhit -- fill in later */ put32lint (cts, -1); /* nr of mhods in this mhit -- later */ put32lint (cts, track->id); /* track index number */ @@ -3300,8 +3320,8 @@ static void mk_mhit (WContents *cts, Itdb_Track *track) put32lint (cts, track->unk148); put32lint (cts, track->unk152); /* since iTunesDB version 0x0c */ - put32lint (cts, track->unk156); - put32lint (cts, track->unk160); + put32lint (cts, track->skipcount); + put32lint (cts, track->last_skipped); put8int (cts, track->has_artwork); put8int (cts, track->skip_when_shuffling); put8int (cts, track->remember_playback_position); @@ -3326,6 +3346,12 @@ static void mk_mhit (WContents *cts, Itdb_Track *track) put32lint (cts, track->unk232); put32lint (cts, track->unk236); put32lint (cts, track->unk240); + put32lint (cts, track->unk244); + put32lint (cts, track->gapless_data); + put32lint (cts, track->unk252); + put16lint (cts, track->gapless_track_flag); + put16lint (cts, track->gapless_album_flag); + put32_n0 (cts, 17); /* padding */ } diff --git a/src/itdb_private.h b/src/itdb_private.h index f2ecccc..1695f22 100644 --- a/src/itdb_private.h +++ b/src/itdb_private.h @@ -1,4 +1,4 @@ -/* Time-stamp: <2006-11-12 22:17:17 jcs> +/* Time-stamp: <2007-01-06 20:46:59 jcs> | | Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net> | Part of the gtkpod project. @@ -87,6 +87,8 @@ struct playcount { guint32 bookmark_time; gint32 rating; gint32 pc_unk16; /* unknown field in Play Counts file */ + guint32 skipcount; + guint32 last_skipped; gint32 st_unk06; /* unknown field in iTunesStats file */ gint32 st_unk09; /* unknown field in iTunesStats file */ }; |
