summaryrefslogtreecommitdiffstats
path: root/src/db-artwork-parser.c
diff options
context:
space:
mode:
authorjcsjcs <jcsjcs@f01d2545-417e-4e96-918e-98f8d0dbbcb6>2006-10-29 10:37:47 +0000
committerjcsjcs <jcsjcs@f01d2545-417e-4e96-918e-98f8d0dbbcb6>2006-10-29 10:37:47 +0000
commit030e4791ad48e020b3932b2fbe53ea89ec86e43c (patch)
tree2ae5e3895a3664053972b55ff71f5fbf06f12a35 /src/db-artwork-parser.c
parent5e1e731fa6df438b344643f0d8e9ead58526f480 (diff)
downloadlibgpod-030e4791ad48e020b3932b2fbe53ea89ec86e43c.tar.gz
libgpod-030e4791ad48e020b3932b2fbe53ea89ec86e43c.tar.xz
libgpod-030e4791ad48e020b3932b2fbe53ea89ec86e43c.zip
Added additional functionality for photo albums
* src/db-artwork-parser.c src/db-artwork-writer.c src/db-itunes-parser.c: src/itdb.h: added additional fields to MhbaHeader and Itdb_PhotoAlbum (playmusic, repeat, random, show_titles, transition_direction, slide duration, transition_duration, unk024, unk028, unk044, unk048, song_id. These fields are read and written from the PhotoDB now. Also corrected error for "album type" which was read and written as int32 even though it was a int8. Removed num_images from Itdb_PhotoAlbum -- instead count images at time of writing. git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1330 f01d2545-417e-4e96-918e-98f8d0dbbcb6
Diffstat (limited to 'src/db-artwork-parser.c')
-rw-r--r--src/db-artwork-parser.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/src/db-artwork-parser.c b/src/db-artwork-parser.c
index 51d81fa..88de265 100644
--- a/src/db-artwork-parser.c
+++ b/src/db-artwork-parser.c
@@ -386,7 +386,7 @@ parse_mhba (DBParseContext *ctx, GError *error)
ArtworkDB_MhodHeader *mhod;
DBParseContext *mhod_ctx;
DBParseContext *mhia_ctx;
- Itdb_PhotoAlbum *photo_album;
+ Itdb_PhotoAlbum *album;
Itdb_PhotoDB *photodb;
int num_children;
off_t cur_offset;
@@ -399,11 +399,25 @@ parse_mhba (DBParseContext *ctx, GError *error)
dump_mhba (mhba);
- photo_album = g_new0 (Itdb_PhotoAlbum, 1);
- photo_album->num_images = get_gint32( mhba->num_mhias, ctx->byte_order);
- photo_album->album_id = get_gint32( mhba->playlist_id, ctx->byte_order);
- photo_album->album_type = get_gint32( mhba->album_type, ctx->byte_order);
- photo_album->prev_album_id = get_gint32( mhba->prev_playlist_id, ctx->byte_order);
+ album = g_new0 (Itdb_PhotoAlbum, 1);
+ album->album_id = get_gint32(mhba->album_id, ctx->byte_order);
+ album->unk024 = get_gint32(mhba->unk024, ctx->byte_order);
+ album->unk028 = get_gint16(mhba->unk028, ctx->byte_order);
+ album->album_type = mhba->album_type;
+ album->playmusic = mhba->playmusic;
+ album->repeat = mhba->repeat;
+ album->random = mhba->random;
+ album->show_titles = mhba->show_titles;
+ album->transition_direction = mhba->transition_direction;
+ album->slide_duration = get_gint32(mhba->slide_duration,
+ ctx->byte_order);
+ album->transition_duration = get_gint32(mhba->transition_duration,
+ ctx->byte_order);
+ album->unk044 = get_gint32(mhba->unk044, ctx->byte_order);
+ album->unk048 = get_gint32(mhba->unk048, ctx->byte_order);
+ album->song_id = get_gint64(mhba->song_id, ctx->byte_order);
+ album->prev_album_id = get_gint32(mhba->prev_album_id,
+ ctx->byte_order);
cur_offset = ctx->header_len;
mhod_ctx = db_parse_context_get_sub_context (ctx, cur_offset);
@@ -415,7 +429,7 @@ parse_mhba (DBParseContext *ctx, GError *error)
return -1;
}
db_parse_context_set_total_len (mhod_ctx, get_gint32(mhod->total_len, ctx->byte_order));
- photo_album->name = g_strdup( (char *)((MhodHeaderArtworkType1*)mhod)->string );
+ album->name = g_strdup( (char *)((MhodHeaderArtworkType1*)mhod)->string );
cur_offset += mhod_ctx->total_len;
dump_mhod_type_1 ((MhodHeaderArtworkType1*)mhod);
g_free (mhod_ctx);
@@ -425,7 +439,7 @@ parse_mhba (DBParseContext *ctx, GError *error)
mhia_ctx = db_parse_context_get_sub_context (ctx, cur_offset);
num_children = get_gint32 (mhba->num_mhias, ctx->byte_order);
while ((num_children > 0) && (mhia_ctx != NULL)) {
- parse_mhia (mhia_ctx, photo_album, NULL);
+ parse_mhia (mhia_ctx, album, NULL);
num_children--;
cur_offset += mhia_ctx->total_len;
g_free (mhia_ctx);
@@ -434,7 +448,7 @@ parse_mhba (DBParseContext *ctx, GError *error)
photodb = db_get_photodb (ctx->db);
g_return_val_if_fail (photodb, -1);
photodb->photoalbums = g_list_append (photodb->photoalbums,
- photo_album);
+ album);
return 0;
}