Re: [Banshee-List] libipoddevice artwork patch



Le mercredi 02 novembre 2005 à 22:07 +0100, Christophe Fergeau a écrit :
> I forgot to mention that I'm lacking some data for the iPod nano and the
> iPod video, so any additional data related to those is welcome.

And here is a new patch which should have complete information now. The
Nano has less data than the other iPod models because it doesn't have
TV-out capabilities, so some photo formats are unnecessary.

I'm a bit worried about the width and height information. It corresponds
to the width and height of the thumbnail that will be stored in
the .ithmb files (ie each image in it will occupy width * height * 2
bytes), but iTunes seem to have other constraints for the width and
height it puts in the Photo Database file. For example, full screen TV
images don't seem to exceed 712x480 even if a 720x480 image could be
stored in the .ithmb file. And some smaller thumbnails sometimes exceed
the max height or width by a few pixels. I guess people trying to use
that code will report back whatever issues they encounter and will help
polish the information we report :)

Christophe
? libipoddevice-artwork.diff
? libipoddevice.diff
? mkinstalldirs
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libipoddevice/ChangeLog,v
retrieving revision 1.43
diff -u -r1.43 ChangeLog
--- ChangeLog	18 Oct 2005 17:18:34 -0000	1.43
+++ ChangeLog	5 Nov 2005 10:12:55 -0000
@@ -1,3 +1,11 @@
+2005-11-02  Christophe Fergeau  <teuf gnome org>
+
+	* src/ipod-device.c: (ipod_device_get_property),
+	(ipod_device_class_init):
+	* src/ipod-device.h: added an "artwork-formats" property to IpodDevice
+	which returns a static IpodArtworkFormat array (terminated by an entry 
+	filled with -1)
+
 2005-10-18  Aaron Bockover  <aaron aaronbock net>
 
 	* configure.ac: Require libgtop-2.0 to get disk usage information, much
Index: src/ipod-device.c
===================================================================
RCS file: /cvs/gnome/libipoddevice/src/ipod-device.c,v
retrieving revision 1.40
diff -u -r1.40 ipod-device.c
--- src/ipod-device.c	18 Oct 2005 17:18:33 -0000	1.40
+++ src/ipod-device.c	5 Nov 2005 10:12:55 -0000
@@ -50,6 +50,7 @@
 	guint generation;
 } IpodModel;
 
+
 static const IpodModel ipod_model_table [] = {
 	/* Handle idiots who hose their iPod file system, or 
 	   lucky people with iPods we don't yet know about*/
@@ -150,6 +151,55 @@
 	NULL
 };
 
+static const IpodArtworkFormat ipod_color_artwork_info[] = {
+	{IPOD_COVER_SMALL,        56,  56, 1017},
+	{IPOD_COVER_LARGE,       140, 140, 1016},
+	{IPOD_PHOTO_SMALL,        42,  30, 1009},
+	{IPOD_PHOTO_LARGE,       130,  88, 1015},
+	{IPOD_PHOTO_FULL_SCREEN, 220, 176, 1013},
+	{IPOD_PHOTO_TV_SCREEN,   720, 480, 1019},
+	{-1,                      -1,  -1,   -1}
+};
+
+static const IpodArtworkFormat ipod_nano_artwork_info[] = {
+	{IPOD_COVER_SMALL,        42,  42, 1031},
+	{IPOD_COVER_LARGE,       100, 100, 1027},
+	{IPOD_PHOTO_LARGE,        42,  37, 1032},
+	{IPOD_PHOTO_FULL_SCREEN, 176, 132, 1023},
+	{-1,                      -1,  -1,   -1}
+};
+
+static const IpodArtworkFormat ipod_video_artwork_info[] = {
+	{IPOD_COVER_SMALL,       100, 100, 1028},
+	{IPOD_COVER_LARGE,       200, 200, 1029},
+	{IPOD_PHOTO_SMALL,        50,  41, 1036},
+	{IPOD_PHOTO_LARGE,       130,  88, 1015},
+	{IPOD_PHOTO_FULL_SCREEN, 320, 240, 1024},
+	{IPOD_PHOTO_TV_SCREEN,   720, 480, 1019},
+	{-1,                      -1,  -1,   -1}
+};
+
+/* This will be indexed using a value from the MODEL_TYPE enum */
+static const IpodArtworkFormat *ipod_artwork_info_table[] = {
+        NULL,                    /* Invalid       */
+	NULL,                    /* Unknown       */
+	ipod_color_artwork_info, /* Color         */
+	ipod_color_artwork_info, /* Color U2      */
+	NULL,                    /* Grayscale     */ 
+	NULL,                    /* Grayscale U2  */
+	NULL,                    /* Mini (Silver) */
+	NULL,                    /* Mini (Blue)   */
+	NULL,                    /* Mini (Pink)   */
+	NULL,                    /* Mini (Green)  */
+	NULL,                    /* Mini (Gold)   */
+	NULL,                    /* Shuffle       */
+	ipod_nano_artwork_info,  /* Nano (White)  */
+	ipod_nano_artwork_info,  /* Nano (Black)  */
+	ipod_video_artwork_info, /* Video (White) */
+	ipod_video_artwork_info  /* Video (Black) */
+};
+
+
 #define g_free_if_not_null(o) \
     if(o != NULL) {           \
         g_free(o);            \
@@ -341,6 +391,11 @@
 		case PROP_CAN_WRITE:
 			g_value_set_boolean(value, device->priv->can_write);
 			break;
+     	        case PROP_ARTWORK_FORMAT:
+			g_value_set_pointer(value, 
+				ipod_artwork_info_table[ipod_model_table[
+					device->priv->model_index].model_type]);
+			break;
 		default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
 			break;
@@ -432,7 +487,8 @@
 	GParamSpec *can_write_param;
 	GParamSpec *device_generation_param;
 	GParamSpec *advertised_capacity_param;
-	
+	GParamSpec *artwork_format_param;
+
 	GObjectClass *class = G_OBJECT_CLASS(klass);
 
 	parent_class = g_type_class_peek_parent(klass);
@@ -526,6 +582,9 @@
 		"Generation", "Generation of the iPod",
 		0, G_MAXUINT, 0, G_PARAM_READABLE);
 
+	artwork_format_param = g_param_spec_pointer("artwork-formats",
+		"Artwork Format", "Support Artwork Formats", G_PARAM_READABLE);
+
 	class->set_property = ipod_device_set_property;
 	class->get_property = ipod_device_get_property;	
 	
@@ -595,6 +654,10 @@
 
 	g_object_class_install_property(class, PROP_ADVERTISED_CAPACITY,
 		advertised_capacity_param);
+	
+	g_object_class_install_property(class, PROP_ARTWORK_FORMAT,
+		artwork_format_param);
+		
 }
 
 static void
Index: src/ipod-device.h
===================================================================
RCS file: /cvs/gnome/libipoddevice/src/ipod-device.h,v
retrieving revision 1.16
diff -u -r1.16 ipod-device.h
--- src/ipod-device.h	12 Oct 2005 19:07:41 -0000	1.16
+++ src/ipod-device.h	5 Nov 2005 10:12:55 -0000
@@ -109,12 +109,31 @@
 	PROP_FIRMWARE_VERSION,
 	PROP_VOLUME_UUID,
 	PROP_VOLUME_LABEL,
-	PROP_CAN_WRITE
+	PROP_CAN_WRITE,
+	PROP_ARTWORK_FORMAT
 };
 
 enum {
 	ERROR_SAVE
 };
+
+enum { 
+	IPOD_COVER_SMALL,
+	IPOD_COVER_LARGE,
+	IPOD_PHOTO_SMALL,
+	IPOD_PHOTO_LARGE,
+	IPOD_PHOTO_FULL_SCREEN,
+	IPOD_PHOTO_TV_SCREEN
+};
+
+
+typedef struct {
+	gint  type;
+	gint16 width;
+	gint16 height;
+	gint16 correlation_id;
+} IpodArtworkFormat;
+
 
 GType ipod_device_get_type();
 IpodDevice *ipod_device_new(gchar *mount_point);

Attachment: signature.asc
Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]