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/itdb.h | |
parent | 747eda0937e4bf51a586183d99a326b75ebf6a78 (diff) | |
download | libgpod-37e1533b203557602942eea32cc9f2397004023c.tar.gz libgpod-37e1533b203557602942eea32cc9f2397004023c.tar.xz libgpod-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/itdb.h')
-rw-r--r-- | src/itdb.h | 75 |
1 files changed, 20 insertions, 55 deletions
@@ -57,6 +57,7 @@ typedef gpointer (* ItdbUserDataDuplicateFunc) (gpointer userdata); typedef struct _Itdb_Device Itdb_Device; typedef struct _Itdb_IpodInfo Itdb_IpodInfo; typedef struct _Itdb_Artwork Itdb_Artwork; +typedef struct _Itdb_ArtworkFormat Itdb_ArtworkFormat; typedef struct _Itdb_Thumb Itdb_Thumb; typedef struct _Itdb_SPLPref Itdb_SPLPref; typedef struct _Itdb_SPLRule Itdb_SPLRule; @@ -494,51 +495,19 @@ typedef enum { ITDB_THUMB_CHAPTER_LARGE, /* classic -- not supported yet */ } ItdbThumbType; - -/* The Itdb_Thumb structure can represent two slightly different - thumbnails: - - a) a thumbnail before it's transferred to the iPod. - - offset and size are 0 - - width and height, if unequal 0, will indicate the size on the - iPod. width and height are set the first time a pixbuf is - requested for this thumbnail. - - type is set according to the type this thumbnail represents - - filename point to a 'real' image file OR image_data and - image_data_len are set. - - b) a thumbnail (big or small) stored on a database in the iPod. In - these cases, id corresponds to the ID originally used in the - database, filename points to a .ithmb file on the iPod - */ -struct _Itdb_Thumb { - ItdbThumbType type; - gchar *filename; - guchar *image_data; /* holds the thumbnail data of - non-transfered thumbnails when - filename == NULL */ - gsize image_data_len; /* length of data */ - gpointer pixbuf; - gint rotation; /* angle (0, 90, 180, 270) to rotate the image */ - guint32 offset; - guint32 size; - gint16 width; - gint16 height; - gint16 horizontal_padding; - gint16 vertical_padding; - /* reserved for future use */ - gint32 reserved_int1; - gint32 reserved_int2; - gpointer reserved1; - gpointer reserved2; +enum _ItdbThumbDataType { + ITDB_THUMB_TYPE_INVALID, + ITDB_THUMB_TYPE_FILE, + ITDB_THUMB_TYPE_MEMORY, + ITDB_THUMB_TYPE_PIXBUF, + ITDB_THUMB_TYPE_IPOD }; +typedef enum _ItdbThumbDataType ItdbThumbDataType; + + struct _Itdb_Artwork { - GList *thumbnails; /* list of Itdb_Thumbs */ + Itdb_Thumb *thumbnail; guint32 id; /* Artwork id used by photoalbums, starts at * 0x40... libgpod will set this on sync. */ guint64 dbid; /* dbid of associated track. used @@ -1190,8 +1159,9 @@ gboolean itdb_track_set_thumbnails_from_data (Itdb_Track *track, gsize image_data_len); gboolean itdb_track_set_thumbnails_from_pixbuf (Itdb_Track *track, gpointer pixbuf); - +gboolean itdb_track_has_thumbnails (Itdb_Track *track); void itdb_track_remove_thumbnails (Itdb_Track *track); +gpointer itdb_track_get_thumbnail (Itdb_Track *track, gint width, gint height); /* photoalbum functions -- see itdb_photoalbum.c for instructions on * how to use. */ @@ -1237,25 +1207,21 @@ Itdb_PhotoAlbum *itdb_photodb_photoalbum_by_name(Itdb_PhotoDB *db, Itdb_Artwork *itdb_artwork_new (void); Itdb_Artwork *itdb_artwork_duplicate (Itdb_Artwork *artwork); void itdb_artwork_free (Itdb_Artwork *artwork); -Itdb_Thumb *itdb_artwork_get_thumb_by_type (Itdb_Artwork *artwork, - ItdbThumbType type); -gboolean itdb_artwork_add_thumbnail (Itdb_Artwork *artwork, - ItdbThumbType type, +gboolean itdb_artwork_set_thumbnail (Itdb_Artwork *artwork, const gchar *filename, gint rotation, GError **error); -gboolean itdb_artwork_add_thumbnail_from_data (Itdb_Artwork *artwork, - ItdbThumbType type, +gboolean itdb_artwork_set_thumbnail_from_data (Itdb_Artwork *artwork, const guchar *image_data, gsize image_data_len, gint rotation, GError **error); -gboolean itdb_artwork_add_thumbnail_from_pixbuf (Itdb_Artwork *artwork, - ItdbThumbType type, +gboolean itdb_artwork_set_thumbnail_from_pixbuf (Itdb_Artwork *artwork, gpointer pixbuf, gint rotation, GError **error); -void itdb_artwork_remove_thumbnail (Itdb_Artwork *artwork, - Itdb_Thumb *thumb); void itdb_artwork_remove_thumbnails (Itdb_Artwork *artwork); +gpointer itdb_artwork_get_pixbuf (Itdb_Device *device, Itdb_Artwork *artwork, + gint width, gint height); + /* itdb_thumb_... */ /* the following function returns a pointer to a GdkPixbuf if gdk-pixbuf is installed -- a NULL pointer otherwise. */ @@ -1263,8 +1229,7 @@ gpointer itdb_thumb_get_gdk_pixbuf (Itdb_Device *device, Itdb_Thumb *thumb); Itdb_Thumb *itdb_thumb_duplicate (Itdb_Thumb *thumb); void itdb_thumb_free (Itdb_Thumb *thumb); -Itdb_Thumb *itdb_thumb_new (void); -gchar *itdb_thumb_get_filename (Itdb_Device *device, Itdb_Thumb *thumb); + /* itdb_chapterdata_... */ Itdb_Chapterdata *itdb_chapterdata_new (void); void itdb_chapterdata_free (Itdb_Chapterdata *chapterdata); |