summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Georg <mail@jensge.org>2012-12-05 10:40:23 +0100
committerJens Georg <mail@jensge.org>2012-12-05 10:40:23 +0100
commitb4209e8457a4061086d73ec0e4cfa23553aee6a3 (patch)
treeddb36367da209f7ca077996f01b2f0f64284c289
parente3130a0156a7ee72a6d9dca3225cfb74003c6cf7 (diff)
downloadgupnp-av-b4209e8457a4061086d73ec0e4cfa23553aee6a3.tar.gz
Set items to 'restricted' in MediaCollection
-rw-r--r--libgupnp-av/gupnp-media-collection.c7
-rw-r--r--tests/gtest/test-media-collection.c18
2 files changed, 16 insertions, 9 deletions
diff --git a/libgupnp-av/gupnp-media-collection.c b/libgupnp-av/gupnp-media-collection.c
index 03feb28..e04931e 100644
--- a/libgupnp-av/gupnp-media-collection.c
+++ b/libgupnp-av/gupnp-media-collection.c
@@ -522,6 +522,13 @@ gupnp_media_collection_add_item (GUPnPMediaCollection *collection)
collection->priv->items = g_list_prepend (collection->priv->items,
g_object_ref (item));
+ /* Mandatory in DLNA for object. Not specified if mandatory for
+ * DIDL_S, but to avoid problems with clients reusing their normal
+ * DIDL-Lite parser, we set it here if the application doesn't.
+ */
+ gupnp_didl_lite_object_set_restricted (GUPNP_DIDL_LITE_OBJECT (item),
+ TRUE);
+
return item;
}
diff --git a/tests/gtest/test-media-collection.c b/tests/gtest/test-media-collection.c
index 75daf17..0979f0e 100644
--- a/tests/gtest/test-media-collection.c
+++ b/tests/gtest/test-media-collection.c
@@ -91,17 +91,17 @@
"xmlns:upnp=\"urn:schemas-upnp-org:metadata-1-0/upnp/\" " \
"xmlns:dlna=\"urn:schemas-dlna-org:metadata-1-0/\" " \
"xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\">" \
- "<item>" \
+ "<item restricted=\"1\">" \
"<dc:title>Song1</dc:title>" \
"<upnp:class>object.item.audioItem</upnp:class>" \
"<res>http://example.com/song1.mp3</res>" \
"</item>" \
- "<item>" \
+ "<item restricted=\"1\">" \
"<dc:title>Song2</dc:title>" \
"<upnp:class>object.item.audioItem</upnp:class>" \
"<res>http://example.com/song2.mp3</res>" \
"</item>" \
- "<item>" \
+ "<item restricted=\"1\">" \
"<dc:title>Song3</dc:title>" \
"<upnp:class>object.item.audioItem</upnp:class>" \
"<res>http://example.com/song3.mp3</res>" \
@@ -117,17 +117,17 @@
"<container>" \
"<dc:title>TestCollection1</dc:title>" \
"<dc:creator>TestCollection1Author</dc:creator>" \
- "<item>" \
+ "<item restricted=\"1\">" \
"<dc:title>Song1</dc:title>" \
"<upnp:class>object.item.audioItem</upnp:class>" \
"<res>http://example.com/song1.mp3</res>" \
"</item>" \
- "<item>" \
+ "<item restricted=\"1\">" \
"<dc:title>Song2</dc:title>" \
"<upnp:class>object.item.audioItem</upnp:class>" \
"<res>http://example.com/song2.mp3</res>" \
"</item>" \
- "<item>" \
+ "<item restricted=\"1\">" \
"<dc:title>Song3</dc:title>" \
"<upnp:class>object.item.audioItem</upnp:class>" \
"<res>http://example.com/song3.mp3</res>" \
@@ -142,17 +142,17 @@
"xmlns:dlna=\"urn:schemas-dlna-org:metadata-1-0/\" " \
"xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\">" \
"<container>" \
- "<item>" \
+ "<item restricted=\"1\">" \
"<dc:title>Song1</dc:title>" \
"<upnp:class>object.item.audioItem</upnp:class>" \
"<res>http://example.com/song1.mp3</res>" \
"</item>" \
- "<item>" \
+ "<item restricted=\"1\">" \
"<dc:title>Song2</dc:title>" \
"<upnp:class>object.item.audioItem</upnp:class>" \
"<res>http://example.com/song2.mp3</res>" \
"</item>" \
- "<item>" \
+ "<item restricted=\"1\">" \
"<dc:title>Song3</dc:title>" \
"<upnp:class>object.item.audioItem</upnp:class>" \
"<res>http://example.com/song3.mp3</res>" \