summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>2011-04-13 15:02:03 +0300
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>2011-04-13 15:02:03 +0300
commitcc4bff9b722eaaf9f3c4f57f1f992f694c7dbd44 (patch)
tree434af519600bdb6339e843c23f1336341fc9959b
parentd98727bb9a606d9f465058b692b2c3021bfa2b31 (diff)
downloadrygel-cc4bff9b722eaaf9f3c4f57f1f992f694c7dbd44.tar.gz
core: Throw error on item creation of wrong DLNA PN
Throw error 712 on creation of item of wrong DLNA profile to satisfy DLNA CTT testcase 7.3.134.3.
-rw-r--r--src/rygel/rygel-item-creator.vala24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/rygel/rygel-item-creator.vala b/src/rygel/rygel-item-creator.vala
index c53a7f38..f761377f 100644
--- a/src/rygel/rygel-item-creator.vala
+++ b/src/rygel/rygel-item-creator.vala
@@ -21,6 +21,7 @@
*/
using GUPnP;
+using Gst;
private errordomain Rygel.ItemCreatorError {
PARSE
@@ -83,6 +84,12 @@ internal class Rygel.ItemCreator: GLib.Object, Rygel.StateMachine {
if (info != null) {
if (info.dlna_profile != null) {
+ if (!this.is_profile_valid (info.dlna_profile)) {
+ throw new ContentDirectoryError.BAD_METADATA
+ ("'%s' DLNA profile unsupported",
+ info.dlna_profile);
+ }
+
this.item.dlna_profile = info.dlna_profile;
}
@@ -339,5 +346,22 @@ internal class Rygel.ItemCreator: GLib.Object, Rygel.StateMachine {
debug ("Finished waiting for new item to appear under container '%s'",
container.id);
}
+
+ private bool is_profile_valid (string profile) {
+ var discoverer = new GUPnP.DLNADiscoverer ((ClockTime) SECOND,
+ true,
+ false);
+
+ var valid = false;
+ foreach (var known_profile in discoverer.list_profiles ()) {
+ if (known_profile.name == profile) {
+ valid = true;
+
+ break;
+ }
+ }
+
+ return valid;
+ }
}