From 8d5b375f67d1f414c0faa3e7810dc63b6e48b6a8 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 21 Mar 2009 01:31:38 +0100 Subject: at a couple of #ifdef NOKIAs for now --- src/modules/bluetooth/module-bluetooth-device.c | 59 ++++++++++++++++++----- src/modules/bluetooth/module-bluetooth-discover.c | 15 ++++-- 2 files changed, 60 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index 928f33cf..723162ac 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -71,9 +71,14 @@ PA_MODULE_USAGE( "profile= " "rate= " "channels= " - "path= " + "path="); + +/* +#ifdef NOKIA "sco_sink= " - "sco_source="); + "sco_source=" +#endif +*/ /* TODO: not close fd when entering suspend mode in a2dp */ @@ -87,8 +92,10 @@ static const char* const valid_modargs[] = { "rate", "channels", "path", +#ifdef NOKIA "sco_sink", "sco_source", +#endif NULL }; @@ -106,8 +113,10 @@ struct a2dp_info { struct hsp_info { pcm_capabilities_t pcm_capabilities; +#ifdef NOKIA pa_sink *sco_sink; pa_source *sco_source; +#endif pa_hook_slot *sink_state_changed_slot; pa_hook_slot *source_state_changed_slot; }; @@ -159,7 +168,9 @@ struct userdata { int service_write_type, service_read_type; }; +#ifdef NOKIA #define USE_SCO_OVER_PCM(u) (u->profile == PROFILE_HSP && (u->hsp.sco_sink && u->hsp.sco_source)) +#endif static int init_bt(struct userdata *u); static int init_profile(struct userdata *u); @@ -1404,6 +1415,8 @@ static char *get_name(const char *type, pa_modargs *ma, const char *device_id, p return pa_sprintf_malloc("bluez_%s.%s", type, n); } +#ifdef NOKIA + static void sco_over_pcm_state_update(struct userdata *u) { pa_assert(u); pa_assert(USE_SCO_OVER_PCM(u)); @@ -1458,8 +1471,11 @@ static pa_hook_result_t source_state_changed_cb(pa_core *c, pa_source *s, struct return PA_HOOK_OK; } +#endif + static int add_sink(struct userdata *u) { +#ifdef NOKIA if (USE_SCO_OVER_PCM(u)) { pa_proplist *p; @@ -1472,7 +1488,10 @@ static int add_sink(struct userdata *u) { if (!u->hsp.sink_state_changed_slot) u->hsp.sink_state_changed_slot = pa_hook_connect(&u->core->hooks[PA_CORE_HOOK_SINK_STATE_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) sink_state_changed_cb, u); - } else { + } else +#endif + + { pa_sink_new_data data; pa_bool_t b; @@ -1504,19 +1523,19 @@ static int add_sink(struct userdata *u) { } static int add_source(struct userdata *u) { - pa_proplist *p; +#ifdef NOKIA if (USE_SCO_OVER_PCM(u)) { u->source = u->hsp.sco_source; - p = pa_proplist_new(); - pa_proplist_sets(p, "bluetooth.protocol", "sco"); - pa_proplist_update(u->source->proplist, PA_UPDATE_MERGE, p); - pa_proplist_free(p); + pa_proplist_sets(u->source->proplist, "bluetooth.protocol", "sco"); if (!u->hsp.source_state_changed_slot) u->hsp.source_state_changed_slot = pa_hook_connect(&u->core->hooks[PA_CORE_HOOK_SOURCE_STATE_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) source_state_changed_cb, u); - } else { + } else +#endif + + { pa_source_new_data data; pa_bool_t b; @@ -1602,10 +1621,12 @@ static int setup_bt(struct userdata *u) { pa_log_debug("Connection to the device configured"); +#ifdef NOKIA if (USE_SCO_OVER_PCM(u)) { pa_log_debug("Configured to use SCO over PCM"); return 0; } +#endif pa_log_debug("Got the stream socket"); @@ -1683,6 +1704,7 @@ static int start_thread(struct userdata *u) { u->rtpoll = pa_rtpoll_new(); pa_thread_mq_init(&u->thread_mq, u->core->mainloop, u->rtpoll); +#ifdef NOKIA if (USE_SCO_OVER_PCM(u)) { if (start_stream_fd(u) < 0) return -1; @@ -1692,6 +1714,7 @@ static int start_thread(struct userdata *u) { /* FIXME: monitor stream_fd error */ return 0; } +#endif if (!(u->thread = pa_thread_new(thread_func, u))) { pa_log_error("Failed to create IO thread"); @@ -1727,14 +1750,18 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) { if (u->sink) { inputs = pa_sink_move_all_start(u->sink); +#ifdef NOKIA if (!USE_SCO_OVER_PCM(u)) pa_sink_unlink(u->sink); +#endif } if (u->source) { outputs = pa_source_move_all_start(u->source); +#ifdef NOKIA if (!USE_SCO_OVER_PCM(u)) pa_source_unlink(u->source); +#endif } stop_thread(u); @@ -1915,6 +1942,7 @@ int pa__init(pa_module* m) { u->sample_spec = m->core->default_sample_spec; u->modargs = ma; +#ifdef NOKIA if (pa_modargs_get_value(ma, "sco_sink", NULL) && !(u->hsp.sco_sink = pa_namereg_get(m->core, pa_modargs_get_value(ma, "sco_sink", NULL), PA_NAMEREG_SINK))) { pa_log("SCO sink not found"); @@ -1926,6 +1954,7 @@ int pa__init(pa_module* m) { pa_log("SCO source not found"); goto fail; } +#endif if (pa_modargs_get_value_u32(ma, "rate", &u->sample_spec.rate) < 0 || u->sample_spec.rate <= 0 || u->sample_spec.rate > PA_RATE_MAX) { @@ -2036,10 +2065,18 @@ void pa__done(pa_module *m) { if (!(u = m->userdata)) return; - if (u->sink && !USE_SCO_OVER_PCM(u)) + if (u->sink +#ifdef NOKIA + && !USE_SCO_OVER_PCM(u) +#endif + ) pa_sink_unlink(u->sink); - if (u->source && !USE_SCO_OVER_PCM(u)) + if (u->source +#ifdef NOKIA + && !USE_SCO_OVER_PCM(u) +#endif + ) pa_source_unlink(u->source); stop_thread(u); diff --git a/src/modules/bluetooth/module-bluetooth-discover.c b/src/modules/bluetooth/module-bluetooth-discover.c index 22e8ea30..4805e5f5 100644 --- a/src/modules/bluetooth/module-bluetooth-discover.c +++ b/src/modules/bluetooth/module-bluetooth-discover.c @@ -42,13 +42,20 @@ PA_MODULE_AUTHOR("Joao Paulo Rechi Vita"); PA_MODULE_DESCRIPTION("Detect available bluetooth audio devices and load bluetooth audio drivers"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_USAGE("sco_sink= " - "sco_source=" - "async="); +PA_MODULE_USAGE("async="); + +/* +#ifdef NOKIA + "sco_sink= " + "sco_source=" +#endif +*/ static const char* const valid_modargs[] = { +#ifdef NOKIA "sco_sink", "sco_source", +#endif "async", NULL }; @@ -86,6 +93,7 @@ static pa_hook_result_t load_module_for_device(pa_bluetooth_discovery *y, const args = pa_sprintf_malloc("address=\"%s\" path=\"%s\" profile=\"%s\"", d->address, d->path, d->headset_connected ? "hsp" : "a2dp"); +#ifdef NOKIA if (pa_modargs_get_value(u->modargs, "sco_sink", NULL) && pa_modargs_get_value(u->modargs, "sco_source", NULL)) { char *tmp; @@ -96,6 +104,7 @@ static pa_hook_result_t load_module_for_device(pa_bluetooth_discovery *y, const pa_xfree(args); args = tmp; } +#endif pa_log_debug("Loading module-bluetooth-device %s", args); m = pa_module_load(u->module->core, "module-bluetooth-device", args); -- cgit