diff options
author | Christophe Fergeau <teuf@gnome.org> | 2008-06-09 19:53:36 +0000 |
---|---|---|
committer | Christophe Fergeau <teuf@gnome.org> | 2008-06-09 19:53:36 +0000 |
commit | 3f2830dc026ba5211504261513a74855ccbb098f (patch) | |
tree | 1261fe601c0fdc543ca024404b6107245d3d4ead /src/db-artwork-writer.c | |
parent | 0a03e8911c53136dd3e17faf2e37aa895285a341 (diff) | |
download | libgpod-tmz-3f2830dc026ba5211504261513a74855ccbb098f.tar.gz libgpod-tmz-3f2830dc026ba5211504261513a74855ccbb098f.tar.xz libgpod-tmz-3f2830dc026ba5211504261513a74855ccbb098f.zip |
* src/db-artwork-parser.c: remove duplicated artwork/photo support
testing functions
* src/db-artwork-parser.h: ditto
* src/itdb_itunesdb.c: s/ipod_supports_XXX/itdb_device_supports_XXX
* src/itdb_photoalbum.c: ditto
* src/itdb.h: use a const Itdb_Device argument for
itdb_device_supports_*, add ITDB_IPOD_GENERATION_IPHONE_1 to
Itdb_IpodGeneration, get rid of ITDB_IPOD_GENERATION_FIFTH and
ITDB_IPOD_GENERATION_SIXTH
* src/itdb_device.c: split functions to get artwork format from the
ipod in 2 separate functions: instead of
itdb_device_get_artwork_formats we now have
itdb_device_get_photo_formats and itdb_device_get_cover_art_formats
* src/itdb_device.h:
* src/db-image-parser.c: use the separate
get_cover_art_formats/get_photos_formats functions
* src/db-artwork-writer.c: ditto
* src/ithumb-writer.c: ditto
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@2009 f01d2545-417e-4e96-918e-98f8d0dbbcb6
Diffstat (limited to 'src/db-artwork-writer.c')
-rw-r--r-- | src/db-artwork-writer.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/db-artwork-writer.c b/src/db-artwork-writer.c index 0794c16..24e1bbb 100644 --- a/src/db-artwork-writer.c +++ b/src/db-artwork-writer.c @@ -24,6 +24,7 @@ #include <config.h> #include "itdb.h" +#include "itdb_device.h" #include "itdb_private.h" #include "db-artwork-parser.h" @@ -779,7 +780,8 @@ write_mhlf (Itdb_DB *db, iPodBuffer *buffer) MhlfHeader *mhlf; unsigned int total_bytes; int bytes_written; - const Itdb_ArtworkFormat *formats; + GList *formats; + GList *it; unsigned int num_children; mhlf = (MhlfHeader *)init_header (buffer, "mhlf", sizeof (MhlfHeader)); @@ -791,23 +793,31 @@ write_mhlf (Itdb_DB *db, iPodBuffer *buffer) num_children = 0; mhlf->num_files = get_gint32 (num_children, buffer->byte_order); - formats = itdb_device_get_artwork_formats (db_get_device(db)); + formats = NULL; + switch (buffer->db_type) { + case DB_TYPE_ITUNES: + formats = itdb_device_get_cover_art_formats(db_get_device(db)); + break; + case DB_TYPE_PHOTO: + formats = itdb_device_get_photo_formats(db_get_device(db)); + break; + } if (formats == NULL) { return total_bytes; } - while (formats->type != -1) { + for (it = formats; it != NULL; it = it->next) { + const Itdb_ArtworkFormat *format; iPodBuffer *sub_buffer; - if (!itdb_thumb_type_is_valid_for_db (formats, buffer->db_type)) { - formats++; - continue; - } + + format = (const Itdb_ArtworkFormat *)it->data; sub_buffer = ipod_buffer_get_sub_buffer (buffer, total_bytes); if (sub_buffer == NULL) { + g_list_free (formats); return -1; } - bytes_written = write_mhif (db, sub_buffer, formats); + bytes_written = write_mhif (db, sub_buffer, format); ipod_buffer_destroy (sub_buffer); if (bytes_written == -1) { @@ -821,9 +831,9 @@ write_mhlf (Itdb_DB *db, iPodBuffer *buffer) * to get something somewhat consistent when there are errors */ mhlf->num_files = get_gint32 (num_children, buffer->byte_order); - formats++; } dump_mhl ((MhlHeader *)mhlf, "mhlf"); + g_list_free (formats); return total_bytes; } |