[libdmapsharing] Add hash to DMAP records



commit e70abfbe626396327c415e6c97bf4a4ebb93ee26
Author: W. Michael Petullo <mike flyn org>
Date:   Fri Jul 19 20:19:21 2013 -0400

    Add hash to DMAP records
    
    Signed-off-by: W. Michael Petullo <mike flyn org>

 libdmapsharing/daap-record.c |    7 +++++++
 libdmapsharing/dmap-md5.h    |    2 ++
 libdmapsharing/dmap-record.c |    2 +-
 libdmapsharing/dmap-record.h |   11 ++++++-----
 libdmapsharing/dpap-record.c |    7 +++++++
 5 files changed, 23 insertions(+), 6 deletions(-)
---
diff --git a/libdmapsharing/daap-record.c b/libdmapsharing/daap-record.c
index eafe0a4..8e9e3c0 100644
--- a/libdmapsharing/daap-record.c
+++ b/libdmapsharing/daap-record.c
@@ -40,6 +40,13 @@ daap_record_init (DAAPRecordIface * iface)
                                                      G_PARAM_READWRITE));
 
                g_object_interface_install_property (iface,
+                                                    g_param_spec_pointer
+                                                    ("hash",
+                                                     "Hash of media file contents",
+                                                     "Hash of media file contents",
+                                                     G_PARAM_READWRITE));
+
+               g_object_interface_install_property (iface,
                                                     g_param_spec_string
                                                     ("title", "Song title",
                                                      "Song title", "Unknown",
diff --git a/libdmapsharing/dmap-md5.h b/libdmapsharing/dmap-md5.h
index 2e7f660..dd6697c 100644
--- a/libdmapsharing/dmap-md5.h
+++ b/libdmapsharing/dmap-md5.h
@@ -23,6 +23,8 @@
 
 #include <glib.h>
 
+#define DMAP_HASH_SIZE 16
+
 G_BEGIN_DECLS
 
 typedef struct DMAPHashContext
diff --git a/libdmapsharing/dmap-record.c b/libdmapsharing/dmap-record.c
index 3df63f7..a9071d9 100644
--- a/libdmapsharing/dmap-record.c
+++ b/libdmapsharing/dmap-record.c
@@ -62,7 +62,7 @@ dmap_record_to_blob (DMAPRecord * record)
        return DMAP_RECORD_GET_INTERFACE (record)->to_blob (record);
 }
 
-DMAPRecord *
+gboolean
 dmap_record_set_from_blob (DMAPRecord * record, GByteArray * blob)
 {
        return DMAP_RECORD_GET_INTERFACE (record)->set_from_blob (record,
diff --git a/libdmapsharing/dmap-record.h b/libdmapsharing/dmap-record.h
index 21ab093..723ca1c 100644
--- a/libdmapsharing/dmap-record.h
+++ b/libdmapsharing/dmap-record.h
@@ -66,7 +66,7 @@ struct _DMAPRecordIface
        GTypeInterface parent;
 
        GByteArray *(*to_blob) (DMAPRecord * record);
-       DMAPRecord *(*set_from_blob) (DMAPRecord * record, GByteArray * blob);
+       gboolean   (*set_from_blob) (DMAPRecord * record, GByteArray * blob);
 };
 
 typedef unsigned long long bitwise;
@@ -91,12 +91,13 @@ GByteArray *dmap_record_to_blob (DMAPRecord * record);
 
 /**
  * dmap_record_from_blob:
- * @blob: A byte array representation of a record.
+ * @record: The record to set.
+ * @blob:   A byte array representation of a record.
  *
- * Returns: The record.
+ * Returns: True on success, else false.
  */
-DMAPRecord *dmap_record_set_from_blob (DMAPRecord * record,
-                                      GByteArray * blob);
+gboolean dmap_record_set_from_blob (DMAPRecord * record,
+                                    GByteArray * blob);
 
 #endif /* __DMAP_RECORD_H */
 
diff --git a/libdmapsharing/dpap-record.c b/libdmapsharing/dpap-record.c
index eefabc9..0cc75a3 100644
--- a/libdmapsharing/dpap-record.c
+++ b/libdmapsharing/dpap-record.c
@@ -39,6 +39,13 @@ dpap_record_init (DPAPRecordIface * iface)
                                                      NULL,
                                                      G_PARAM_READWRITE));
 
+               g_object_interface_install_property (iface,
+                                                    g_param_spec_pointer
+                                                    ("hash",
+                                                     "Hash of media file contents",
+                                                     "Hash of media file contents",
+                                                     G_PARAM_READWRITE));
+
                /* iTunes does not require to this to match the datatype for the image
                 * to be displayed (set to "JPEG" and served a PNG). I think this is
                 * for display to the user only.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]