mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	bluetooth: Convert booleans to stdbool.
This commit is contained in:
		
							parent
							
								
									a0cc0136ea
								
							
						
					
					
						commit
						b1e47df72c
					
				
					 5 changed files with 41 additions and 41 deletions
				
			
		| 
						 | 
					@ -70,7 +70,7 @@ struct pa_bluetooth_discovery {
 | 
				
			||||||
    pa_hashmap *devices;
 | 
					    pa_hashmap *devices;
 | 
				
			||||||
    pa_hashmap *transports;
 | 
					    pa_hashmap *transports;
 | 
				
			||||||
    pa_hook hooks[PA_BLUETOOTH_HOOK_MAX];
 | 
					    pa_hook hooks[PA_BLUETOOTH_HOOK_MAX];
 | 
				
			||||||
    pa_bool_t filter_added;
 | 
					    bool filter_added;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void get_properties_reply(DBusPendingCall *pending, void *userdata);
 | 
					static void get_properties_reply(DBusPendingCall *pending, void *userdata);
 | 
				
			||||||
| 
						 | 
					@ -411,7 +411,7 @@ static int parse_device_property(pa_bluetooth_device *d, DBusMessageIter *i) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (dbus_message_iter_get_arg_type(&ai) == DBUS_TYPE_STRING && pa_streq(key, "UUIDs")) {
 | 
					            if (dbus_message_iter_get_arg_type(&ai) == DBUS_TYPE_STRING && pa_streq(key, "UUIDs")) {
 | 
				
			||||||
                DBusMessage *m;
 | 
					                DBusMessage *m;
 | 
				
			||||||
                pa_bool_t has_audio = false;
 | 
					                bool has_audio = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                while (dbus_message_iter_get_arg_type(&ai) != DBUS_TYPE_INVALID) {
 | 
					                while (dbus_message_iter_get_arg_type(&ai) != DBUS_TYPE_INVALID) {
 | 
				
			||||||
                    pa_bluetooth_uuid *node;
 | 
					                    pa_bluetooth_uuid *node;
 | 
				
			||||||
| 
						 | 
					@ -599,7 +599,7 @@ static int parse_audio_property(pa_bluetooth_device *d, const char *interface, D
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void run_callback(pa_bluetooth_device *d, pa_bool_t dead) {
 | 
					static void run_callback(pa_bluetooth_device *d, bool dead) {
 | 
				
			||||||
    pa_assert(d);
 | 
					    pa_assert(d);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (d->device_info_valid != 1)
 | 
					    if (d->device_info_valid != 1)
 | 
				
			||||||
| 
						 | 
					@ -1257,7 +1257,7 @@ static DBusMessage *endpoint_set_configuration(DBusConnection *conn, DBusMessage
 | 
				
			||||||
    const char *sender, *path, *dev_path = NULL, *uuid = NULL;
 | 
					    const char *sender, *path, *dev_path = NULL, *uuid = NULL;
 | 
				
			||||||
    uint8_t *config = NULL;
 | 
					    uint8_t *config = NULL;
 | 
				
			||||||
    int size = 0;
 | 
					    int size = 0;
 | 
				
			||||||
    pa_bool_t nrec = false;
 | 
					    bool nrec = false;
 | 
				
			||||||
    enum profile p;
 | 
					    enum profile p;
 | 
				
			||||||
    DBusMessageIter args, props;
 | 
					    DBusMessageIter args, props;
 | 
				
			||||||
    DBusMessage *r;
 | 
					    DBusMessage *r;
 | 
				
			||||||
| 
						 | 
					@ -1808,7 +1808,7 @@ const char*pa_bluetooth_get_form_factor(uint32_t class) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
char *pa_bluetooth_cleanup_name(const char *name) {
 | 
					char *pa_bluetooth_cleanup_name(const char *name) {
 | 
				
			||||||
    char *t, *s, *d;
 | 
					    char *t, *s, *d;
 | 
				
			||||||
    pa_bool_t space = false;
 | 
					    bool space = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_assert(name);
 | 
					    pa_assert(name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1837,7 +1837,7 @@ char *pa_bluetooth_cleanup_name(const char *name) {
 | 
				
			||||||
    return t;
 | 
					    return t;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pa_bool_t pa_bluetooth_uuid_has(pa_bluetooth_uuid *uuids, const char *uuid) {
 | 
					bool pa_bluetooth_uuid_has(pa_bluetooth_uuid *uuids, const char *uuid) {
 | 
				
			||||||
    pa_assert(uuid);
 | 
					    pa_assert(uuid);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    while (uuids) {
 | 
					    while (uuids) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -99,7 +99,7 @@ struct pa_bluetooth_transport {
 | 
				
			||||||
    int config_size;
 | 
					    int config_size;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_bluetooth_transport_state_t state;
 | 
					    pa_bluetooth_transport_state_t state;
 | 
				
			||||||
    pa_bool_t nrec;
 | 
					    bool nrec;
 | 
				
			||||||
    uint16_t microphone_gain; /* Used for HSP/HFP */
 | 
					    uint16_t microphone_gain; /* Used for HSP/HFP */
 | 
				
			||||||
    uint16_t speaker_gain; /* Used for HSP/HFP */
 | 
					    uint16_t speaker_gain; /* Used for HSP/HFP */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -115,7 +115,7 @@ typedef enum pa_bt_audio_state {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct pa_bluetooth_device {
 | 
					struct pa_bluetooth_device {
 | 
				
			||||||
    pa_bluetooth_discovery *discovery;
 | 
					    pa_bluetooth_discovery *discovery;
 | 
				
			||||||
    pa_bool_t dead;
 | 
					    bool dead;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    int device_info_valid;      /* 0: no results yet; 1: good results; -1: bad results ... */
 | 
					    int device_info_valid;      /* 0: no results yet; 1: good results; -1: bad results ... */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -158,7 +158,7 @@ const char* pa_bluetooth_get_form_factor(uint32_t class);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
char *pa_bluetooth_cleanup_name(const char *name);
 | 
					char *pa_bluetooth_cleanup_name(const char *name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pa_bool_t pa_bluetooth_uuid_has(pa_bluetooth_uuid *uuids, const char *uuid);
 | 
					bool pa_bluetooth_uuid_has(pa_bluetooth_uuid *uuids, const char *uuid);
 | 
				
			||||||
const char *pa_bt_profile_to_string(enum profile profile);
 | 
					const char *pa_bt_profile_to_string(enum profile profile);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -104,7 +104,7 @@ static const char* const valid_modargs[] = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct a2dp_info {
 | 
					struct a2dp_info {
 | 
				
			||||||
    sbc_t sbc;                           /* Codec data */
 | 
					    sbc_t sbc;                           /* Codec data */
 | 
				
			||||||
    pa_bool_t sbc_initialized;           /* Keep track if the encoder is initialized */
 | 
					    bool sbc_initialized;                /* Keep track if the encoder is initialized */
 | 
				
			||||||
    size_t codesize, frame_length;       /* SBC Codesize, frame_length. We simply cache those values here */
 | 
					    size_t codesize, frame_length;       /* SBC Codesize, frame_length. We simply cache those values here */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void* buffer;                        /* Codec transfer buffer */
 | 
					    void* buffer;                        /* Codec transfer buffer */
 | 
				
			||||||
| 
						 | 
					@ -150,7 +150,7 @@ struct userdata {
 | 
				
			||||||
    pa_hook_slot *transport_speaker_changed_slot;
 | 
					    pa_hook_slot *transport_speaker_changed_slot;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_bluetooth_discovery *discovery;
 | 
					    pa_bluetooth_discovery *discovery;
 | 
				
			||||||
    pa_bool_t auto_connect;
 | 
					    bool auto_connect;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_card *card;
 | 
					    pa_card *card;
 | 
				
			||||||
    pa_sink *sink;
 | 
					    pa_sink *sink;
 | 
				
			||||||
| 
						 | 
					@ -351,7 +351,7 @@ static void bt_transport_release(struct userdata *u) {
 | 
				
			||||||
    teardown_stream(u);
 | 
					    teardown_stream(u);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int bt_transport_acquire(struct userdata *u, pa_bool_t optional) {
 | 
					static int bt_transport_acquire(struct userdata *u, bool optional) {
 | 
				
			||||||
    pa_assert(u->transport);
 | 
					    pa_assert(u->transport);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (u->transport_acquired)
 | 
					    if (u->transport_acquired)
 | 
				
			||||||
| 
						 | 
					@ -378,7 +378,7 @@ static int bt_transport_acquire(struct userdata *u, pa_bool_t optional) {
 | 
				
			||||||
/* Run from IO thread */
 | 
					/* Run from IO thread */
 | 
				
			||||||
static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) {
 | 
					static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) {
 | 
				
			||||||
    struct userdata *u = PA_SINK(o)->userdata;
 | 
					    struct userdata *u = PA_SINK(o)->userdata;
 | 
				
			||||||
    pa_bool_t failed = false;
 | 
					    bool failed = false;
 | 
				
			||||||
    int r;
 | 
					    int r;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_assert(u->sink == PA_SINK(o));
 | 
					    pa_assert(u->sink == PA_SINK(o));
 | 
				
			||||||
| 
						 | 
					@ -456,7 +456,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
 | 
				
			||||||
/* Run from IO thread */
 | 
					/* Run from IO thread */
 | 
				
			||||||
static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) {
 | 
					static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) {
 | 
				
			||||||
    struct userdata *u = PA_SOURCE(o)->userdata;
 | 
					    struct userdata *u = PA_SOURCE(o)->userdata;
 | 
				
			||||||
    pa_bool_t failed = false;
 | 
					    bool failed = false;
 | 
				
			||||||
    int r;
 | 
					    int r;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_assert(u->source == PA_SOURCE(o));
 | 
					    pa_assert(u->source == PA_SOURCE(o));
 | 
				
			||||||
| 
						 | 
					@ -627,7 +627,7 @@ static int hsp_process_push(struct userdata *u) {
 | 
				
			||||||
        struct cmsghdr *cm;
 | 
					        struct cmsghdr *cm;
 | 
				
			||||||
        uint8_t aux[1024];
 | 
					        uint8_t aux[1024];
 | 
				
			||||||
        struct iovec iov;
 | 
					        struct iovec iov;
 | 
				
			||||||
        pa_bool_t found_tstamp = false;
 | 
					        bool found_tstamp = false;
 | 
				
			||||||
        pa_usec_t tstamp;
 | 
					        pa_usec_t tstamp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        memset(&m, 0, sizeof(m));
 | 
					        memset(&m, 0, sizeof(m));
 | 
				
			||||||
| 
						 | 
					@ -854,7 +854,7 @@ static int a2dp_process_push(struct userdata *u) {
 | 
				
			||||||
    memchunk.index = memchunk.length = 0;
 | 
					    memchunk.index = memchunk.length = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (;;) {
 | 
					    for (;;) {
 | 
				
			||||||
        pa_bool_t found_tstamp = false;
 | 
					        bool found_tstamp = false;
 | 
				
			||||||
        pa_usec_t tstamp;
 | 
					        pa_usec_t tstamp;
 | 
				
			||||||
        struct a2dp_info *a2dp;
 | 
					        struct a2dp_info *a2dp;
 | 
				
			||||||
        struct rtp_header *header;
 | 
					        struct rtp_header *header;
 | 
				
			||||||
| 
						 | 
					@ -980,7 +980,7 @@ static void thread_func(void *userdata) {
 | 
				
			||||||
    struct userdata *u = userdata;
 | 
					    struct userdata *u = userdata;
 | 
				
			||||||
    unsigned do_write = 0;
 | 
					    unsigned do_write = 0;
 | 
				
			||||||
    unsigned pending_read_bytes = 0;
 | 
					    unsigned pending_read_bytes = 0;
 | 
				
			||||||
    pa_bool_t writable = false;
 | 
					    bool writable = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_assert(u);
 | 
					    pa_assert(u);
 | 
				
			||||||
    pa_assert(u->transport);
 | 
					    pa_assert(u->transport);
 | 
				
			||||||
| 
						 | 
					@ -999,7 +999,7 @@ static void thread_func(void *userdata) {
 | 
				
			||||||
    for (;;) {
 | 
					    for (;;) {
 | 
				
			||||||
        struct pollfd *pollfd;
 | 
					        struct pollfd *pollfd;
 | 
				
			||||||
        int ret;
 | 
					        int ret;
 | 
				
			||||||
        pa_bool_t disable_timer = true;
 | 
					        bool disable_timer = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        pollfd = u->rtpoll_item ? pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL) : NULL;
 | 
					        pollfd = u->rtpoll_item ? pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL) : NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1196,8 +1196,8 @@ static pa_port_available_t transport_state_to_availability_merged(pa_bluetooth_t
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Run from main thread */
 | 
					/* Run from main thread */
 | 
				
			||||||
static void handle_transport_state_change(struct userdata *u, struct pa_bluetooth_transport *transport) {
 | 
					static void handle_transport_state_change(struct userdata *u, struct pa_bluetooth_transport *transport) {
 | 
				
			||||||
    pa_bool_t acquire = false;
 | 
					    bool acquire = false;
 | 
				
			||||||
    pa_bool_t release = false;
 | 
					    bool release = false;
 | 
				
			||||||
    enum profile profile;
 | 
					    enum profile profile;
 | 
				
			||||||
    pa_bluetooth_transport_state_t state;
 | 
					    pa_bluetooth_transport_state_t state;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1372,7 +1372,7 @@ static void source_set_volume_cb(pa_source *s) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Run from main thread */
 | 
					/* Run from main thread */
 | 
				
			||||||
static char *get_name(const char *type, pa_modargs *ma, const char *device_id, pa_bool_t *namereg_fail) {
 | 
					static char *get_name(const char *type, pa_modargs *ma, const char *device_id, bool *namereg_fail) {
 | 
				
			||||||
    char *t;
 | 
					    char *t;
 | 
				
			||||||
    const char *n;
 | 
					    const char *n;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1400,7 +1400,7 @@ static char *get_name(const char *type, pa_modargs *ma, const char *device_id, p
 | 
				
			||||||
    return pa_sprintf_malloc("bluez_%s.%s", type, n);
 | 
					    return pa_sprintf_malloc("bluez_%s.%s", type, n);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int sco_over_pcm_state_update(struct userdata *u, pa_bool_t changed) {
 | 
					static int sco_over_pcm_state_update(struct userdata *u, bool changed) {
 | 
				
			||||||
    pa_assert(u);
 | 
					    pa_assert(u);
 | 
				
			||||||
    pa_assert(USE_SCO_OVER_PCM(u));
 | 
					    pa_assert(USE_SCO_OVER_PCM(u));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1592,7 +1592,7 @@ static int add_sink(struct userdata *u) {
 | 
				
			||||||
        pa_proplist_free(p);
 | 
					        pa_proplist_free(p);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        pa_sink_new_data data;
 | 
					        pa_sink_new_data data;
 | 
				
			||||||
        pa_bool_t b;
 | 
					        bool b;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        pa_sink_new_data_init(&data);
 | 
					        pa_sink_new_data_init(&data);
 | 
				
			||||||
        data.driver = __FILE__;
 | 
					        data.driver = __FILE__;
 | 
				
			||||||
| 
						 | 
					@ -1662,7 +1662,7 @@ static int add_source(struct userdata *u) {
 | 
				
			||||||
        pa_proplist_sets(u->source->proplist, "bluetooth.protocol", pa_bt_profile_to_string(u->profile));
 | 
					        pa_proplist_sets(u->source->proplist, "bluetooth.protocol", pa_bt_profile_to_string(u->profile));
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        pa_source_new_data data;
 | 
					        pa_source_new_data data;
 | 
				
			||||||
        pa_bool_t b;
 | 
					        bool b;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        pa_source_new_data_init(&data);
 | 
					        pa_source_new_data_init(&data);
 | 
				
			||||||
        data.driver = __FILE__;
 | 
					        data.driver = __FILE__;
 | 
				
			||||||
| 
						 | 
					@ -2253,7 +2253,7 @@ static pa_card_profile *create_card_profile(struct userdata *u, const char *uuid
 | 
				
			||||||
/* Run from main thread */
 | 
					/* Run from main thread */
 | 
				
			||||||
static int add_card(struct userdata *u) {
 | 
					static int add_card(struct userdata *u) {
 | 
				
			||||||
    pa_card_new_data data;
 | 
					    pa_card_new_data data;
 | 
				
			||||||
    pa_bool_t b;
 | 
					    bool b;
 | 
				
			||||||
    pa_card_profile *p;
 | 
					    pa_card_profile *p;
 | 
				
			||||||
    enum profile *d;
 | 
					    enum profile *d;
 | 
				
			||||||
    const char *ff;
 | 
					    const char *ff;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,7 +38,7 @@
 | 
				
			||||||
PA_MODULE_AUTHOR("Frédéric Dalleau");
 | 
					PA_MODULE_AUTHOR("Frédéric Dalleau");
 | 
				
			||||||
PA_MODULE_DESCRIPTION("When a bluetooth sink or source is added, load module-loopback");
 | 
					PA_MODULE_DESCRIPTION("When a bluetooth sink or source is added, load module-loopback");
 | 
				
			||||||
PA_MODULE_VERSION(PACKAGE_VERSION);
 | 
					PA_MODULE_VERSION(PACKAGE_VERSION);
 | 
				
			||||||
PA_MODULE_LOAD_ONCE(TRUE);
 | 
					PA_MODULE_LOAD_ONCE(true);
 | 
				
			||||||
PA_MODULE_USAGE(
 | 
					PA_MODULE_USAGE(
 | 
				
			||||||
        "a2dp_source=<Handle a2dp_source card profile (sink role)?> "
 | 
					        "a2dp_source=<Handle a2dp_source card profile (sink role)?> "
 | 
				
			||||||
        "hfgw=<Handle hfgw card profile (headset role)?>");
 | 
					        "hfgw=<Handle hfgw card profile (headset role)?>");
 | 
				
			||||||
| 
						 | 
					@ -159,7 +159,7 @@ static void set_port_profile(pa_card *card, pa_device_port *port) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        pa_log_debug("Setting card '%s' to profile '%s'", card->name, profile->name);
 | 
					        pa_log_debug("Setting card '%s' to profile '%s'", card->name, profile->name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (pa_card_set_profile(card, profile->name, FALSE) != 0)
 | 
					        if (pa_card_set_profile(card, profile->name, false) != 0)
 | 
				
			||||||
            pa_log_warn("Could not set profile '%s'", profile->name);
 | 
					            pa_log_warn("Could not set profile '%s'", profile->name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
| 
						 | 
					@ -170,7 +170,7 @@ static pa_hook_result_t port_available_hook_callback(pa_core *c, pa_device_port
 | 
				
			||||||
    pa_card *card;
 | 
					    pa_card *card;
 | 
				
			||||||
    const char *s;
 | 
					    const char *s;
 | 
				
			||||||
    uint32_t state;
 | 
					    uint32_t state;
 | 
				
			||||||
    pa_bool_t is_active_profile;
 | 
					    bool is_active_profile;
 | 
				
			||||||
    pa_device_port *port2;
 | 
					    pa_device_port *port2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    PA_IDXSET_FOREACH(card, c->cards, state)
 | 
					    PA_IDXSET_FOREACH(card, c->cards, state)
 | 
				
			||||||
| 
						 | 
					@ -233,13 +233,13 @@ int pa__init(pa_module *m) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m->userdata = u = pa_xnew0(struct userdata, 1);
 | 
					    m->userdata = u = pa_xnew0(struct userdata, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    u->enable_a2dp_source = TRUE;
 | 
					    u->enable_a2dp_source = true;
 | 
				
			||||||
    if (pa_modargs_get_value_boolean(ma, "a2dp_source", &u->enable_a2dp_source) < 0) {
 | 
					    if (pa_modargs_get_value_boolean(ma, "a2dp_source", &u->enable_a2dp_source) < 0) {
 | 
				
			||||||
        pa_log("Failed to parse a2dp_source argument.");
 | 
					        pa_log("Failed to parse a2dp_source argument.");
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    u->enable_hfgw = TRUE;
 | 
					    u->enable_hfgw = true;
 | 
				
			||||||
    if (pa_modargs_get_value_boolean(ma, "hfgw", &u->enable_hfgw) < 0) {
 | 
					    if (pa_modargs_get_value_boolean(ma, "hfgw", &u->enable_hfgw) < 0) {
 | 
				
			||||||
        pa_log("Failed to parse hfgw argument.");
 | 
					        pa_log("Failed to parse hfgw argument.");
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -49,7 +49,7 @@
 | 
				
			||||||
PA_MODULE_AUTHOR("Lennart Poettering");
 | 
					PA_MODULE_AUTHOR("Lennart Poettering");
 | 
				
			||||||
PA_MODULE_DESCRIPTION("Bluetooth Proximity Volume Control");
 | 
					PA_MODULE_DESCRIPTION("Bluetooth Proximity Volume Control");
 | 
				
			||||||
PA_MODULE_VERSION(PACKAGE_VERSION);
 | 
					PA_MODULE_VERSION(PACKAGE_VERSION);
 | 
				
			||||||
PA_MODULE_LOAD_ONCE(TRUE);
 | 
					PA_MODULE_LOAD_ONCE(true);
 | 
				
			||||||
PA_MODULE_USAGE(
 | 
					PA_MODULE_USAGE(
 | 
				
			||||||
        "sink=<sink name> "
 | 
					        "sink=<sink name> "
 | 
				
			||||||
        "hci=<hci device> "
 | 
					        "hci=<hci device> "
 | 
				
			||||||
| 
						 | 
					@ -91,8 +91,8 @@ struct userdata {
 | 
				
			||||||
    unsigned n_found;
 | 
					    unsigned n_found;
 | 
				
			||||||
    unsigned n_unknown;
 | 
					    unsigned n_unknown;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_bool_t muted:1;
 | 
					    bool muted:1;
 | 
				
			||||||
    pa_bool_t filter_added:1;
 | 
					    bool filter_added:1;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void update_volume(struct userdata *u) {
 | 
					static void update_volume(struct userdata *u) {
 | 
				
			||||||
| 
						 | 
					@ -101,7 +101,7 @@ static void update_volume(struct userdata *u) {
 | 
				
			||||||
    if (u->muted && u->n_found > 0) {
 | 
					    if (u->muted && u->n_found > 0) {
 | 
				
			||||||
        pa_sink *s;
 | 
					        pa_sink *s;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        u->muted = FALSE;
 | 
					        u->muted = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK))) {
 | 
					        if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK))) {
 | 
				
			||||||
            pa_log_warn("Sink device '%s' not available for unmuting.", pa_strnull(u->sink_name));
 | 
					            pa_log_warn("Sink device '%s' not available for unmuting.", pa_strnull(u->sink_name));
 | 
				
			||||||
| 
						 | 
					@ -109,12 +109,12 @@ static void update_volume(struct userdata *u) {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        pa_log_info("Found %u BT devices, unmuting.", u->n_found);
 | 
					        pa_log_info("Found %u BT devices, unmuting.", u->n_found);
 | 
				
			||||||
        pa_sink_set_mute(s, FALSE, FALSE);
 | 
					        pa_sink_set_mute(s, false, false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    } else if (!u->muted && (u->n_found+u->n_unknown) <= 0) {
 | 
					    } else if (!u->muted && (u->n_found+u->n_unknown) <= 0) {
 | 
				
			||||||
        pa_sink *s;
 | 
					        pa_sink *s;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        u->muted = TRUE;
 | 
					        u->muted = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK))) {
 | 
					        if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK))) {
 | 
				
			||||||
            pa_log_warn("Sink device '%s' not available for muting.", pa_strnull(u->sink_name));
 | 
					            pa_log_warn("Sink device '%s' not available for muting.", pa_strnull(u->sink_name));
 | 
				
			||||||
| 
						 | 
					@ -122,7 +122,7 @@ static void update_volume(struct userdata *u) {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        pa_log_info("No BT devices found, muting.");
 | 
					        pa_log_info("No BT devices found, muting.");
 | 
				
			||||||
        pa_sink_set_mute(s, TRUE, FALSE);
 | 
					        pa_sink_set_mute(s, true, false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    } else
 | 
					    } else
 | 
				
			||||||
        pa_log_info("%u devices now active, %u with unknown state.", u->n_found, u->n_unknown);
 | 
					        pa_log_info("%u devices now active, %u with unknown state.", u->n_found, u->n_unknown);
 | 
				
			||||||
| 
						 | 
					@ -325,7 +325,7 @@ finish:
 | 
				
			||||||
    return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 | 
					    return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int update_matches(struct userdata *u, pa_bool_t add) {
 | 
					static int update_matches(struct userdata *u, bool add) {
 | 
				
			||||||
    char *filter1, *filter2;
 | 
					    char *filter1, *filter2;
 | 
				
			||||||
    DBusError e;
 | 
					    DBusError e;
 | 
				
			||||||
    int r = -1;
 | 
					    int r = -1;
 | 
				
			||||||
| 
						 | 
					@ -360,7 +360,7 @@ static int update_matches(struct userdata *u, pa_bool_t add) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (add) {
 | 
					    if (add) {
 | 
				
			||||||
        pa_assert_se(dbus_connection_add_filter(pa_dbus_connection_get(u->dbus_connection), filter_func, u, NULL));
 | 
					        pa_assert_se(dbus_connection_add_filter(pa_dbus_connection_get(u->dbus_connection), filter_func, u, NULL));
 | 
				
			||||||
        u->filter_added = TRUE;
 | 
					        u->filter_added = true;
 | 
				
			||||||
    } else if (u->filter_added)
 | 
					    } else if (u->filter_added)
 | 
				
			||||||
        dbus_connection_remove_filter(pa_dbus_connection_get(u->dbus_connection), filter_func, u);
 | 
					        dbus_connection_remove_filter(pa_dbus_connection_get(u->dbus_connection), filter_func, u);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -401,7 +401,7 @@ int pa__init(pa_module*m) {
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (update_matches(u, TRUE) < 0)
 | 
					    if (update_matches(u, true) < 0)
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_assert_se(msg = dbus_message_new_method_call("org.bluez", u->hci_path, "org.bluez.Adapter", "ListBondings"));
 | 
					    pa_assert_se(msg = dbus_message_new_method_call("org.bluez", u->hci_path, "org.bluez.Adapter", "ListBondings"));
 | 
				
			||||||
| 
						 | 
					@ -476,7 +476,7 @@ void pa__done(pa_module*m) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (u->dbus_connection) {
 | 
					    if (u->dbus_connection) {
 | 
				
			||||||
        update_matches(u, FALSE);
 | 
					        update_matches(u, false);
 | 
				
			||||||
        pa_dbus_connection_unref(u->dbus_connection);
 | 
					        pa_dbus_connection_unref(u->dbus_connection);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue