mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
monitor: remove enum_items
Make the monitor and device emit the info and items when the callbacks are set. This makes it easier to implement the monitor because there is much less state to keep around and invalidate etc. Rework the monitors Add bluez5 device
This commit is contained in:
parent
10d277ce03
commit
57e94f7bc4
15 changed files with 510 additions and 332 deletions
|
|
@ -61,6 +61,11 @@ static void inspect_item(struct data *data, struct spa_pod *item)
|
|||
spa_debug_pod(0, NULL, item);
|
||||
}
|
||||
|
||||
static void on_monitor_info(void *_data, const struct spa_dict *info)
|
||||
{
|
||||
spa_debug_dict(0, info);
|
||||
}
|
||||
|
||||
static void on_monitor_event(void *_data, struct spa_event *event)
|
||||
{
|
||||
struct data *data = _data;
|
||||
|
|
@ -103,29 +108,12 @@ static void do_remove_source(struct spa_source *source)
|
|||
|
||||
static const struct spa_monitor_callbacks impl_callbacks = {
|
||||
SPA_VERSION_MONITOR_CALLBACKS,
|
||||
.info = on_monitor_info,
|
||||
.event = on_monitor_event,
|
||||
};
|
||||
|
||||
static void handle_monitor(struct data *data, struct spa_monitor *monitor)
|
||||
{
|
||||
int res;
|
||||
uint32_t index;
|
||||
|
||||
if (monitor->info)
|
||||
spa_debug_dict(0, monitor->info);
|
||||
|
||||
for (index = 0;;) {
|
||||
struct spa_pod *item;
|
||||
uint8_t buffer[4096];
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
|
||||
|
||||
if ((res = spa_monitor_enum_items(monitor, &index, &item, &b)) <= 0) {
|
||||
if (res != 0)
|
||||
printf("spa_monitor_enum_items: %s\n", spa_strerror(res));
|
||||
break;
|
||||
}
|
||||
inspect_item(data, item);
|
||||
}
|
||||
spa_monitor_set_callbacks(monitor, &impl_callbacks, data);
|
||||
|
||||
while (true) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue