idxset: Add pa_idxset_filtered_copy function to copy existing idxset with a condition 90/116090/3 accepted/tizen/3.0/common/20170302.075638 accepted/tizen/3.0/ivi/20170302.034030 accepted/tizen/3.0/mobile/20170302.033903 accepted/tizen/3.0/tv/20170302.033950 accepted/tizen/3.0/wearable/20170302.034010 submit/tizen_3.0/20170223.055304 submit/tizen_3.0/20170228.000412
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 23 Feb 2017 02:01:08 +0000 (11:01 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Thu, 23 Feb 2017 04:31:54 +0000 (13:31 +0900)
[Version] 5.0-109
[Profile] Common
[Issue Type] New function

Change-Id: I31adcc84aaaca5ea29f35e3c7f194dd6399746f7
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/pulseaudio.spec
src/pulsecore/idxset.c
src/pulsecore/idxset.h

index 562c864..3e1275a 100644 (file)
@@ -11,7 +11,7 @@
 Name:             pulseaudio
 Summary:          Improved Linux sound server
 Version:          5.0
-Release:          108
+Release:          109
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
 URL:              http://pulseaudio.org
index eec73c6..ab2b6b8 100644 (file)
@@ -471,3 +471,24 @@ pa_idxset *pa_idxset_copy(pa_idxset *s, pa_copy_func_t copy_func) {
 
     return copy;
 }
+
+#ifdef __TIZEN__
+pa_idxset *pa_idxset_filtered_copy(pa_idxset *s, pa_copy_func_t copy_func, pa_compare_func_t filter_func, const void *filter) {
+    pa_idxset *copy;
+    struct idxset_entry *i;
+
+    pa_assert(s);
+
+    copy = pa_idxset_new(s->hash_func, s->compare_func);
+
+    for (i = s->iterate_list_head; i; i = i->iterate_next) {
+        if (filter_func) {
+            if (filter_func(i->data, filter))
+                pa_idxset_put(copy, copy_func ? copy_func(i->data) : i->data, NULL);
+        } else
+            pa_idxset_put(copy, copy_func ? copy_func(i->data) : i->data, NULL);
+    }
+
+    return copy;
+}
+#endif
\ No newline at end of file
index 53ac402..ce6e906 100644 (file)
@@ -111,6 +111,11 @@ bool pa_idxset_isempty(pa_idxset *s);
  * copy will be made. */
 pa_idxset *pa_idxset_copy(pa_idxset *s, pa_copy_func_t copy_func);
 
+#ifdef __TIZEN__
+/* Similar to pa_idxset_copy(), but with a filter that can choose the entry to be copied */
+pa_idxset* pa_idxset_filtered_copy(pa_idxset *s, pa_copy_func_t copy_func, pa_compare_func_t filter_func, const void *filter);
+#endif
+
 /* A macro to ease iteration through all entries */
 #define PA_IDXSET_FOREACH(e, s, idx) \
     for ((e) = pa_idxset_first((s), &(idx)); (e); (e) = pa_idxset_next((s), &(idx)))