From db00e375bef30bbb8fffff906ec6967791a56136 Mon Sep 17 00:00:00 2001 From: Jorg Schuler Date: Thu, 24 Nov 2005 13:31:24 +0000 Subject: * overall changes to support itdb_image_get_gdk_pixbuf(). Run "tests/test-thumbnails to copy all thumbnails into the current directory. git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1172 f01d2545-417e-4e96-918e-98f8d0dbbcb6 --- src/db-artwork-parser.c | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'src/db-artwork-parser.c') diff --git a/src/db-artwork-parser.c b/src/db-artwork-parser.c index 4a1997c..8be8be7 100644 --- a/src/db-artwork-parser.c +++ b/src/db-artwork-parser.c @@ -22,6 +22,12 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + #include "itdb.h" #include "db-artwork-debug.h" #include "db-artwork-parser.h" @@ -98,8 +104,32 @@ get_utf16_string (void* buffer, gint length) } +static char * +mhod3_get_ithmb_filename (MhodHeaderArtworkType3 *mhod3, + Itdb_iTunesDB *db) +{ + char *paths[] = {"iPod_Control", "Artwork", NULL, NULL}; + char *filename; + char *result; + + g_assert (mhod3 != NULL); + g_assert (db != NULL); + + filename = get_utf16_string (mhod3->string, mhod3->string_len); + if ((filename == NULL) || (strlen (filename) < 2)) { + return NULL; + } + + paths[2] = filename+1; + result = itdb_resolve_path (db->mountpoint, (const char **)paths); + g_free (filename); + return result; +} + + static int -parse_mhod_3 (DBParseContext *ctx, Itdb_Image *image, GError *error) +parse_mhod_3 (DBParseContext *ctx, Itdb_iTunesDB *db, + Itdb_Image *image, GError *error) { MhodHeader *mhod; MhodHeaderArtworkType3 *mhod3; @@ -117,7 +147,7 @@ parse_mhod_3 (DBParseContext *ctx, Itdb_Image *image, GError *error) if ((GINT_FROM_LE (mhod3->type) & 0x00FFFFFF) != MHOD_ARTWORK_TYPE_FILE_NAME) { return -1; } - image->filename = get_utf16_string (mhod3->string, mhod3->string_len); + image->filename = mhod3_get_ithmb_filename (mhod3, db); dump_mhod_type_3 (mhod3); return 0; } @@ -145,7 +175,7 @@ parse_mhni (DBParseContext *ctx, iPodSong *song, GError *error) if (mhod_ctx == NULL) { return -1; } - parse_mhod_3 (mhod_ctx, thumb, error); + parse_mhod_3 (mhod_ctx, song->itdb, thumb, error); g_free (mhod_ctx); return 0; -- cgit