[rygel] core: Put BrowseFilter class in separate file



commit 1f0395cc99aa2c93a6727a5a4ab830d71fe1d391
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue Jun 23 18:09:42 2009 +0300

    core: Put BrowseFilter class in separate file

 src/rygel/Makefile.am                 |    3 +
 src/rygel/rygel-browse-filter.vala    |   93 +++++++++++++++++++++++++++++++++
 src/rygel/rygel-didl-lite-writer.vala |   68 ------------------------
 3 files changed, 96 insertions(+), 68 deletions(-)
---
diff --git a/src/rygel/Makefile.am b/src/rygel/Makefile.am
index 9cb4950..9b23105 100644
--- a/src/rygel/Makefile.am
+++ b/src/rygel/Makefile.am
@@ -44,6 +44,7 @@ BUILT_SOURCES = rygel-1.0.vapi \
 		rygel-content-directory.c \
 		rygel-browse.c \
 		rygel-didl-lite-writer.c \
+		rygel-browse-filter.c \
 		rygel-plugin.c \
 		rygel-plugin-loader.c \
 		rygel-transcode-manager.c \
@@ -83,6 +84,7 @@ rygel_SOURCES = $(VAPI_SOURCE_FILES) \
 		rygel-content-directory.c \
 		rygel-browse.c \
 		rygel-didl-lite-writer.c \
+		rygel-browse-filter.c \
 		rygel-plugin.c \
 		rygel-plugin-loader.c \
 		rygel-transcode-manager.c \
@@ -152,6 +154,7 @@ VAPI_SOURCE_FILES = rygel-configuration.vala \
 		    rygel-media-item.vala \
 		    rygel-browse.vala \
 		    rygel-didl-lite-writer.vala \
+		    rygel-browse-filter.vala \
 		    rygel-transcoder.vala \
 		    rygel-mp2ts-transcoder.vala \
 		    rygel-mp3-transcoder.vala \
diff --git a/src/rygel/rygel-browse-filter.vala b/src/rygel/rygel-browse-filter.vala
new file mode 100644
index 0000000..281978b
--- /dev/null
+++ b/src/rygel/rygel-browse-filter.vala
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2009 Nokia Corporation.
+ *
+ * Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
+ *                               <zeeshan ali nokia com>
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+using GUPnP;
+using Gee;
+
+internal class Rygel.BrowseFilter : ArrayList<string> {
+    public BrowseFilter (string filter_str) {
+        base ((GLib.EqualFunc) BrowseFilter.filter_equal_func);
+
+        var tokens = filter_str.split (",", -1);
+
+        foreach (var token in tokens) {
+            this.add (token);
+        }
+    }
+
+    public bool have (string prop, string? prefix) {
+        if (prefix != null) {
+            return (prefix + ":" + prop) in this;
+        } else {
+            return (prop in this);
+        }
+    }
+
+    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 + "@");
+    }
+}
+
diff --git a/src/rygel/rygel-didl-lite-writer.vala b/src/rygel/rygel-didl-lite-writer.vala
index 9487f29..ba368e5 100644
--- a/src/rygel/rygel-didl-lite-writer.vala
+++ b/src/rygel/rygel-didl-lite-writer.vala
@@ -160,71 +160,3 @@ internal class Rygel.DIDLLiteWriter : GUPnP.DIDLLiteWriter {
         return resources;
     }
 }
-
-private class Rygel.BrowseFilter : ArrayList<string> {
-    public BrowseFilter (string filter_str) {
-        base ((GLib.EqualFunc) BrowseFilter.filter_equal_func);
-
-        var tokens = filter_str.split (",", -1);
-
-        foreach (var token in tokens) {
-            this.add (token);
-        }
-    }
-
-    public bool have (string prop, string? prefix) {
-        if (prefix != null) {
-            return (prefix + ":" + prop) in this;
-        } else {
-            return (prop in this);
-        }
-    }
-
-    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]