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
|
|
@ -69,6 +69,10 @@ struct impl {
|
|||
struct spa_v4l2_device dev;
|
||||
};
|
||||
|
||||
static const struct spa_dict_item info_items[] = {
|
||||
{ "media.class", "Video/Device" },
|
||||
};
|
||||
|
||||
static int impl_set_callbacks(struct spa_device *device,
|
||||
const struct spa_device_callbacks *callbacks,
|
||||
void *data)
|
||||
|
|
@ -84,14 +88,17 @@ static int impl_set_callbacks(struct spa_device *device,
|
|||
this->callbacks_data = data;
|
||||
|
||||
if (callbacks) {
|
||||
if (spa_v4l2_is_capture(&this->dev)) {
|
||||
items[0] = SPA_DICT_ITEM_INIT("device.path", this->props.device);
|
||||
if (callbacks->info)
|
||||
callbacks->info(data, &SPA_DICT_INIT_ARRAY(info_items));
|
||||
|
||||
if (callbacks->add)
|
||||
if (callbacks->add) {
|
||||
if (spa_v4l2_is_capture(&this->dev)) {
|
||||
items[0] = SPA_DICT_ITEM_INIT("device.path", this->props.device);
|
||||
callbacks->add(data, 0,
|
||||
&spa_v4l2_source_factory,
|
||||
SPA_TYPE_INTERFACE_Node,
|
||||
&SPA_DICT_INIT(items, 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -116,18 +123,8 @@ static int impl_set_param(struct spa_device *device,
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static const struct spa_dict_item info_items[] = {
|
||||
{ "media.class", "Video/Device" },
|
||||
};
|
||||
|
||||
static const struct spa_dict info = {
|
||||
info_items,
|
||||
SPA_N_ELEMENTS(info_items)
|
||||
};
|
||||
|
||||
static const struct spa_device impl_device = {
|
||||
SPA_VERSION_DEVICE,
|
||||
&info,
|
||||
impl_set_callbacks,
|
||||
impl_enum_params,
|
||||
impl_set_param,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue