[gupnp-av/wip/didl-s: 1/4] Add child item on container in DIDLWriter



commit fbc8a2fbd302ed05fbeedeccbe3e78974c8410a3
Author: Jens Georg <mail jensge org>
Date:   Tue Oct 30 19:41:53 2012 +0100

    Add child item on container in DIDLWriter

 libgupnp-av/gupnp-didl-lite-writer.c |   38 ++++++++++++++++++++++++++++++++++
 libgupnp-av/gupnp-didl-lite-writer.h |    5 ++++
 2 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/libgupnp-av/gupnp-didl-lite-writer.c b/libgupnp-av/gupnp-didl-lite-writer.c
index e4dcaef..5f7812d 100644
--- a/libgupnp-av/gupnp-didl-lite-writer.c
+++ b/libgupnp-av/gupnp-didl-lite-writer.c
@@ -483,6 +483,44 @@ gupnp_didl_lite_writer_add_item (GUPnPDIDLLiteWriter *writer)
 }
 
 /**
+ * gupnp_didl_lite_writer_add_container_child_item:
+ * @writer: #GUPnPDIDLLiteWriter
+ * @container: #GUPnPDIDLLiteContainer
+ *
+ * Add a child item to a container. This is only useful in DIDL_S playlist
+ * creation.
+ *
+ * Return: (transfer full): A new #GUPnPDIDLLiteItem object. Unref after
+ * usage.
+ **/
+GUPnPDIDLLiteItem *
+gupnp_didl_lite_writer_add_container_child_item
+                                        (GUPnPDIDLLiteWriter    *writer,
+                                         GUPnPDIDLLiteContainer *container)
+{
+        xmlNode *item_node, *container_node;
+        GUPnPDIDLLiteObject *object;
+        GUPnPXMLDoc *doc;
+
+        g_return_val_if_fail (GUPNP_IS_DIDL_LITE_CONTAINER (container), NULL);
+
+        object = GUPNP_DIDL_LITE_OBJECT (container);
+        container_node = gupnp_didl_lite_object_get_xml_node (object);
+
+        item_node = xmlNewChild (container_node,
+                                 NULL,
+                                 (xmlChar *) "item",
+                                 NULL);
+
+        object = gupnp_didl_lite_object_new_from_xml (item_node,
+                                                      writer->priv->xml_doc,
+                                                      writer->priv->upnp_ns,
+                                                      writer->priv->dc_ns,
+                                                      writer->priv->dlna_ns);
+        return GUPNP_DIDL_LITE_ITEM (object);
+}
+
+/**
  * gupnp_didl_lite_writer_add_container:
  * @writer: A #GUPnPDIDLLiteWriter
  *
diff --git a/libgupnp-av/gupnp-didl-lite-writer.h b/libgupnp-av/gupnp-didl-lite-writer.h
index 33da37f..123ead8 100644
--- a/libgupnp-av/gupnp-didl-lite-writer.h
+++ b/libgupnp-av/gupnp-didl-lite-writer.h
@@ -90,6 +90,11 @@ gupnp_didl_lite_writer_add_item         (GUPnPDIDLLiteWriter *writer);
 GUPnPDIDLLiteContainer *
 gupnp_didl_lite_writer_add_container    (GUPnPDIDLLiteWriter *writer);
 
+GUPnPDIDLLiteItem *
+gupnp_didl_lite_writer_add_container_child_item
+                                        (GUPnPDIDLLiteWriter    *writer,
+                                         GUPnPDIDLLiteContainer *container);
+
 GUPnPDIDLLiteDescriptor *
 gupnp_didl_lite_writer_add_descriptor   (GUPnPDIDLLiteWriter *writer);
 



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