]> code.delx.au - pulseaudio/blobdiff - polyp/scache.c
implement missing scache_get_id_by_name
[pulseaudio] / polyp / scache.c
index f3c15934f3df7d750069c2057b28805751a3c03f..311d68a42172a83c43822f614d58e306718ee36c 100644 (file)
@@ -157,5 +157,14 @@ const char * pa_scache_get_name_by_id(struct pa_core *c, uint32_t id) {
         return NULL;
 
     return e->name;
-    
+}
+
+uint32_t pa_scache_get_id_by_name(struct pa_core *c, const char *name) {
+    struct pa_scache_entry *e;
+    assert(c && name);
+
+    if (!c->scache || !(e = pa_idxset_get_by_data(c->scache, name, NULL)))
+        return PA_IDXSET_INVALID;
+
+    return e->index;
 }