From 5babbaafb26ac4f83db0d8bca53006a843472b8f Mon Sep 17 00:00:00 2001 From: Tanu Kaskinen Date: Fri, 12 Jun 2009 07:16:05 +0300 Subject: daemon: Implement the DBus server lookup service. --- src/pulse/client-conf.c | 3 +++ src/pulse/client-conf.h | 3 ++- src/pulse/client.conf.in | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src/pulse') diff --git a/src/pulse/client-conf.c b/src/pulse/client-conf.c index 940d0b67..8eab1094 100644 --- a/src/pulse/client-conf.c +++ b/src/pulse/client-conf.c @@ -57,6 +57,7 @@ static const pa_client_conf default_conf = { .default_sink = NULL, .default_source = NULL, .default_server = NULL, + .default_dbus_server = NULL, .autospawn = TRUE, .disable_shm = FALSE, .cookie_file = NULL, @@ -81,6 +82,7 @@ void pa_client_conf_free(pa_client_conf *c) { pa_xfree(c->default_sink); pa_xfree(c->default_source); pa_xfree(c->default_server); + pa_xfree(c->default_dbus_server); pa_xfree(c->cookie_file); pa_xfree(c); } @@ -97,6 +99,7 @@ int pa_client_conf_load(pa_client_conf *c, const char *filename) { { "default-sink", pa_config_parse_string, &c->default_sink, NULL }, { "default-source", pa_config_parse_string, &c->default_source, NULL }, { "default-server", pa_config_parse_string, &c->default_server, NULL }, + { "default-dbus-server", pa_config_parse_string, &c->default_dbus_server, NULL }, { "autospawn", pa_config_parse_bool, &c->autospawn, NULL }, { "cookie-file", pa_config_parse_string, &c->cookie_file, NULL }, { "disable-shm", pa_config_parse_bool, &c->disable_shm, NULL }, diff --git a/src/pulse/client-conf.h b/src/pulse/client-conf.h index ab97dc6a..618216f4 100644 --- a/src/pulse/client-conf.h +++ b/src/pulse/client-conf.h @@ -22,12 +22,13 @@ USA. ***/ +#include #include /* A structure containing configuration data for PulseAudio clients. */ typedef struct pa_client_conf { - char *daemon_binary, *extra_arguments, *default_sink, *default_source, *default_server, *cookie_file; + char *daemon_binary, *extra_arguments, *default_sink, *default_source, *default_server, *default_dbus_server, *cookie_file; pa_bool_t autospawn, disable_shm; uint8_t cookie[PA_NATIVE_COOKIE_LENGTH]; pa_bool_t cookie_valid; /* non-zero, when cookie is valid */ diff --git a/src/pulse/client.conf.in b/src/pulse/client.conf.in index 579bcc20..3340b0b2 100644 --- a/src/pulse/client.conf.in +++ b/src/pulse/client.conf.in @@ -22,6 +22,7 @@ ; default-sink = ; default-source = ; default-server = +; default-dbus-server = ; autospawn = yes ; daemon-binary = @PA_BINARY@ -- cgit From 1457df40eee692834d1c5faf95ca0057d74f86d1 Mon Sep 17 00:00:00 2001 From: Tanu Kaskinen Date: Sun, 9 Aug 2009 07:59:06 +0300 Subject: proplist: New function: pa_proplist_equal() --- src/pulse/proplist.c | 26 ++++++++++++++++++++++++++ src/pulse/proplist.h | 3 +++ 2 files changed, 29 insertions(+) (limited to 'src/pulse') diff --git a/src/pulse/proplist.c b/src/pulse/proplist.c index c904f533..4f0d6a6d 100644 --- a/src/pulse/proplist.c +++ b/src/pulse/proplist.c @@ -680,3 +680,29 @@ int pa_proplist_isempty(pa_proplist *p) { return pa_hashmap_isempty(MAKE_HASHMAP(p)); } + +int pa_proplist_equal(pa_proplist *a, pa_proplist *b) { + const void *key = NULL; + struct property *a_prop = NULL; + struct property *b_prop = NULL; + void *state = NULL; + + pa_assert(a); + pa_assert(b); + + if (pa_proplist_size(a) != pa_proplist_size(b)) + return 0; + + while ((a_prop = pa_hashmap_iterate(MAKE_HASHMAP(a), &state, &key))) { + if (!(b_prop = pa_hashmap_get(MAKE_HASHMAP(b), key))) + return 0; + + if (a_prop->nbytes != b_prop->nbytes) + return 0; + + if (memcmp(a_prop->value, b_prop->value, a_prop->nbytes) != 0) + return 0; + } + + return 1; +} diff --git a/src/pulse/proplist.h b/src/pulse/proplist.h index bc4dbd8a..a585944a 100644 --- a/src/pulse/proplist.h +++ b/src/pulse/proplist.h @@ -354,6 +354,9 @@ unsigned pa_proplist_size(pa_proplist *t); /** Returns 0 when the proplist is empty, positive otherwise \since 0.9.15 */ int pa_proplist_isempty(pa_proplist *t); +/** Return non-zero when a and b have the same keys and values. */ +int pa_proplist_equal(pa_proplist *a, pa_proplist *b); + PA_C_DECL_END #endif -- cgit From 1e4e26c87fc4f74c9805cc084c88783558acb418 Mon Sep 17 00:00:00 2001 From: Tanu Kaskinen Date: Mon, 24 Aug 2009 14:22:32 +0300 Subject: proplist: Return early from pa_proplist_equal() if the pointers are equal. --- src/pulse/proplist.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/pulse') diff --git a/src/pulse/proplist.c b/src/pulse/proplist.c index 4f0d6a6d..8b5b6538 100644 --- a/src/pulse/proplist.c +++ b/src/pulse/proplist.c @@ -690,6 +690,9 @@ int pa_proplist_equal(pa_proplist *a, pa_proplist *b) { pa_assert(a); pa_assert(b); + if (a == b) + return 1; + if (pa_proplist_size(a) != pa_proplist_size(b)) return 0; -- cgit From 187c4f32cffb75787213e8692b27d0a3c736b95e Mon Sep 17 00:00:00 2001 From: Tanu Kaskinen Date: Mon, 24 Aug 2009 14:23:49 +0300 Subject: proplist: A couple of documentation fixes. --- src/pulse/proplist.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/pulse') diff --git a/src/pulse/proplist.h b/src/pulse/proplist.h index a585944a..9effc861 100644 --- a/src/pulse/proplist.h +++ b/src/pulse/proplist.h @@ -337,7 +337,7 @@ char *pa_proplist_to_string_sep(pa_proplist *p, const char *sep); * readable string. \since 0.9.15 */ pa_proplist *pa_proplist_from_string(const char *str); - /** Returns 1 if an entry for the specified key is existant in the +/** Returns 1 if an entry for the specified key is existant in the * property list. \since 0.9.11 */ int pa_proplist_contains(pa_proplist *p, const char *key); @@ -354,7 +354,8 @@ unsigned pa_proplist_size(pa_proplist *t); /** Returns 0 when the proplist is empty, positive otherwise \since 0.9.15 */ int pa_proplist_isempty(pa_proplist *t); -/** Return non-zero when a and b have the same keys and values. */ +/** Return non-zero when a and b have the same keys and values. + * \since 0.9.16 */ int pa_proplist_equal(pa_proplist *a, pa_proplist *b); PA_C_DECL_END -- cgit