From 8c7b411193bcafb617406cec1f43341a851eac06 Mon Sep 17 00:00:00 2001 From: Jorg Schuler Date: Thu, 23 Mar 2006 15:06:32 +0000 Subject: Alpha version of reversed-endian Artwork writing. Status: iTunesDB can be written and is accepted on mobile phones, ArtworkDB can be read and be written as well, but newly added artwork will not yet display. * itdb.h: adjusted a couple of field lengths (4 byte -> 2 byte or even 1 byte) to address endian issues. git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1225 f01d2545-417e-4e96-918e-98f8d0dbbcb6 --- src/itdb_artwork.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/itdb_artwork.c') diff --git a/src/itdb_artwork.c b/src/itdb_artwork.c index 3bc8260..94b08b6 100644 --- a/src/itdb_artwork.c +++ b/src/itdb_artwork.c @@ -31,6 +31,7 @@ #include "itdb_private.h" #include "db-image-parser.h" +#include "itdb_endianness.h" #include #include #include @@ -214,7 +215,7 @@ gchar *itdb_thumb_get_filename (Itdb_Device *device, Itdb_Thumb *thumb) #if HAVE_GDKPIXBUF static guchar * -unpack_RGB_565 (guint16 *pixels, guint bytes_len) +unpack_RGB_565 (guint16 *pixels, guint bytes_len, guint byte_order) { guchar *result; guint i; @@ -226,8 +227,8 @@ unpack_RGB_565 (guint16 *pixels, guint bytes_len) } for (i = 0; i < bytes_len/2; i++) { guint16 cur_pixel; - - cur_pixel = GINT16_FROM_LE (pixels[i]); + /* FIXME: endianness */ + cur_pixel = get_gint16 (pixels[i], byte_order); /* Unpack pixels */ result[3*i] = (cur_pixel & RED_MASK) >> RED_SHIFT; result[3*i+1] = (cur_pixel & GREEN_MASK) >> GREEN_SHIFT; @@ -321,7 +322,7 @@ itdb_thumb_get_rgb_data (Itdb_Device *device, Itdb_Thumb *thumb) return NULL; } - pixels = unpack_RGB_565 (pixels565, thumb->size); + pixels = unpack_RGB_565 (pixels565, thumb->size, device->byte_order); g_free (pixels565); return pixels; -- cgit