From e47eb7f5139d1a1692bad1ad5c269d3e6bee40bb Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Sun, 25 May 2008 10:46:13 +0000 Subject: * src/db-artwork-debug.c: * src/db-artwork-writer.c: * src/db-image-parser.c: * src/db-itunes-parser.h: * src/itdb_device.h: * src/ithumb-writer.c: rename correlation_id to format_id (this is how that value is called in SysInfoExtended) git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1981 f01d2545-417e-4e96-918e-98f8d0dbbcb6 --- ChangeLog | 10 ++++++++++ src/db-artwork-debug.c | 12 ++++++------ src/db-artwork-writer.c | 27 +++++++++++---------------- src/db-image-parser.c | 16 ++++++++-------- src/db-itunes-parser.h | 6 +++--- src/itdb_device.h | 2 +- src/ithumb-writer.c | 12 ++++++------ 7 files changed, 45 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index 71ae1ea..48bffa0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-05-25 Christophe Fergeau + + * src/db-artwork-debug.c: + * src/db-artwork-writer.c: + * src/db-image-parser.c: + * src/db-itunes-parser.h: + * src/itdb_device.h: + * src/ithumb-writer.c: rename correlation_id to format_id (this is + how that value is called in SysInfoExtended) + 2008-05-25 Christophe Fergeau * configure.ac: check libxml presence diff --git a/src/db-artwork-debug.c b/src/db-artwork-debug.c index 18cd5a4..f715424 100644 --- a/src/db-artwork-debug.c +++ b/src/db-artwork-debug.c @@ -35,9 +35,9 @@ dump_mhif (MhifHeader *mhif) g_print ("\tHeader length: %d\n", GINT_FROM_LE (mhif->header_len)); g_print ("\tTotal length: %d\n", GINT_FROM_LE (mhif->total_len)); g_print ("\tUnknown1: %08x\n", GINT_FROM_LE (mhif->unknown1)); - g_print ("\tCorrelation ID: %d (=> F%d_1.ithmb)\n", - GINT_FROM_LE (mhif->correlation_id), - GINT_FROM_LE (mhif->correlation_id)); + g_print ("\tFormat ID: %d (=> F%d_1.ithmb)\n", + GINT_FROM_LE (mhif->format_id), + GINT_FROM_LE (mhif->format_id)); g_print ("\tImage size: %d bytes\n", GINT_FROM_LE (mhif->image_size)); } @@ -100,9 +100,9 @@ dump_mhni (MhniHeader *mhni) g_print ("\tHeader length: %d\n", GINT_FROM_LE (mhni->header_len)); g_print ("\tTotal length: %d\n", GINT_FROM_LE (mhni->total_len)); g_print ("\tNumber of children: %08x\n", GINT_FROM_LE (mhni->num_children)); - g_print ("\tCorrelation ID: %d (=> F%d_1.ithmb)\n", - GINT_FROM_LE (mhni->correlation_id), - GINT_FROM_LE (mhni->correlation_id)); + g_print ("\tFormat ID: %d (=> F%d_1.ithmb)\n", + GINT_FROM_LE (mhni->format_id), + GINT_FROM_LE (mhni->format_id)); g_print ("\tithmb offset: %u bytes\n", GINT_FROM_LE (mhni->ithmb_offset)); g_print ("\tImage size: %u bytes\n", GINT_FROM_LE (mhni->image_size)); g_print ("\tVertical padding: %d\n", GINT16_FROM_LE (mhni->vertical_padding)); diff --git a/src/db-artwork-writer.c b/src/db-artwork-writer.c index 50e65b3..15151bc 100644 --- a/src/db-artwork-writer.c +++ b/src/db-artwork-writer.c @@ -357,7 +357,7 @@ write_mhod_type_3 (gchar *string, iPodBuffer *buffer) } static int -write_mhni (Itdb_DB *db, Itdb_Thumb *thumb, int correlation_id, iPodBuffer *buffer) +write_mhni (Itdb_DB *db, Itdb_Thumb *thumb, int format_id, iPodBuffer *buffer) { MhniHeader *mhni; unsigned int total_bytes; @@ -377,16 +377,11 @@ write_mhni (Itdb_DB *db, Itdb_Thumb *thumb, int correlation_id, iPodBuffer *buff buffer->byte_order); mhni->total_len = get_gint32 (total_bytes, buffer->byte_order); - mhni->correlation_id = get_gint32 (correlation_id, - buffer->byte_order); - mhni->image_width = get_gint16 (thumb->width, - buffer->byte_order); - mhni->image_height = get_gint16 (thumb->height, - buffer->byte_order); - mhni->image_size = get_gint32 (thumb->size, - buffer->byte_order); - mhni->ithmb_offset = get_gint32 (thumb->offset, - buffer->byte_order); + mhni->format_id = get_gint32 (format_id, buffer->byte_order); + mhni->image_width = get_gint16 (thumb->width, buffer->byte_order); + mhni->image_height = get_gint16 (thumb->height, buffer->byte_order); + mhni->image_size = get_gint32 (thumb->size, buffer->byte_order); + mhni->ithmb_offset = get_gint32 (thumb->offset, buffer->byte_order); mhni->vertical_padding = get_gint16 (thumb->vertical_padding, buffer->byte_order); mhni->horizontal_padding = get_gint16 (thumb->horizontal_padding, @@ -415,7 +410,7 @@ write_mhni (Itdb_DB *db, Itdb_Thumb *thumb, int correlation_id, iPodBuffer *buff } static int -write_mhod (Itdb_DB *db, Itdb_Thumb *thumb, int correlation_id, iPodBuffer *buffer) +write_mhod (Itdb_DB *db, Itdb_Thumb *thumb, int format_id, iPodBuffer *buffer) { ArtworkDB_MhodHeader *mhod; unsigned int total_bytes; @@ -439,7 +434,7 @@ write_mhod (Itdb_DB *db, Itdb_Thumb *thumb, int correlation_id, iPodBuffer *buff if (sub_buffer == NULL) { return -1; } - bytes_written = write_mhni (db, thumb, correlation_id, sub_buffer); + bytes_written = write_mhni (db, thumb, format_id, sub_buffer); ipod_buffer_destroy (sub_buffer); if (bytes_written == -1) { return -1; @@ -519,7 +514,7 @@ write_mhii (Itdb_DB *db, void *data, iPodBuffer *buffer) if (sub_buffer == NULL) { return -1; } - bytes_written = write_mhod (db, thumb, img_info->correlation_id, + bytes_written = write_mhod (db, thumb, img_info->format_id, sub_buffer); ipod_buffer_destroy (sub_buffer); if (bytes_written == -1) { @@ -737,8 +732,8 @@ write_mhif (Itdb_DB *db, iPodBuffer *buffer, } mhif->total_len = mhif->header_len; - mhif->correlation_id = get_gint32 (img_info->correlation_id, - buffer->byte_order); + mhif->format_id = get_gint32 (img_info->format_id, + buffer->byte_order); mhif->image_size = get_gint32 (img_info->height * img_info->width * 2, buffer->byte_order); diff --git a/src/db-image-parser.c b/src/db-image-parser.c index be28838..dfc7d5d 100644 --- a/src/db-image-parser.c +++ b/src/db-image-parser.c @@ -36,7 +36,7 @@ #include static int -image_type_from_corr_id (Itdb_Device *device, gint16 corr_id) +image_type_from_format_id (Itdb_Device *device, gint16 format_id) { const Itdb_ArtworkFormat *formats; @@ -51,7 +51,7 @@ image_type_from_corr_id (Itdb_Device *device, gint16 corr_id) } while (formats->type != -1) { - if (formats->correlation_id == corr_id) { + if (formats->format_id == format_id) { return formats->type; } formats++; @@ -91,7 +91,7 @@ G_GNUC_INTERNAL Itdb_Thumb * ipod_image_new_from_mhni (MhniHeader *mhni, Itdb_DB *db) { Itdb_Thumb *img; - gint16 corr_id; + gint16 format_id; Itdb_Device *device = NULL; img = g_new0 (Itdb_Thumb, 1); @@ -110,19 +110,19 @@ ipod_image_new_from_mhni (MhniHeader *mhni, Itdb_DB *db) device = db_get_device (db); g_return_val_if_fail (device, NULL); - corr_id = get_gint32_db (db, mhni->correlation_id); - img->type = image_type_from_corr_id (device, corr_id); + format_id = get_gint32_db (db, mhni->format_id); + img->type = image_type_from_format_id (device, format_id); #if DEBUG_ARTWORK - printf ("corr_id: %d, of: %6d sz: %6d, x: %3d, y: %3d, xpad: %3d, ypad: %3d\n", - corr_id, img->offset, img->size, img->width, img->height, img->horizontal_padding, img->vertical_padding); + printf ("format_id: %d, of: %6d sz: %6d, x: %3d, y: %3d, xpad: %3d, ypad: %3d\n", + format_id, img->offset, img->size, img->width, img->height, img->horizontal_padding, img->vertical_padding); #endif if (img->type == -1) { g_warning (_("Unexpected image type in mhni: size: %ux%u (%d), offset: %d\n"), img->width, img->height, - corr_id, img->offset); + format_id, img->offset); g_free (img); return NULL; } diff --git a/src/db-itunes-parser.h b/src/db-itunes-parser.h index 7cb0cf9..8dcf10c 100644 --- a/src/db-itunes-parser.h +++ b/src/db-itunes-parser.h @@ -156,7 +156,7 @@ struct _MhipHeader { gint32 header_len; gint32 total_len; gint32 unknown1; - gint32 correlation_id; + gint32 format_id; gint32 unknown2; gint32 track_id; gint32 timestamp; @@ -562,7 +562,7 @@ struct _MhniHeader { gint32 header_len; gint32 total_len; gint32 num_children; - gint32 correlation_id; + gint32 format_id; gint32 ithmb_offset; gint32 image_size; gint16 vertical_padding; @@ -621,7 +621,7 @@ struct _MhifHeader { gint32 header_len; gint32 total_len; gint32 unknown1; - gint32 correlation_id; + gint32 format_id; gint32 image_size; unsigned char padding[]; }; diff --git a/src/itdb_device.h b/src/itdb_device.h index 0f4a8a7..1a8a70a 100644 --- a/src/itdb_device.h +++ b/src/itdb_device.h @@ -101,7 +101,7 @@ struct _Itdb_ArtworkFormat ItdbThumbType type; gint16 width; gint16 height; - gint16 correlation_id; + gint16 format_id; ItdbThumbFormat format; gint32 padding; /* If true, crop the artwork to completely fill the target size, diff --git a/src/ithumb-writer.c b/src/ithumb-writer.c index 92afd85..074caa9 100644 --- a/src/ithumb-writer.c +++ b/src/ithumb-writer.c @@ -486,7 +486,7 @@ pack_UYVY (GdkPixbuf *orig_pixbuf, const Itdb_ArtworkFormat *img_info, static char * -ipod_image_get_ithmb_filename (const char *mount_point, gint correlation_id, gint index, DbType db_type ) +ipod_image_get_ithmb_filename (const char *mount_point, gint format_id, gint index, DbType db_type ) { gchar *artwork_dir = NULL, *filename, *buf; @@ -541,7 +541,7 @@ ipod_image_get_ithmb_filename (const char *mount_point, gint correlation_id, gin } } - buf = g_strdup_printf ("F%d_%d.ithmb", correlation_id, index); + buf = g_strdup_printf ("F%d_%d.ithmb", format_id, index); filename = itdb_get_path (artwork_dir, buf); @@ -769,7 +769,7 @@ static char *get_ithmb_filename (iThumbWriter *writer, Itdb_Thumb *thumb) case ITDB_THUMB_PHOTO_FULL_SCREEN: case ITDB_THUMB_PHOTO_TV_SCREEN: return g_strdup_printf (":Thumbs:F%d_%d.ithmb", - writer->img_info->correlation_id, + writer->img_info->format_id, writer->current_file_index); break; case ITDB_THUMB_COVER_LARGE: @@ -779,7 +779,7 @@ static char *get_ithmb_filename (iThumbWriter *writer, Itdb_Thumb *thumb) case ITDB_THUMB_COVER_SMEDIUM: case ITDB_THUMB_COVER_XSMALL: return g_strdup_printf (":F%d_%d.ithmb", - writer->img_info->correlation_id, + writer->img_info->format_id, writer->current_file_index); break; } @@ -942,7 +942,7 @@ ithumb_writer_update (iThumbWriter *writer) writer->filename = ipod_image_get_ithmb_filename (writer->mountpoint, - writer->img_info->correlation_id, + writer->img_info->format_id, writer->current_file_index, writer->db_type); if (writer->filename == NULL) @@ -1319,7 +1319,7 @@ ithmb_rearrange_existing_thumbnails (Itdb_DB *db, for (i=0; i<50; ++i) { filename = ipod_image_get_ithmb_filename (mountpoint, - info->correlation_id, + info->format_id, i, db->db_type); if (g_file_test (filename, G_FILE_TEST_EXISTS)) -- cgit