From f13bbd576fef8911275c8eed41ef425163b70398 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 8 Jun 2009 16:58:45 +0200 Subject: prop: introduce new PA_PROP_DEVICE_INTENDED_ROLES property --- src/modules/bluetooth/module-bluetooth-device.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/modules/bluetooth/module-bluetooth-device.c') diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index dbec00d4..40093cf2 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -1622,6 +1622,8 @@ static int add_sink(struct userdata *u) { data.module = u->module; pa_sink_new_data_set_sample_spec(&data, &u->sample_spec); pa_proplist_sets(data.proplist, "bluetooth.protocol", u->profile == PROFILE_A2DP ? "a2dp" : "sco"); + if (u->profile == PROFILE_HSP) + pa_proplist_sets(data.proplist, PA_PROP_DEVICE_INTENDED_ROLES, "phone"); data.card = u->card; data.name = get_name("sink", u->modargs, u->address, &b); data.namereg_fail = b; @@ -1680,6 +1682,8 @@ static int add_source(struct userdata *u) { data.module = u->module; pa_source_new_data_set_sample_spec(&data, &u->sample_spec); pa_proplist_sets(data.proplist, "bluetooth.protocol", u->profile == PROFILE_A2DP ? "a2dp" : "hsp"); + if (u->profile == PROFILE_HSP) + pa_proplist_sets(data.proplist, PA_PROP_DEVICE_INTENDED_ROLES, "phone"); data.card = u->card; data.name = get_name("source", u->modargs, u->address, &b); data.namereg_fail = b; -- cgit From 31575f7766d6ff39665b64a3a04412eff1c39957 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 17 Jun 2009 03:45:14 +0200 Subject: alsa: rework mixer logic Completely rework mixer logic. This now allows controlling a full set of elements from a single sink's volume slider/mute button. This also introduces sink and source "ports" that can be used to choose different input or output ports with the UI. (i.e. "mic"/"line-in" or "speaker"/"headphones". The mixer paths and device maps are now configered in external configuration files and can be tweaked as necessary. --- src/modules/bluetooth/module-bluetooth-device.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/modules/bluetooth/module-bluetooth-device.c') diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index 40093cf2..9fec4edf 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -1443,12 +1443,12 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us if (u->sink && dbus_message_is_signal(m, "org.bluez.Headset", "SpeakerGainChanged")) { pa_cvolume_set(&v, u->sample_spec.channels, (pa_volume_t) (gain * PA_VOLUME_NORM / 15)); - pa_sink_volume_changed(u->sink, &v); + pa_sink_volume_changed(u->sink, &v, TRUE); } else if (u->source && dbus_message_is_signal(m, "org.bluez.Headset", "MicrophoneGainChanged")) { pa_cvolume_set(&v, u->sample_spec.channels, (pa_volume_t) (gain * PA_VOLUME_NORM / 15)); - pa_source_volume_changed(u->source, &v); + pa_source_volume_changed(u->source, &v, TRUE); } } } @@ -1938,7 +1938,7 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) { } if (u->sink) { - inputs = pa_sink_move_all_start(u->sink); + inputs = pa_sink_move_all_start(u->sink, NULL); #ifdef NOKIA if (!USE_SCO_OVER_PCM(u)) #endif @@ -1946,7 +1946,7 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) { } if (u->source) { - outputs = pa_source_move_all_start(u->source); + outputs = pa_source_move_all_start(u->source, NULL); #ifdef NOKIA if (!USE_SCO_OVER_PCM(u)) #endif -- cgit From bd8e043a52834f3d3286ece03de46f498c9e241c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 17 Jun 2009 04:51:57 +0200 Subject: bluetooth: return sensible error code in set_profile() --- src/modules/bluetooth/module-bluetooth-device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/modules/bluetooth/module-bluetooth-device.c') diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index 9fec4edf..6bcd0b80 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -1920,7 +1920,7 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) { if (!(device = pa_bluetooth_discovery_get_by_path(u->discovery, u->path))) { pa_log_error("Failed to get device object."); - return -1; + return -PA_ERR_IO; } /* The state signal is sent by bluez, so it is racy to check @@ -1930,11 +1930,11 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) { module will be unloaded. */ if (device->headset_state < PA_BT_AUDIO_STATE_CONNECTED && *d == PROFILE_HSP) { pa_log_warn("HSP is not connected, refused to switch profile"); - return -1; + return -PA_ERR_IO; } else if (device->audio_sink_state < PA_BT_AUDIO_STATE_CONNECTED && *d == PROFILE_A2DP) { pa_log_warn("A2DP is not connected, refused to switch profile"); - return -1; + return -PA_ERR_IO; } if (u->sink) { -- cgit From 5dcdd5e3583f32c8bffb5a1892e318747070f5d8 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Sat, 4 Apr 2009 22:56:38 +0300 Subject: perl -p -i -e 's/pa_rtclock_usec/pa_rtclock_now/g' `find . -name '*.[ch]'` --- src/modules/bluetooth/module-bluetooth-device.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/modules/bluetooth/module-bluetooth-device.c') diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index 6bcd0b80..e0d4e481 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -773,7 +773,7 @@ static int start_stream_fd(struct userdata *u) { TRUE, TRUE, 10, - pa_rtclock_usec(), + pa_rtclock_now(), TRUE); return 0; @@ -867,14 +867,14 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse if (u->read_smoother) { pa_usec_t wi, ri; - ri = pa_smoother_get(u->read_smoother, pa_rtclock_usec()); + ri = pa_smoother_get(u->read_smoother, pa_rtclock_now()); wi = pa_bytes_to_usec(u->write_index + u->block_size, &u->sample_spec); *((pa_usec_t*) data) = wi > ri ? wi - ri : 0; } else { pa_usec_t ri, wi; - ri = pa_rtclock_usec() - u->started_at; + ri = pa_rtclock_now() - u->started_at; wi = pa_bytes_to_usec(u->write_index, &u->sample_spec); *((pa_usec_t*) data) = wi > ri ? wi - ri : 0; @@ -912,7 +912,7 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off stop_stream_fd(u); if (u->read_smoother) - pa_smoother_pause(u->read_smoother, pa_rtclock_usec()); + pa_smoother_pause(u->read_smoother, pa_rtclock_now()); break; case PA_SOURCE_IDLE: @@ -939,7 +939,7 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off case PA_SOURCE_MESSAGE_GET_LATENCY: { pa_usec_t wi, ri; - wi = pa_smoother_get(u->read_smoother, pa_rtclock_usec()); + wi = pa_smoother_get(u->read_smoother, pa_rtclock_now()); ri = pa_bytes_to_usec(u->read_index, &u->sample_spec); *((pa_usec_t*) data) = (wi > ri ? wi - ri : 0) + u->source->fixed_latency; @@ -1086,7 +1086,7 @@ static int hsp_process_push(struct userdata *u) { if (!found_tstamp) { pa_log_warn("Couldn't find SO_TIMESTAMP data in auxiliary recvmsg() data!"); - tstamp = pa_rtclock_usec(); + tstamp = pa_rtclock_now(); } pa_smoother_put(u->read_smoother, tstamp, pa_bytes_to_usec(u->read_index, &u->sample_spec)); @@ -1309,7 +1309,7 @@ static void thread_func(void *userdata) { /* Hmm, there is no input stream we could synchronize * to. So let's do things by time */ - time_passed = pa_rtclock_usec() - u->started_at; + time_passed = pa_rtclock_now() - u->started_at; audio_sent = pa_bytes_to_usec(u->write_index, &u->sample_spec); if (audio_sent <= time_passed) { @@ -1341,7 +1341,7 @@ static void thread_func(void *userdata) { int n_written; if (u->write_index <= 0) - u->started_at = pa_rtclock_usec(); + u->started_at = pa_rtclock_now(); if (u->profile == PROFILE_A2DP) { if ((n_written = a2dp_process_render(u)) < 0) @@ -1361,7 +1361,7 @@ static void thread_func(void *userdata) { /* Hmm, there is no input stream we could synchronize * to. So let's estimate when we need to wake up the latest */ - time_passed = pa_rtclock_usec() - u->started_at; + time_passed = pa_rtclock_now() - u->started_at; next_write_at = pa_bytes_to_usec(u->write_index, &u->sample_spec); sleep_for = time_passed < next_write_at ? next_write_at - time_passed : 0; -- cgit From 32e2cd6d3216f780c4cffed0f8eb3c30f2c8d732 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 19 Jun 2009 21:00:06 +0200 Subject: core: get rid of rt sig/timer handling since modern Linux' ppooll() is finally fixed for granularity --- src/modules/bluetooth/module-bluetooth-device.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/modules/bluetooth/module-bluetooth-device.c') diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index 6bcd0b80..0f1e78f2 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -1265,7 +1265,6 @@ static void thread_func(void *userdata) { goto fail; pa_thread_mq_install(&u->thread_mq); - pa_rtpoll_install(u->rtpoll); for (;;) { struct pollfd *pollfd; -- cgit From 125c52889626b2ac408ecbcc8ea85575f5808e07 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Sat, 4 Apr 2009 23:19:53 +0300 Subject: pulse: move pa_rtclock_now in pulsecommon --- src/modules/bluetooth/module-bluetooth-device.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/modules/bluetooth/module-bluetooth-device.c') diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index e0d4e481..68ac3acc 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -30,13 +30,15 @@ #include #include -#include -#include -#include #include +#include +#include +#include +#include #include #include +#include #include #include #include @@ -44,7 +46,6 @@ #include #include #include -#include #include #include -- cgit