commit 7a46bca77d4d1ac3c002eea1a09478aed0b070fb
Author: Joel Smith <[email protected]>
Date: Fri Sep 3 18:58:45 2010 -0600
add itdb_chapterdata_build_chapter_blob
src/itdb_itunesdb.c | 30 ++++++++++++++++++++++++++++++
src/itdb_private.h | 4 ++++
2 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/src/itdb_itunesdb.c b/src/itdb_itunesdb.c
index 4968345..84dd090 100644
--- a/src/itdb_itunesdb.c
+++ b/src/itdb_itunesdb.c
@@ -117,6 +117,7 @@
#include <glib-object.h>
#include <glib/gi18n-lib.h>
#include <glib/gstdio.h>
+#include <glib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
@@ -7901,6 +7902,35 @@ gboolean itdb_init_ipod (const gchar *mountpoint,
return TRUE;
}
+/**
+ * itdb_chapterdata_build_chapter_blob:
+ * @chapterdata: Itdb_Chapterdata pointer of chapter data to be encoded
+ *
+ * Creates an iTunesDB binary blob of chapter data from @chapterdata.
+ *
+ * NOTE: Caller must call g_byte_array_free(chapter_blob, TRUE) on the
+ * returned chapter_blob
+ *
+ * Returns: a binary itdb blob of chapter data (to be freed by the caller)
+ *
+ * Since: 0.7.95
+ */
+G_GNUC_INTERNAL GByteArray
*itdb_chapterdata_build_chapter_blob(Itdb_Chapterdata *chapterdata, gboolean
reversed)
+{
+ WContents *cts;
+ GByteArray * chapter_blob = NULL;
+
+ cts = wcontents_new("");
+ cts->reversed = reversed;
+ cts->pos = 0;
+
+ itdb_chapterdata_build_chapter_blob_internal (cts, chapterdata);
+
+ chapter_blob = g_byte_array_sized_new(cts->pos);
+ g_byte_array_append(chapter_blob, (guint8 *)cts->contents, cts->pos);
+ wcontents_free(cts);
+ return chapter_blob;
+}
/*------------------------------------------------------------------*\
diff --git a/src/itdb_private.h b/src/itdb_private.h
index 501d07b..d2e6744 100644
--- a/src/itdb_private.h
+++ b/src/itdb_private.h
@@ -241,6 +241,10 @@ G_GNUC_INTERNAL gboolean itdb_hash58_write_hash
(Itdb_Device *device,
G_GNUC_INTERNAL gboolean itdb_hash72_compute_hash_for_sha1 (const Itdb_Device
*device,
const guchar
sha1[20],
guchar
signature[46]);
+
+G_GNUC_INTERNAL GByteArray
*itdb_chapterdata_build_chapter_blob(Itdb_Chapterdata *chapterdata,
+ gboolean
reversed);
+
#ifdef HAVE_LIBIMOBILEDEVICE
G_GNUC_INTERNAL int itdb_iphone_start_sync(Itdb_Device *device, void
**prepdata);
G_GNUC_INTERNAL int itdb_iphone_stop_sync(void *sync_ctx);
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2