Commit f6900fff authored by W. Michael Petullo's avatar W. Michael Petullo

Extend API to support dmapd work

Add new to_blob/new_from_blob interface to D[AP]PRecord and modify
DMAPShare's finalize code.
Signed-off-by: W. Michael Petullo's avatarW. Michael Petullo <mike@flyn.org>
parent 51761a02
22 May 2010 W. Michael Petullo <mike@flyn.org>
* Add new to_blob/new_from_blob interface to D[AP]PRecord.
20 May 2010 W. Michael Petullo <mike@flyn.org>
* Fix finalize code for DMAPShare.
18 May 2010 W. Michael Petullo <mike@flyn.org>
* Add another case to dpap-share.c:build_filter() in an attempt
......
......@@ -214,3 +214,15 @@ daap_record_read (DAAPRecord *record, GError **err)
{
return DAAP_RECORD_GET_INTERFACE (record)->read (record, err);
}
GByteArray *
daap_record_to_blob (DAAPRecord *record)
{
return DAAP_RECORD_GET_INTERFACE (record)->to_blob (record);
}
DAAPRecord *
daap_record_new_from_blob (DAAPRecord *record, GByteArray *blob)
{
return DAAP_RECORD_GET_INTERFACE (record)->new_from_blob (record, blob);
}
......@@ -71,6 +71,8 @@ struct _DAAPRecordInterface {
gboolean (*itunes_compat) (DAAPRecord *record);
GInputStream * (*read) (DAAPRecord *record, GError **err);
GByteArray * (*to_blob) (DAAPRecord *record);
DAAPRecord * (*new_from_blob) (DAAPRecord *record, GByteArray *blob);
};
GType daap_record_get_type (void);
......@@ -93,6 +95,22 @@ gboolean daap_record_itunes_compat (DAAPRecord *record);
*/
GInputStream *daap_record_read (DAAPRecord *record, GError **err);
/**
* daap_record_to_blob:
* @record: a DAAPRecord.
*
* Returns: A serialized representation of the record.
*/
GByteArray *daap_record_to_blob (DAAPRecord *record);
/**
* daap_record_new_from_blob:
* @blob: a serialized DAAPRecord representation.
*
* Returns: A DAAPRecord.
*/
DAAPRecord *daap_record_new_from_blob (DAAPRecord *record, GByteArray *blob);
#endif /* __DAAP_RECORD_H */
G_END_DECLS
......@@ -454,10 +454,12 @@ _dmap_share_get_property (GObject *object,
}
static void
_dmap_share_dispose (GObject *object)
_dmap_share_finalize (GObject *object)
{
DMAPShare *share = DMAP_SHARE (object);
g_debug ("Finalizing DMAPShare");
if (share->priv->published) {
_dmap_share_publish_stop (share);
}
......@@ -472,7 +474,7 @@ _dmap_share_dispose (GObject *object)
g_object_unref (share->priv->publisher);
}
G_OBJECT_CLASS (dmap_share_parent_class)->dispose (object);
G_OBJECT_CLASS (dmap_share_parent_class)->finalize (object);
}
static void
......@@ -482,7 +484,7 @@ dmap_share_class_init (DMAPShareClass *klass)
object_class->get_property = _dmap_share_get_property;
object_class->set_property = _dmap_share_set_property;
object_class->dispose = _dmap_share_dispose;
object_class->finalize = _dmap_share_finalize;
/* Pure virtual methods: */
klass->get_desired_port = NULL;
......
......@@ -165,3 +165,15 @@ dpap_record_read (DPAPRecord *record, GError **err)
{
return DPAP_RECORD_GET_INTERFACE (record)->read (record, err);
}
GByteArray *
dpap_record_to_blob (DPAPRecord *record)
{
return DPAP_RECORD_GET_INTERFACE (record)->to_blob (record);
}
DPAPRecord *
dpap_record_new_from_blob (DPAPRecord *record, GByteArray *blob)
{
return DPAP_RECORD_GET_INTERFACE (record)->new_from_blob (record, blob);
}
......@@ -69,7 +69,9 @@ typedef struct _DPAPRecordInterface DPAPRecordInterface;
struct _DPAPRecordInterface {
GTypeInterface parent;
GInputStream * (*read) (DPAPRecord *record, GError **err);
GInputStream * (*read) (DPAPRecord *record, GError **err);
GByteArray * (*to_blob) (DPAPRecord *record);
DPAPRecord * (*new_from_blob) (DPAPRecord *record, GByteArray *blob);
};
GType dpap_record_get_type (void);
......@@ -84,6 +86,22 @@ GType dpap_record_get_type (void);
*/
GInputStream *dpap_record_read (DPAPRecord *record, GError **err);
/**
* dpap_record_to_blob:
* @record: a DPAPRecord.
*
* Returns: A serialized representation of the record.
*/
GByteArray *dpap_record_to_blob (DPAPRecord *record);
/**
* dpap_record_new_from_blob:
* @blob: a serialized DPAPRecord representation.
*
* Returns: A DPAPRecord.
*/
DPAPRecord *dpap_record_new_from_blob (DPAPRecord *record, GByteArray *blob);
#endif /* __DPAP_RECORD_H */
G_END_DECLS
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment