summaryrefslogtreecommitdiffstats
path: root/src/db-image-parser.c
diff options
context:
space:
mode:
authorJorg Schuler <jcsjcs@users.sourceforge.net>2006-03-23 15:06:32 +0000
committerJorg Schuler <jcsjcs@users.sourceforge.net>2006-03-23 15:06:32 +0000
commit8c7b411193bcafb617406cec1f43341a851eac06 (patch)
tree405f62eac144bf39a2acb281f474b0ccf531f22c /src/db-image-parser.c
parent85e971a669065d3357a63327832159f730799666 (diff)
downloadlibgpod-tmz-8c7b411193bcafb617406cec1f43341a851eac06.tar.gz
libgpod-tmz-8c7b411193bcafb617406cec1f43341a851eac06.tar.xz
libgpod-tmz-8c7b411193bcafb617406cec1f43341a851eac06.zip
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
Diffstat (limited to 'src/db-image-parser.c')
-rw-r--r--src/db-image-parser.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/db-image-parser.c b/src/db-image-parser.c
index 296d82c..0ae79ae 100644
--- a/src/db-image-parser.c
+++ b/src/db-image-parser.c
@@ -30,12 +30,13 @@
#include <glib-object.h>
#include "itdb_device.h"
+#include "itdb_endianness.h"
#include "db-artwork-parser.h"
#include "db-image-parser.h"
#include <glib/gi18n-lib.h>
static int
-image_type_from_corr_id (Itdb_Device *device, int corr_id)
+image_type_from_corr_id (Itdb_Device *device, gint16 corr_id)
{
const Itdb_ArtworkFormat *formats;
@@ -88,21 +89,24 @@ itdb_get_artwork_info_from_type (Itdb_Device *device, int image_type)
G_GNUC_INTERNAL Itdb_Thumb *
ipod_image_new_from_mhni (MhniHeader *mhni, Itdb_iTunesDB *db)
{
-
Itdb_Thumb *img;
+ gint16 corr_id;
+
img = g_new0 (Itdb_Thumb, 1);
if (img == NULL) {
return NULL;
}
- img->size = GUINT32_FROM_LE (mhni->image_size);
- img->offset = GUINT32_FROM_LE (mhni->ithmb_offset);
- img->width = GINT16_FROM_LE (mhni->image_width);
- img->height = GINT16_FROM_LE (mhni->image_height);
+ img->size = get_guint32_db (db, mhni->image_size);
+ img->offset = get_guint32_db (db, mhni->ithmb_offset);
+ img->width = get_gint16_db (db, mhni->image_width);
+ img->height = get_gint16_db (db, mhni->image_height);
- img->type = image_type_from_corr_id (db->device, mhni->correlation_id);
+ corr_id = get_gint32_db (db, mhni->correlation_id);
+ img->type = image_type_from_corr_id (db->device, corr_id);
if ((img->type != IPOD_COVER_SMALL) && (img->type != IPOD_COVER_LARGE)) {
g_warning ("Unexpected cover type in mhni: type %d, size: %ux%u (%d), offset: %d\n",
- img->type, img->width, img->height, mhni->correlation_id, img->offset);
+ img->type, img->width, img->height,
+ corr_id, img->offset);
g_free (img);
return NULL;
}