mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-14 06:59:57 -05:00
monitor: remove monitor API and use device
Remove the monitor API, we can use the device API for it. Make sure we support creating devices (like alsa) from another device (udev). Use new object.id to store the object id in the object properties. Use the port.id/node.id etc to make relations to other objects.
This commit is contained in:
parent
818fb9e904
commit
6756a3c8fc
43 changed files with 474 additions and 1015 deletions
|
|
@ -236,8 +236,10 @@ struct spa_device_methods {
|
|||
#define spa_device_enum_params(d,...) spa_device_method(d, enum_params, 0, __VA_ARGS__)
|
||||
#define spa_device_set_param(d,...) spa_device_method(d, set_param, 0, __VA_ARGS__)
|
||||
|
||||
#define SPA_KEY_DEVICE_ENUM_API "device.enum.api" /**< the api used to discover this
|
||||
* device */
|
||||
#define SPA_KEY_DEVICE_API "device.api" /**< the api used by the device
|
||||
* Ex. "alsa", "v4l2". */
|
||||
* Ex. "udev", "alsa", "v4l2". */
|
||||
#define SPA_KEY_DEVICE_NAME "device.name" /**< the name of the device */
|
||||
#define SPA_KEY_DEVICE_ALIAS "device.alias" /**< altenative name of the device */
|
||||
#define SPA_KEY_DEVICE_NICK "device.nick" /**< the device short name */
|
||||
|
|
|
|||
|
|
@ -1,133 +0,0 @@
|
|||
/* Simple Plugin API
|
||||
*
|
||||
* Copyright © 2018 Wim Taymans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef SPA_MONITOR_H
|
||||
#define SPA_MONITOR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <spa/utils/defs.h>
|
||||
#include <spa/utils/dict.h>
|
||||
#include <spa/pod/event.h>
|
||||
#include <spa/pod/builder.h>
|
||||
|
||||
#define SPA_VERSION_MONITOR 0
|
||||
struct spa_monitor { struct spa_interface iface; };
|
||||
|
||||
struct spa_monitor_info {
|
||||
#define SPA_VERSION_MONITOR_INFO 0
|
||||
uint32_t version;
|
||||
|
||||
#define SPA_MONITOR_CHANGE_MASK_FLAGS (1u<<0)
|
||||
#define SPA_MONITOR_CHANGE_MASK_PROPS (1u<<1)
|
||||
uint64_t change_mask;
|
||||
uint64_t flags;
|
||||
const struct spa_dict *props;
|
||||
};
|
||||
|
||||
#define SPA_MONITOR_INFO_INIT() (struct spa_monitor_info){ SPA_VERSION_MONITOR_INFO, }
|
||||
|
||||
struct spa_monitor_object_info {
|
||||
#define SPA_VERSION_MONITOR_OBJECT_INFO 0
|
||||
uint32_t version;
|
||||
|
||||
uint32_t type;
|
||||
const char *factory_name;
|
||||
|
||||
#define SPA_MONITOR_OBJECT_CHANGE_MASK_FLAGS (1u<<0)
|
||||
#define SPA_MONITOR_OBJECT_CHANGE_MASK_PROPS (1u<<1)
|
||||
uint64_t change_mask;
|
||||
uint64_t flags;
|
||||
const struct spa_dict *props;
|
||||
};
|
||||
|
||||
#define SPA_MONITOR_OBJECT_INFO_INIT() (struct spa_monitor_object_info){ SPA_VERSION_MONITOR_OBJECT_INFO, }
|
||||
/**
|
||||
* spa_monitor_callbacks:
|
||||
*/
|
||||
struct spa_monitor_callbacks {
|
||||
/** version of the structure */
|
||||
#define SPA_VERSION_MONITOR_CALLBACKS 0
|
||||
uint32_t version;
|
||||
|
||||
/** receive extra information about the monitor */
|
||||
int (*info) (void *data, const struct spa_monitor_info *info);
|
||||
|
||||
/** an item is added/removed/changed on the monitor */
|
||||
int (*event) (void *data, const struct spa_event *event);
|
||||
|
||||
/** info changed for an object managed by the monitor, info is NULL when
|
||||
* the object is removed */
|
||||
int (*object_info) (void *data, uint32_t id,
|
||||
const struct spa_monitor_object_info *info);
|
||||
};
|
||||
|
||||
/**
|
||||
* spa_monitor_methods:
|
||||
*
|
||||
* The device monitor methods.
|
||||
*/
|
||||
struct spa_monitor_methods {
|
||||
/* the version of this monitor. This can be used to expand this
|
||||
* structure in the future */
|
||||
#define SPA_VERSION_MONITOR_METHODS 0
|
||||
uint32_t version;
|
||||
|
||||
/**
|
||||
* Set callbacks to receive asynchronous notifications from
|
||||
* the monitor.
|
||||
*
|
||||
* Setting the callbacks will emit the info
|
||||
*
|
||||
* \param monitor: a #spa_monitor
|
||||
* \param callback: a #callbacks
|
||||
* \return 0 on success
|
||||
* < 0 errno on error
|
||||
*/
|
||||
int (*set_callbacks) (void *object,
|
||||
const struct spa_monitor_callbacks *callbacks,
|
||||
void *data);
|
||||
};
|
||||
|
||||
static inline int spa_monitor_set_callbacks(struct spa_monitor *m,
|
||||
const struct spa_monitor_callbacks *callbacks, void *data)
|
||||
{
|
||||
int res = -ENOTSUP;
|
||||
spa_interface_call_res(&m->iface,
|
||||
struct spa_monitor_methods, res, set_callbacks, 0,
|
||||
callbacks, data);
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
#define SPA_KEY_MONITOR_API "monitor.api" /**< the api used by the monitor.
|
||||
* Ex. "udev", "dbus", ... */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* SPA_MONITOR_H */
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/* Simple Plugin API
|
||||
*
|
||||
* Copyright © 2018 Wim Taymans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef SPA_MONITOR_TYPES_H
|
||||
#define SPA_MONITOR_TYPES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <spa/utils/type-info.h>
|
||||
#include <spa/monitor/monitor.h>
|
||||
|
||||
#define SPA_TYPE_INFO_MonitorEvent SPA_TYPE_INFO_EVENT_BASE "Monitor"
|
||||
#define SPA_TYPE_INFO_MONITOR_EVENT_BASE SPA_TYPE_INFO_MonitorEvent ":"
|
||||
|
||||
static const struct spa_type_info spa_type_monitor_event_id[] = {
|
||||
{ 0, 0, NULL, NULL },
|
||||
};
|
||||
|
||||
static const struct spa_type_info spa_type_monitor_event[] = {
|
||||
{ 0, SPA_TYPE_Id, SPA_TYPE_INFO_MONITOR_EVENT_BASE, spa_type_monitor_event_id },
|
||||
{ 0, 0, NULL, NULL },
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* SPA_MONITOR_TYPES_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue