mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-12-29 11:08:35 -05:00
bluetooth: Create pa_bluetooth_discovery for BlueZ 5
pa_bluetooth_discovery is the struct that holds information about known Bluetooth audio devices and other information about the Bluetooth stack. This commit also creates bluez5-util.[ch], which will hold a lot of utility functions to help with the BlueZ 5 support.
This commit is contained in:
parent
c706792df7
commit
0103cd1379
4 changed files with 148 additions and 1 deletions
|
|
@ -23,9 +23,12 @@
|
|||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <pulsecore/core.h>
|
||||
#include <pulsecore/macro.h>
|
||||
#include <pulsecore/module.h>
|
||||
|
||||
#include "bluez5-util.h"
|
||||
|
||||
#include "module-bluez5-discover-symdef.h"
|
||||
|
||||
PA_MODULE_AUTHOR("João Paulo Rechi Vita");
|
||||
|
|
@ -33,11 +36,41 @@ PA_MODULE_DESCRIPTION("Detect available BlueZ 5 Bluetooth audio devices and load
|
|||
PA_MODULE_VERSION(PACKAGE_VERSION);
|
||||
PA_MODULE_LOAD_ONCE(true);
|
||||
|
||||
struct userdata {
|
||||
pa_module *module;
|
||||
pa_core *core;
|
||||
pa_bluetooth_discovery *discovery;
|
||||
};
|
||||
|
||||
int pa__init(pa_module *m) {
|
||||
struct userdata *u;
|
||||
|
||||
pa_assert(m);
|
||||
|
||||
m->userdata = u = pa_xnew0(struct userdata, 1);
|
||||
u->module = m;
|
||||
u->core = m->core;
|
||||
|
||||
if (!(u->discovery = pa_bluetooth_discovery_get(u->core)))
|
||||
goto fail;
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
pa__done(m);
|
||||
return -1;
|
||||
}
|
||||
|
||||
void pa__done(pa_module *m) {
|
||||
struct userdata *u;
|
||||
|
||||
pa_assert(m);
|
||||
|
||||
if (!(u = m->userdata))
|
||||
return;
|
||||
|
||||
if (u->discovery)
|
||||
pa_bluetooth_discovery_unref(u->discovery);
|
||||
|
||||
pa_xfree(u);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue