Hi, The attached patch adds an "artwork-formats" property to the IpodDevice object. This property corresponds to an array of IpodArtworkFormat structures : typedef struct { gint type; gint16 width; gint16 height; gint16 correlation_id; } IpodArtworkFormat; For iPods without a color screen, it returns NULL. For color ipods (ie iPod photos, iPod nanos and iPod videos), it returns an array describing the format (width*height and correlation id) of the various thumbnail sizes supported by the iPod. The correlation id is the 4 digit number that is appended to the filename where this type of thumbnails is stored. The last element of this array is filled with "-1" Any comment on this patch is welcome, I can change the array to a GList if that's preferrable, the IpodArtworkFormat may not be complete enough (in particular, depending on the thumbnail type, the pixel data is not using the same format (byte swapped 565, unswapped 565, some interlaced format, ...). I assumed the pixel format would be the same on all iPod models for a given thumbnail type, but it might be safer to put it in the structure now rather than later. I can also change the property name if someone has a better one to suggest. Regards, 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 2 Nov 2005 20:47:46 -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 2 Nov 2005 20:47:46 -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,57 @@ 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_SMALL, 0, 0, 0},*/ + {IPOD_PHOTO_LARGE, 42, 37, 1032}, + {IPOD_PHOTO_FULL_SCREEN, 176, 132, 1023}, + {IPOD_PHOTO_TV_SCREEN, 720, 480, 0}, + {-1, -1, -1, -1} +}; + +static const IpodArtworkFormat ipod_video_artwork_info[] = { +/* {IPOD_COVER_SMALL, 0, 0, 0}, + {IPOD_COVER_LARGE, 0, 0, 0}, + {IPOD_PHOTO_SMALL, 0, 0, 0}, + {IPOD_PHOTO_LARGE, 0, 0, 0}, + {IPOD_PHOTO_FULL_SCREEN, 0, 0, 0}, + {IPOD_PHOTO_TV_SCREEN, 0, 0, 0},*/ + {-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 +393,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 +489,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 +584,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 +656,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 2 Nov 2005 20:47:46 -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?=