[rygel] core: Apply browse filter to 'res' attributes
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Subject: [rygel] core: Apply browse filter to 'res' attributes
- Date: Tue, 23 Jun 2009 11:33:38 -0400 (EDT)
commit ba99e25b9f1e0e550ffd7d8025f6327fc877f093
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Tue Jun 23 16:47:40 2009 +0300
core: Apply browse filter to 'res' attributes
src/rygel/rygel-didl-lite-writer.vala | 44 +++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/src/rygel/rygel-didl-lite-writer.vala b/src/rygel/rygel-didl-lite-writer.vala
index 926a1da..9487f29 100644
--- a/src/rygel/rygel-didl-lite-writer.vala
+++ b/src/rygel/rygel-didl-lite-writer.vala
@@ -111,6 +111,7 @@ internal class Rygel.DIDLLiteWriter : GUPnP.DIDLLiteWriter {
this.http_server.add_resources (resources, item);
foreach (DIDLLiteResource res in resources) {
+ filter.adjust_resource (ref res);
this.add_res (res);
}
}
@@ -179,6 +180,49 @@ private class Rygel.BrowseFilter : ArrayList<string> {
}
}
+ public void adjust_resource (ref DIDLLiteResource res) {
+ // Unset all optional props that are not requested
+ if (!this.have ("res importUri", null)) {
+ res.import_uri = null;
+ }
+
+ if (!this.have ("res protection", null)) {
+ res.protection = null;
+ }
+
+ if (!this.have ("res size", null)) {
+ res.size = -1;
+ }
+
+ if (!this.have ("res duration", null)) {
+ res.duration = -1;
+ }
+
+ if (!this.have ("res bitrate", null)) {
+ res.bitrate = -1;
+ }
+
+ if (!this.have ("res bitsPerSample", null)) {
+ res.bits_per_sample = -1;
+ }
+
+ if (!this.have ("res sampleFrequency", null)) {
+ res.sample_freq = -1;
+ }
+
+ if (!this.have ("res nrAudioChannels", null)) {
+ res.n_audio_channels = -1;
+ }
+
+ if (!this.have ("res colorDepth", null)) {
+ res.color_depth = -1;
+ }
+
+ if (!this.have ("res resolution", null)) {
+ res.width = res.height = -1;
+ }
+ }
+
private static bool filter_equal_func (string a, string b) {
return a == "*" || a == b || a.has_prefix (b + "@");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]