diff options
author | Christophe Fergeau <teuf@gnome.org> | 2008-05-30 12:00:21 +0000 |
---|---|---|
committer | Christophe Fergeau <teuf@gnome.org> | 2008-05-30 12:00:21 +0000 |
commit | 37e1533b203557602942eea32cc9f2397004023c (patch) | |
tree | 15322f7006e27473d2c0c69b2d891f26c66cde67 /src/db-artwork-parser.c | |
parent | 747eda0937e4bf51a586183d99a326b75ebf6a78 (diff) | |
download | libgpod-tmz-37e1533b203557602942eea32cc9f2397004023c.tar.gz libgpod-tmz-37e1533b203557602942eea32cc9f2397004023c.tar.xz libgpod-tmz-37e1533b203557602942eea32cc9f2397004023c.zip |
* src/Makefile.am:
* src/db-artwork-parser.c:
* src/db-artwork-writer.c:
* src/db-image-parser.c:
* src/db-image-parser.h:
* src/itdb.h:
* src/itdb_artwork.c:
* src/itdb_device.h:
* src/itdb_photoalbum.c:
* src/itdb_track.c:
* src/ithumb-writer.c:
* tests/test-covers.c:
* tests/test-photos.c: rework Itdb_Thumb type. Now it's split into
different subtypes depending on what it represents (GdkPixbuf,
thumbnail read from the ipod, ...). Itdb_Artwork now contains only a
pointer to a single Itdb_Thumb (it used to contain a GList * of
Itdb_Thumb) since the only time when the list is useful is for thumbs
read from the ipod. Using a list for the other types of thumbnails
created some complications when trying to set art on an Itdb_Track that
wasn't attached to an Itdb_iTunesDB.
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1991 f01d2545-417e-4e96-918e-98f8d0dbbcb6
Diffstat (limited to 'src/db-artwork-parser.c')
-rw-r--r-- | src/db-artwork-parser.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/db-artwork-parser.c b/src/db-artwork-parser.c index 07b21a9..e993eee 100644 --- a/src/db-artwork-parser.c +++ b/src/db-artwork-parser.c @@ -163,7 +163,7 @@ parse_mhod_string (DBParseContext *ctx, GError *error) static int parse_mhod_3 (DBParseContext *ctx, - Itdb_Thumb *thumb, GError *error) + Itdb_Thumb_Ipod_Item *thumb, GError *error) { struct ParsedMhodString *mhod; mhod = parse_mhod_string (ctx, error); @@ -182,11 +182,11 @@ parse_mhod_3 (DBParseContext *ctx, } static int -parse_photo_mhni (DBParseContext *ctx, Itdb_Artwork *artwork, GError *error) +parse_photo_mhni (DBParseContext *ctx, Itdb_Thumb_Ipod *thumbs, GError *error) { MhniHeader *mhni; DBParseContext *mhod_ctx; - Itdb_Thumb *thumb; + Itdb_Thumb_Ipod_Item *thumb; mhni = db_parse_context_get_m_header (ctx, MhniHeader, "mhni"); if (mhni == NULL) { @@ -199,8 +199,8 @@ parse_photo_mhni (DBParseContext *ctx, Itdb_Artwork *artwork, GError *error) if (thumb == NULL) { return 0; } - - artwork->thumbnails = g_list_append (artwork->thumbnails, thumb); + + itdb_thumb_ipod_add (thumbs, thumb); mhod_ctx = db_parse_context_get_sub_context (ctx, ctx->header_len); if (mhod_ctx == NULL) { @@ -213,7 +213,7 @@ parse_photo_mhni (DBParseContext *ctx, Itdb_Artwork *artwork, GError *error) } static int -parse_photo_mhod (DBParseContext *ctx, Itdb_Artwork *artwork, GError *error) +parse_photo_mhod (DBParseContext *ctx, Itdb_Thumb_Ipod *thumbs, GError *error) { ArtworkDB_MhodHeader *mhod; DBParseContext *mhni_ctx; @@ -235,7 +235,7 @@ parse_photo_mhod (DBParseContext *ctx, Itdb_Artwork *artwork, GError *error) if (mhni_ctx == NULL) { return -1; } - parse_photo_mhni (mhni_ctx, artwork, NULL); + parse_photo_mhni (mhni_ctx, thumbs, NULL); g_free (mhni_ctx); } @@ -253,7 +253,8 @@ parse_mhii (DBParseContext *ctx, GError *error) Itdb_PhotoDB *photodb; guint64 mactime; Itdb_Device *device = db_get_device (ctx->db); - + Itdb_Thumb_Ipod *thumbs; + mhii = db_parse_context_get_m_header (ctx, MhiiHeader, "mhii"); if (mhii == NULL) { @@ -275,12 +276,14 @@ parse_mhii (DBParseContext *ctx, GError *error) artwork->artwork_size = get_gint32 (mhii->orig_img_size, ctx->byte_order); artwork->dbid = get_gint64 (mhii->song_id, ctx->byte_order); + thumbs = (Itdb_Thumb_Ipod *)itdb_thumb_ipod_new (); + artwork->thumbnail = (Itdb_Thumb *)thumbs; cur_offset = ctx->header_len; mhod_ctx = db_parse_context_get_sub_context (ctx, cur_offset); num_children = get_gint32 (mhii->num_children, ctx->byte_order); while ((num_children > 0) && (mhod_ctx != NULL)) { - parse_photo_mhod (mhod_ctx, artwork, NULL); + parse_photo_mhod (mhod_ctx, thumbs, NULL); num_children--; cur_offset += mhod_ctx->total_len; g_free (mhod_ctx); |