summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2009-12-06 15:53:36 +0100
committerDaniel Mack <daniel@caiaq.de>2009-12-06 15:53:36 +0100
commitf9b03d3a44e905d50dfac1483dbf1818d2b84ffa (patch)
treef94902497876669b4238798f160dae765a430c58
parent1b2cbe92dbffc1d8be12c64fdc647e3cb5e5c58c (diff)
parente8a5746f2fcae59bfd18d39b621509b3ef130453 (diff)
Merge branch 'master' of git://0pointer.de/pulseaudio
-rw-r--r--configure.ac7
-rw-r--r--src/Makefile.am1
-rw-r--r--src/modules/module-stream-restore.c18
-rw-r--r--src/pulse/context.c12
-rw-r--r--src/pulse/internal.h3
-rw-r--r--src/pulse/stream.c20
-rw-r--r--src/pulse/thread-mainloop.c5
-rw-r--r--src/pulsecore/protocol-dbus.c9
-rw-r--r--src/pulsecore/protocol-dbus.h1
9 files changed, 50 insertions, 26 deletions
diff --git a/configure.ac b/configure.ac
index dfbd9bc0..af60fff8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1395,6 +1395,13 @@ AC_ARG_WITH(
AC_SUBST(modlibexecdir)
+AC_ARG_WITH(
+ [udev-rules-dir],
+ AS_HELP_STRING([--with-udev-rules-dir],[Directory where to install udev rules to (defaults to /lib/udev/rules.d)]),
+ [udevrulesdir=$withval], [udevrulesdir="/lib/udev/rules.d"])
+
+AC_SUBST(udevrulesdir)
+
AC_ARG_ENABLE(
[force-preopen],
AS_HELP_STRING([--enable-force-preopen],[Preopen modules, even when dlopen() is supported.]),
diff --git a/src/Makefile.am b/src/Makefile.am
index 3be28692..11826a42 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -31,7 +31,6 @@ pulselibexecdir=$(libexecdir)/pulse
xdgautostartdir=$(sysconfdir)/xdg/autostart
alsaprofilesetsdir=$(datadir)/pulseaudio/alsa-mixer/profile-sets
alsapathsdir=$(datadir)/pulseaudio/alsa-mixer/paths
-udevrulesdir=/lib/udev/rules.d
dbuspolicydir=$(sysconfdir)/dbus-1/system.d
###################################
diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c
index 02c312e3..becdb54a 100644
--- a/src/modules/module-stream-restore.c
+++ b/src/modules/module-stream-restore.c
@@ -647,8 +647,9 @@ static void handle_add_entry(DBusConnection *conn, DBusMessage *msg, void *userd
} else {
dbus_entry = dbus_entry_new(u, name);
- pa_assert(pa_hashmap_put(u->dbus_entries, dbus_entry->entry_name, dbus_entry) >= 0);
+ pa_assert_se(pa_hashmap_put(u->dbus_entries, dbus_entry->entry_name, dbus_entry) == 0);
+ e = pa_xnew0(struct entry, 1);
e->muted_valid = TRUE;
e->volume_valid = !!map.channels;
e->device_valid = !!device[0];
@@ -1245,10 +1246,10 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
#ifdef HAVE_DBUS
if (created_new_entry) {
de = dbus_entry_new(u, name);
- pa_hashmap_put(u->dbus_entries, de->entry_name, de);
+ pa_assert_se(pa_hashmap_put(u->dbus_entries, de->entry_name, de) == 0);
send_new_entry_signal(de);
} else {
- pa_assert((de = pa_hashmap_get(u->dbus_entries, name)));
+ pa_assert_se(de = pa_hashmap_get(u->dbus_entries, name));
if (device_updated)
send_device_updated_signal(de, &entry);
@@ -1859,7 +1860,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
} else {
de = dbus_entry_new(u, name);
- pa_assert_se(pa_hashmap_put(u->dbus_entries, de->entry_name, de));
+ pa_assert_se(pa_hashmap_put(u->dbus_entries, de->entry_name, de) == 0);
send_new_entry_signal(de);
}
#endif
@@ -2043,14 +2044,19 @@ int pa__init(pa_module*m) {
pa_datum next_key;
char *name;
struct dbus_entry *de;
+ struct entry *e;
done = !pa_database_next(u->database, &key, &next_key, NULL);
name = pa_xstrndup(key.data, key.size);
pa_datum_free(&key);
- de = dbus_entry_new(u, name);
- pa_assert_se(pa_hashmap_put(u->dbus_entries, de->entry_name, de) >= 0);
+ /* Use read_entry() for checking that the entry is valid. */
+ if ((e = read_entry(u, name))) {
+ de = dbus_entry_new(u, name);
+ pa_assert_se(pa_hashmap_put(u->dbus_entries, de->entry_name, de) == 0);
+ pa_xfree(e);
+ }
pa_xfree(name);
diff --git a/src/pulse/context.c b/src/pulse/context.c
index e33143d9..00184920 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -63,7 +63,7 @@
#include <pulsecore/native-common.h>
#include <pulsecore/pdispatch.h>
#include <pulsecore/pstream.h>
-#include <pulsecore/dynarray.h>
+#include <pulsecore/hashmap.h>
#include <pulsecore/socket-client.h>
#include <pulsecore/pstream-util.h>
#include <pulsecore/core-rtclock.h>
@@ -160,8 +160,8 @@ pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char *
c->client = NULL;
c->pstream = NULL;
c->pdispatch = NULL;
- c->playback_streams = pa_dynarray_new();
- c->record_streams = pa_dynarray_new();
+ c->playback_streams = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
+ c->record_streams = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
c->client_index = PA_INVALID_INDEX;
c->use_rtclock = pa_mainloop_is_our_api(mainloop);
@@ -266,9 +266,9 @@ static void context_free(pa_context *c) {
#endif
if (c->record_streams)
- pa_dynarray_free(c->record_streams, NULL, NULL);
+ pa_hashmap_free(c->record_streams, NULL, NULL);
if (c->playback_streams)
- pa_dynarray_free(c->playback_streams, NULL, NULL);
+ pa_hashmap_free(c->playback_streams, NULL, NULL);
if (c->mempool)
pa_mempool_free(c->mempool);
@@ -375,7 +375,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o
pa_context_ref(c);
- if ((s = pa_dynarray_get(c->record_streams, channel))) {
+ if ((s = pa_hashmap_get(c->record_streams, PA_UINT32_TO_PTR(channel)))) {
if (chunk->memblock) {
pa_memblockq_seek(s->record_memblockq, offset, seek, TRUE);
diff --git a/src/pulse/internal.h b/src/pulse/internal.h
index b371bfc2..9545d500 100644
--- a/src/pulse/internal.h
+++ b/src/pulse/internal.h
@@ -34,7 +34,6 @@
#include <pulsecore/socket-client.h>
#include <pulsecore/pstream.h>
#include <pulsecore/pdispatch.h>
-#include <pulsecore/dynarray.h>
#include <pulsecore/llist.h>
#include <pulsecore/native-common.h>
#include <pulsecore/strlist.h>
@@ -66,7 +65,7 @@ struct pa_context {
pa_pstream *pstream;
pa_pdispatch *pdispatch;
- pa_dynarray *record_streams, *playback_streams;
+ pa_hashmap *record_streams, *playback_streams;
PA_LLIST_HEAD(pa_stream, streams);
PA_LLIST_HEAD(pa_operation, operations);
diff --git a/src/pulse/stream.c b/src/pulse/stream.c
index 4dea5670..40812566 100644
--- a/src/pulse/stream.c
+++ b/src/pulse/stream.c
@@ -199,7 +199,7 @@ static void stream_unlink(pa_stream *s) {
pa_pdispatch_unregister_reply(s->context->pdispatch, s);
if (s->channel_valid) {
- pa_dynarray_put((s->direction == PA_STREAM_PLAYBACK) ? s->context->playback_streams : s->context->record_streams, s->channel, NULL);
+ pa_hashmap_remove((s->direction == PA_STREAM_PLAYBACK) ? s->context->playback_streams : s->context->record_streams, PA_UINT32_TO_PTR(s->channel));
s->channel = 0;
s->channel_valid = FALSE;
}
@@ -354,7 +354,7 @@ void pa_command_stream_killed(pa_pdispatch *pd, uint32_t command, uint32_t tag,
goto finish;
}
- if (!(s = pa_dynarray_get(command == PA_COMMAND_PLAYBACK_STREAM_KILLED ? c->playback_streams : c->record_streams, channel)))
+ if (!(s = pa_hashmap_get(command == PA_COMMAND_PLAYBACK_STREAM_KILLED ? c->playback_streams : c->record_streams, PA_UINT32_TO_PTR(channel))))
goto finish;
if (s->state != PA_STREAM_READY)
@@ -474,7 +474,7 @@ void pa_command_stream_moved(pa_pdispatch *pd, uint32_t command, uint32_t tag, p
goto finish;
}
- if (!(s = pa_dynarray_get(command == PA_COMMAND_PLAYBACK_STREAM_MOVED ? c->playback_streams : c->record_streams, channel)))
+ if (!(s = pa_hashmap_get(command == PA_COMMAND_PLAYBACK_STREAM_MOVED ? c->playback_streams : c->record_streams, PA_UINT32_TO_PTR(channel))))
goto finish;
if (s->state != PA_STREAM_READY)
@@ -557,7 +557,7 @@ void pa_command_stream_buffer_attr(pa_pdispatch *pd, uint32_t command, uint32_t
goto finish;
}
- if (!(s = pa_dynarray_get(command == PA_COMMAND_PLAYBACK_BUFFER_ATTR_CHANGED ? c->playback_streams : c->record_streams, channel)))
+ if (!(s = pa_hashmap_get(command == PA_COMMAND_PLAYBACK_BUFFER_ATTR_CHANGED ? c->playback_streams : c->record_streams, PA_UINT32_TO_PTR(channel))))
goto finish;
if (s->state != PA_STREAM_READY)
@@ -609,7 +609,7 @@ void pa_command_stream_suspended(pa_pdispatch *pd, uint32_t command, uint32_t ta
goto finish;
}
- if (!(s = pa_dynarray_get(command == PA_COMMAND_PLAYBACK_STREAM_SUSPENDED ? c->playback_streams : c->record_streams, channel)))
+ if (!(s = pa_hashmap_get(command == PA_COMMAND_PLAYBACK_STREAM_SUSPENDED ? c->playback_streams : c->record_streams, PA_UINT32_TO_PTR(channel))))
goto finish;
if (s->state != PA_STREAM_READY)
@@ -651,7 +651,7 @@ void pa_command_stream_started(pa_pdispatch *pd, uint32_t command, uint32_t tag,
goto finish;
}
- if (!(s = pa_dynarray_get(c->playback_streams, channel)))
+ if (!(s = pa_hashmap_get(c->playback_streams, PA_UINT32_TO_PTR(channel))))
goto finish;
if (s->state != PA_STREAM_READY)
@@ -697,7 +697,7 @@ void pa_command_stream_event(pa_pdispatch *pd, uint32_t command, uint32_t tag, p
goto finish;
}
- if (!(s = pa_dynarray_get(command == PA_COMMAND_PLAYBACK_STREAM_EVENT ? c->playback_streams : c->record_streams, channel)))
+ if (!(s = pa_hashmap_get(command == PA_COMMAND_PLAYBACK_STREAM_EVENT ? c->playback_streams : c->record_streams, PA_UINT32_TO_PTR(channel))))
goto finish;
if (s->state != PA_STREAM_READY)
@@ -733,7 +733,7 @@ void pa_command_request(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tag
goto finish;
}
- if (!(s = pa_dynarray_get(c->playback_streams, channel)))
+ if (!(s = pa_hashmap_get(c->playback_streams, PA_UINT32_TO_PTR(channel))))
goto finish;
if (s->state != PA_STREAM_READY)
@@ -767,7 +767,7 @@ void pa_command_overflow_or_underflow(pa_pdispatch *pd, uint32_t command, uint32
goto finish;
}
- if (!(s = pa_dynarray_get(c->playback_streams, channel)))
+ if (!(s = pa_hashmap_get(c->playback_streams, PA_UINT32_TO_PTR(channel))))
goto finish;
if (s->state != PA_STREAM_READY)
@@ -997,7 +997,7 @@ void pa_create_stream_callback(pa_pdispatch *pd, uint32_t command, uint32_t tag,
}
s->channel_valid = TRUE;
- pa_dynarray_put((s->direction == PA_STREAM_RECORD) ? s->context->record_streams : s->context->playback_streams, s->channel, s);
+ pa_hashmap_put((s->direction == PA_STREAM_RECORD) ? s->context->record_streams : s->context->playback_streams, PA_UINT32_TO_PTR(s->channel), s);
create_stream_complete(s);
diff --git a/src/pulse/thread-mainloop.c b/src/pulse/thread-mainloop.c
index a2b98ce1..14ed9264 100644
--- a/src/pulse/thread-mainloop.c
+++ b/src/pulse/thread-mainloop.c
@@ -51,7 +51,7 @@
struct pa_threaded_mainloop {
pa_mainloop *real_mainloop;
- int n_waiting, n_waiting_for_accept;
+ volatile int n_waiting, n_waiting_for_accept;
pa_thread* thread;
pa_mutex* mutex;
@@ -185,6 +185,7 @@ void pa_threaded_mainloop_unlock(pa_threaded_mainloop *m) {
pa_mutex_unlock(m->mutex);
}
+/* Called with the lock taken */
void pa_threaded_mainloop_signal(pa_threaded_mainloop *m, int wait_for_accept) {
pa_assert(m);
@@ -198,6 +199,7 @@ void pa_threaded_mainloop_signal(pa_threaded_mainloop *m, int wait_for_accept) {
}
}
+/* Called with the lock taken */
void pa_threaded_mainloop_wait(pa_threaded_mainloop *m) {
pa_assert(m);
@@ -212,6 +214,7 @@ void pa_threaded_mainloop_wait(pa_threaded_mainloop *m) {
m->n_waiting --;
}
+/* Called with the lock taken */
void pa_threaded_mainloop_accept(pa_threaded_mainloop *m) {
pa_assert(m);
diff --git a/src/pulsecore/protocol-dbus.c b/src/pulsecore/protocol-dbus.c
index e427bb19..582bc658 100644
--- a/src/pulsecore/protocol-dbus.c
+++ b/src/pulsecore/protocol-dbus.c
@@ -552,10 +552,18 @@ static DBusHandlerResult handle_message_cb(DBusConnection *connection, DBusMessa
pa_dbus_send_error(connection, message, DBUS_ERROR_UNKNOWN_METHOD, "No such method: %s", call_info.method);
break;
+ case NO_SUCH_INTERFACE:
+ pa_dbus_send_error(connection, message, PA_DBUS_ERROR_NO_SUCH_INTERFACE, "No such interface: %s", call_info.interface);
+ break;
+
case NO_SUCH_PROPERTY:
pa_dbus_send_error(connection, message, PA_DBUS_ERROR_NO_SUCH_PROPERTY, "No such property: %s", call_info.property);
break;
+ case NO_SUCH_PROPERTY_INTERFACE:
+ pa_dbus_send_error(connection, message, PA_DBUS_ERROR_NO_SUCH_INTERFACE, "No such property interface: %s", call_info.property_interface);
+ break;
+
case INVALID_METHOD_SIG:
pa_dbus_send_error(connection, message, DBUS_ERROR_INVALID_ARGS,
"Invalid signature for method %s: '%s'. Expected '%s'.",
@@ -566,6 +574,7 @@ static DBusHandlerResult handle_message_cb(DBusConnection *connection, DBusMessa
pa_dbus_send_error(connection, message, DBUS_ERROR_INVALID_ARGS,
"Invalid signature for property %s: '%s'. Expected '%s'.",
call_info.property, call_info.property_sig, call_info.expected_property_sig);
+ break;
default:
pa_assert_not_reached();
diff --git a/src/pulsecore/protocol-dbus.h b/src/pulsecore/protocol-dbus.h
index 6d100f7c..89999337 100644
--- a/src/pulsecore/protocol-dbus.h
+++ b/src/pulsecore/protocol-dbus.h
@@ -35,6 +35,7 @@
#define PA_DBUS_CORE_INTERFACE "org.PulseAudio.Core1"
#define PA_DBUS_CORE_OBJECT_PATH "/org/pulseaudio/core1"
+#define PA_DBUS_ERROR_NO_SUCH_INTERFACE PA_DBUS_CORE_INTERFACE ".NoSuchInterfaceError"
#define PA_DBUS_ERROR_NO_SUCH_PROPERTY PA_DBUS_CORE_INTERFACE ".NoSuchPropertyError"
#define PA_DBUS_ERROR_NOT_FOUND PA_DBUS_CORE_INTERFACE ".NotFoundError"