diff options
author | Jorg Schuler <jcsjcs@users.sourceforge.net> | 2005-11-24 13:31:24 +0000 |
---|---|---|
committer | Jorg Schuler <jcsjcs@users.sourceforge.net> | 2005-11-24 13:31:24 +0000 |
commit | 3a2fe6f896ff3dfe9f66e074cd1c75d27f49b01a (patch) | |
tree | a81674e47ced1e16abdd14dce1bb1a792f6ce9bc /src/db-artwork-parser.c | |
parent | 413674fba5e513b11b0522fb5cc9356169f7c85d (diff) | |
download | libgpod-3a2fe6f896ff3dfe9f66e074cd1c75d27f49b01a.tar.gz libgpod-3a2fe6f896ff3dfe9f66e074cd1c75d27f49b01a.tar.xz libgpod-3a2fe6f896ff3dfe9f66e074cd1c75d27f49b01a.zip |
* overall changes to support itdb_image_get_gdk_pixbuf(). Run
"tests/test-thumbnails <ipod_mount> 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
Diffstat (limited to 'src/db-artwork-parser.c')
-rw-r--r-- | src/db-artwork-parser.c | 36 |
1 files changed, 33 insertions, 3 deletions
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 <config.h> +#endif + +#include <string.h> + #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; |