summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorg Schuler <jcsjcs@users.sourceforge.net>2007-01-08 10:23:15 +0000
committerJorg Schuler <jcsjcs@users.sourceforge.net>2007-01-08 10:23:15 +0000
commit3b3476cdce7ec18f0e758d4045044b52b12182a5 (patch)
treef1bc1eceadde12d78ecccb9ccfc5789f3b1f2835
parent867195c87012e672a1229b792e8a6bd5d8194305 (diff)
downloadlibgpod-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
-rw-r--r--ChangeLog15
-rw-r--r--docs/reference/tmpl/artwork.sgml9
-rw-r--r--docs/reference/tmpl/device.sgml1
-rw-r--r--docs/reference/tmpl/playlists.sgml2
-rw-r--r--docs/reference/tmpl/track.sgml21
-rw-r--r--src/itdb.h23
-rw-r--r--src/itdb_itunesdb.c60
-rw-r--r--src/itdb_private.h4
-rw-r--r--tests/Makefile.am36
9 files changed, 120 insertions, 51 deletions
diff --git a/ChangeLog b/ChangeLog
index 6a3c776..a2d3d0d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2007-01-06 Jorg Schuler <jcsjcs at users.sourceforge.net>
+
+ * 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.
+
2007-01-04 Todd Zullinger <tmzullinger at users.sourceforge.net>
* configure.ac
diff --git a/docs/reference/tmpl/artwork.sgml b/docs/reference/tmpl/artwork.sgml
index 94bc4db..e2641b9 100644
--- a/docs/reference/tmpl/artwork.sgml
+++ b/docs/reference/tmpl/artwork.sgml
@@ -23,9 +23,13 @@ Data structure to store iPod artwork (cover and photos)
</para>
@thumbnails:
-@artwork_size:
@id:
+@unk028:
+@rating:
+@unk036:
@creation_date:
+@digitized_date:
+@artwork_size:
@usertype:
@userdata:
@userdata_duplicate:
@@ -40,6 +44,7 @@ Data structure to store iPod artwork (cover and photos)
@filename:
@image_data:
@image_data_len:
+@rotation:
@offset:
@size:
@width:
@@ -92,6 +97,8 @@ Data structure to store iPod artwork (cover and photos)
@artwork:
@type:
@filename:
+@rotation:
+@error:
@Returns:
diff --git a/docs/reference/tmpl/device.sgml b/docs/reference/tmpl/device.sgml
index 907bf1c..6d25ee1 100644
--- a/docs/reference/tmpl/device.sgml
+++ b/docs/reference/tmpl/device.sgml
@@ -109,4 +109,5 @@ Data structure holding information about the iPod (model, mount point, ...)
@width:
@height:
@correlation_id:
+@format:
diff --git a/docs/reference/tmpl/playlists.sgml b/docs/reference/tmpl/playlists.sgml
index 70395be..2d69676 100644
--- a/docs/reference/tmpl/playlists.sgml
+++ b/docs/reference/tmpl/playlists.sgml
@@ -33,8 +33,6 @@ Data structure to represent an iPod playlist
@is_spl:
@timestamp:
@id:
-@mhodcount:
-@libmhodcount:
@sortorder:
@podcastflag:
@splpref:
diff --git a/docs/reference/tmpl/track.sgml b/docs/reference/tmpl/track.sgml
index 274b1d0..b10d81c 100644
--- a/docs/reference/tmpl/track.sgml
+++ b/docs/reference/tmpl/track.sgml
@@ -82,8 +82,9 @@ Data structure to store metadata about an iPod track
@unk146:
@unk148:
@unk152:
-@unk156:
-@unk160:
+@skipcount:
+@recent_skipcount:
+@last_skipped:
@has_artwork:
@skip_when_shuffling:
@remember_playback_position:
@@ -94,21 +95,25 @@ Data structure to store metadata about an iPod track
@mark_unplayed:
@unk179:
@unk180:
-@unk184:
+@pregap:
@samplecount:
-@unk192:
@unk196:
-@unk200:
+@postgap:
@unk204:
-@unk208:
-@unk212:
-@unk216:
+@mediatype:
+@season_nr:
+@episode_nr:
@unk220:
@unk224:
@unk228:
@unk232:
@unk236:
@unk240:
+@unk244:
+@gapless_data:
+@unk252:
+@gapless_track_flag:
+@gapless_album_flag:
@chapterdata_raw:
@chapterdata_raw_length:
@artwork:
diff --git a/src/itdb.h b/src/itdb.h
index 09bf928..3272c12 100644
--- a/src/itdb.h
+++ b/src/itdb.h
@@ -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 */
};
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0649864..e77f83b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,5 +1,14 @@
if HAVE_GDKPIXBUF
TESTTHUMBS=test-thumbnails test-write-thumbnails test-photos
+
+test_thumbnails_SOURCES = test-covers.c
+test_thumbnails_CFLAGS = $(AM_CFLAGS)
+
+test_write_thumbnails_SOURCES = test-write-covers.c
+test_write_thumbnails_CFLAGS = $(AM_CFLAGS)
+
+test_photos_SOURCES = test-photos.c
+test_photos_CFLAGS = $(AM_CFLAGS)
else
TESTTHUMBS=
endif
@@ -8,34 +17,23 @@ TESTMISC=test-init-ipod
if HAVE_TAGLIB
TESTTAGLIB=test-rebuild-db
+test_rebuild_db_SOURCES = test-rebuild-db.cc
+test_rebuild_db_LDADD = $(TAGLIB_LIBS)
+test_rebuild_db_CXXFLAGS = $(TAGLIB_CFLAGS)
else
TESTTAGLIB=
endif
-noinst_PROGRAMS=test-itdb test-ls $(TESTTHUMBS) $(TESTTAGLIB) $(TESTMISC)
-
-INCLUDES=$(LIBGPOD_CFLAGS) -I$(top_srcdir)/src -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\"
-LIBS=$(LIBGPOD_LIBS) $(top_builddir)/src/libgpod.la
-
test_itdb_SOURCES = itdb_main.c
test_itdb_LDADD =
test_ls_SOURCES = test-ls.c
test_ls_LDADD =
-if HAVE_TAGLIB
-test_rebuild_db_SOURCES = test-rebuild-db.cc
-test_rebuild_db_LDADD = $(TAGLIB_LIBS)
-test_rebuild_db_CXXFLAGS = $(TAGLIB_CFLAGS)
-endif
-
-if HAVE_GDKPIXBUF
-test_thumbnails_SOURCES = test-covers.c
-test_thumbnails_CFLAGS = $(AM_CFLAGS)
+test_init_ipod_SOURCES = test-init-ipod.c
+test_init_ipod_LDADD =
-test_photos_SOURCES = test-photos.c
-test_photos_CFLAGS = $(AM_CFLAGS)
+noinst_PROGRAMS=test-itdb test-ls $(TESTTHUMBS) $(TESTTAGLIB) $(TESTMISC)
-test_write_thumbnails_SOURCES = test-write-covers.c
-test_write_thumbnails_CFLAGS = $(AM_CFLAGS)
-endif
+INCLUDES=$(LIBGPOD_CFLAGS) -I$(top_srcdir)/src -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\"
+LIBS=$(LIBGPOD_LIBS) $(top_builddir)/src/libgpod.la