Commit 71e46f7d authored by Jens Georg's avatar Jens Georg

Add child item on container in DIDLWriter

parent ff94d599
......@@ -61,6 +61,7 @@ libgupnp_av_1_0_la_SOURCES = gupnp-didl-lite-object.c \
gupnp-didl-lite-contributor.c \
gupnp-didl-lite-contributor-private.h \
gupnp-didl-lite-writer.c \
gupnp-didl-lite-writer-private.h \
gupnp-protocol-info.c \
gupnp-search-criteria-parser.c \
gupnp-last-change-parser.c \
......
/*
* Copyright (C) 2012 Intel Corporation.
*
* Authors: Jens Georg <jensg@openismus.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GUPNP_DIDL_LITE_WRITER_PRIVATE_H__
#define __GUPNP_DIDL_LITE_WRITER_PRIVATE_H__
#include "gupnp-didl-lite-writer.h"
#include "gupnp-didl-lite-container.h"
G_BEGIN_DECLS
G_GNUC_INTERNAL GUPnPDIDLLiteItem *
gupnp_didl_lite_writer_add_container_child_item
(GUPnPDIDLLiteWriter *writer,
GUPnPDIDLLiteContainer *container);
G_END_DECLS
#endif /* __GUPNP_DIDL_LITE_WRITER_PRIVATE_H__ */
/*
* Copyright (C) 2007, 2008 OpenedHand Ltd.
* Copyright (C) 2012 Intel Corporation.
*
* Authors: Jorn Baayen <jorn@openedhand.com>
* Jens Georg <jensg@openismus.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -32,6 +34,7 @@
#include "gupnp-didl-lite-object.h"
#include "gupnp-didl-lite-object-private.h"
#include "gupnp-didl-lite-descriptor-private.h"
#include "gupnp-didl-lite-writer-private.h"
#include "xml-util.h"
......@@ -490,6 +493,44 @@ gupnp_didl_lite_writer_add_item (GUPnPDIDLLiteWriter *writer)
return GUPNP_DIDL_LITE_ITEM (object);
}
/**
* 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.
*
* Returns: (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
......
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