PipeWire  0.3.33
link.h
Go to the documentation of this file.
1 /* PipeWire
2  *
3  * Copyright © 2018 Wim Taymans
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 
25 #ifndef PIPEWIRE_LINK_H
26 #define PIPEWIRE_LINK_H
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #include <spa/utils/defs.h>
33 #include <spa/utils/hook.h>
34 
35 #include <pipewire/proxy.h>
36 
52 #define PW_TYPE_INTERFACE_Link PW_TYPE_INFO_INTERFACE_BASE "Link"
53 
54 #define PW_VERSION_LINK 3
55 struct pw_link;
56 
66 };
67 
69 const char * pw_link_state_as_string(enum pw_link_state state);
71 struct pw_link_info {
72  uint32_t id;
73  uint32_t output_node_id;
74  uint32_t output_port_id;
75  uint32_t input_node_id;
76  uint32_t input_port_id;
77 #define PW_LINK_CHANGE_MASK_STATE (1 << 0)
78 #define PW_LINK_CHANGE_MASK_FORMAT (1 << 1)
79 #define PW_LINK_CHANGE_MASK_PROPS (1 << 2)
80 #define PW_LINK_CHANGE_MASK_ALL ((1 << 3)-1)
81  uint64_t change_mask;
82  enum pw_link_state state;
83  const char *error;
84  struct spa_pod *format;
85  struct spa_dict *props;
86 };
87 
88 struct pw_link_info *
90  const struct pw_link_info *update);
91 
92 void
93 pw_link_info_free(struct pw_link_info *info);
94 
95 
96 #define PW_LINK_EVENT_INFO 0
97 #define PW_LINK_EVENT_NUM 1
98 
101 #define PW_VERSION_LINK_EVENTS 0
102  uint32_t version;
108  void (*info) (void *object, const struct pw_link_info *info);
109 };
110 
111 #define PW_LINK_METHOD_ADD_LISTENER 0
112 #define PW_LINK_METHOD_NUM 1
113 
116 #define PW_VERSION_LINK_METHODS 0
117  uint32_t version;
118 
119  int (*add_listener) (void *object,
120  struct spa_hook *listener,
121  const struct pw_link_events *events,
122  void *data);
123 };
124 
125 #define pw_link_method(o,method,version,...) \
126 ({ \
127  int _res = -ENOTSUP; \
128  spa_interface_call_res((struct spa_interface*)o, \
129  struct pw_link_methods, _res, \
130  method, version, ##__VA_ARGS__); \
131  _res; \
132 })
133 
134 #define pw_link_add_listener(c,...) pw_link_method(c,add_listener,0,__VA_ARGS__)
135 
140 #ifdef __cplusplus
141 } /* extern "C" */
142 #endif
143 
144 #endif /* PIPEWIRE_LINK_H */
PW_KEY_DEVICE_NAME
#define PW_KEY_DEVICE_NAME
device name
Definition: src/pipewire/keys.h:211
sm_media_session_create_object
struct pw_proxy * sm_media_session_create_object(struct sm_media_session *sess, const char *factory_name, const char *type, uint32_t version, const struct spa_dict *props, size_t user_data_size)
Definition: media-session.c:1692
pw_properties_get
int int const char * pw_properties_get(const struct pw_properties *properties, const char *key)
Get a property.
Definition: properties.c:487
SPA_PARAM_Profile
@ SPA_PARAM_Profile
profile configuration as SPA_TYPE_OBJECT_ParamProfile
Definition: param.h:53
device::listener
struct spa_hook listener
Definition: alsa-monitor.c:105
node::props
struct pw_properties * props
Definition: alsa-monitor.c:74
impl::device_list
struct spa_list device_list
Definition: alsa-monitor.c:128
PW_VERSION_NODE
#define PW_VERSION_NODE
Definition: src/pipewire/node.h:52
sm_media_session_add_listener
int sm_media_session_add_listener(struct sm_media_session *sess, struct spa_hook *listener, const struct sm_media_session_events *events, void *data)
Definition: media-session.c:1519
device::priority
int priority
Definition: alsa-monitor.c:93
SPA_POD_Int
#define SPA_POD_Int(val)
Definition: vararg.h:59
pw_properties_update
int pw_properties_update(struct pw_properties *props, const struct spa_dict *dict)
Update properties.
Definition: properties.c:298
SPA_TYPE_INTERFACE_Device
#define SPA_TYPE_INTERFACE_Device
Definition: build-12775836/doc/spa/monitor/device.h:50
SPA_KEY_DEVICE_NICK
#define SPA_KEY_DEVICE_NICK
the device short name
Definition: build-12775836/doc/spa/monitor/device.h:264
spa_device
Definition: build-12775836/doc/spa/monitor/device.h:53
string.h
node::link
struct spa_list link
link in impl node_list
Definition: module-filter-chain.c:156
data
user data to add to an object
Definition: filter.c:75
SPA_KEY_DEVICE_DESCRIPTION
#define SPA_KEY_DEVICE_DESCRIPTION
a device description
Definition: build-12775836/doc/spa/monitor/device.h:265
impl::data
uint8_t data[MAX_BUFFER]
Definition: module-profiler.c:87
spa_streq
bool spa_streq(const char *s1, const char *s2)
Definition: string.h:50
spa_list_for_each
#define spa_list_for_each(pos, head, member)
Definition: list.h:111
spa_device_object_info::props
const struct spa_dict * props
extra object properties
Definition: build-12775836/doc/spa/monitor/device.h:92
spa_device_info::props
const struct spa_dict * props
device properties
Definition: build-12775836/doc/spa/monitor/device.h:69
device::impl
struct impl * impl
Definition: alsa-monitor.c:83
impl::listener
struct spa_hook listener
Definition: access-flatpak.c:46
device
Definition: alsa-monitor.c:82
node
Definition: module-filter-chain.c:155
impl
Definition: control.c:33
PW_KEY_DEVICE_PRODUCT_NAME
#define PW_KEY_DEVICE_PRODUCT_NAME
product name if applicable
Definition: src/pipewire/keys.h:227
sm_object_destroy
int sm_object_destroy(struct sm_object *obj)
Definition: media-session.c:359
pw_proxy_destroy
void pw_proxy_destroy(struct pw_proxy *proxy)
destroy a proxy
Definition: proxy.c:229
node.h
spa_list
Definition: list.h:37
device::profile
int profile
Definition: alsa-monitor.c:95
impl::session_listener
struct spa_hook session_listener
Definition: alsa-monitor.c:118
handle
Definition: pipewire.c:68
impl::id
uint32_t id
Definition: module-echo-cancel.c:139
pw_properties_new_dict
struct pw_properties * pw_properties_new_dict(const struct spa_dict *dict)
Make a new properties object from the given dictionary.
Definition: properties.c:126
SPA_POD_BUILDER_INIT
#define SPA_POD_BUILDER_INIT(buffer, size)
Definition: builder.h:71
impl::info
struct spa_audio_info_raw info
Definition: module-echo-cancel.c:145
pw_properties::dict
struct spa_dict dict
dictionary of key/values
Definition: properties.h:50
spa_list_consume
#define spa_list_consume(pos, head, member)
Definition: list.h:96
SPA_TYPE_INTERFACE_Node
#define SPA_TYPE_INTERFACE_Node
Definition: build-12775836/doc/spa/node/node.h:50
node::impl
struct impl * impl
Definition: alsa-monitor.c:68
spa_pod
Definition: pod/pod.h:50
device::sdevice
struct sm_device * sdevice
Definition: alsa-monitor.c:104
SPA_TYPE_OBJECT_ParamProfile
@ SPA_TYPE_OBJECT_ParamProfile
Definition: build-12775836/doc/spa/utils/type.h:94
dict.h
spa_list_remove
void spa_list_remove(struct spa_list *elem)
Definition: list.h:69
impl::handle
struct spa_handle * handle
Definition: alsa-monitor.c:123
PW_TYPE_INTERFACE_Node
#define PW_TYPE_INTERFACE_Node
Definition: src/pipewire/node.h:50
PW_KEY_NODE_DESCRIPTION
#define PW_KEY_NODE_DESCRIPTION
localized human readable node one-line description.
Definition: src/pipewire/keys.h:140
spa_device_object_info::factory_name
const char * factory_name
a factory name that implements the object
Definition: build-12775836/doc/spa/monitor/device.h:86
PW_KEY_NODE_NAME
#define PW_KEY_NODE_NAME
node name
Definition: src/pipewire/keys.h:138
spa_node
Definition: build-12775836/doc/spa/node/node.h:53
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:295
SPA_KEY_DEVICE_NAME
#define SPA_KEY_DEVICE_NAME
the name of the device
Definition: build-12775836/doc/spa/monitor/device.h:262
spa_handle
Definition: plugin.h:44
PW_KEY_DEVICE_DESCRIPTION
#define PW_KEY_DEVICE_DESCRIPTION
localized human readable device one-line description.
Definition: src/pipewire/keys.h:219
SPA_KEY_DEVICE_ALIAS
#define SPA_KEY_DEVICE_ALIAS
alternative name of the device
Definition: build-12775836/doc/spa/monitor/device.h:263
SPA_LOG_LEVEL_DEBUG
@ SPA_LOG_LEVEL_DEBUG
Definition: build-12775836/doc/spa/support/log.h:51
spa_list_init
void spa_list_init(struct spa_list *list)
Definition: list.h:44
node::node
struct spa_node * node
Definition: alsa-monitor.c:76
device::handle
struct spa_handle * handle
Definition: alsa-monitor.c:100
SPA_VERSION_DEVICE_EVENTS
#define SPA_VERSION_DEVICE_EVENTS
version of the structure
Definition: build-12775836/doc/spa/monitor/device.h:119
pw_log_level_enabled
#define pw_log_level_enabled(lev)
Check if a loglevel is enabled.
Definition: src/pipewire/log.h:78
spa_dict
Definition: utils/dict.h:48
SPA_KEY_DEVICE_BUS_ID
#define SPA_KEY_DEVICE_BUS_ID
the device bus-id
Definition: build-12775836/doc/spa/monitor/device.h:272
device.h
spa_device_object_info::type
const char * type
the object type managed by this device
Definition: build-12775836/doc/spa/monitor/device.h:85
sm_object_add_listener
int sm_object_add_listener(struct sm_object *obj, struct spa_hook *listener, const struct sm_object_events *events, void *data)
Definition: media-session.c:1512
spa_debug_dict
int spa_debug_dict(int indent, const struct spa_dict *dict)
Definition: debug/dict.h:43
proxy.h
pw_context_load_spa_handle
struct spa_handle * pw_context_load_spa_handle(struct pw_context *context, const char *factory_name, const struct spa_dict *info)
Definition: context.c:1340
spa_strerror
#define spa_strerror(err)
Definition: result.h:51
result.h
device::id
uint32_t id
Definition: alsa-monitor.c:85
node::device
struct device * device
Definition: alsa-monitor.c:70
spa_device_set_param
#define spa_device_set_param(d,...)
Definition: build-12775836/doc/spa/monitor/device.h:256
pw_log_debug
#define pw_log_debug(...)
Definition: src/pipewire/log.h:89
device::device_listener
struct spa_hook device_listener
Definition: alsa-monitor.c:102
spa_handle_get_interface
#define spa_handle_get_interface(h,...)
Definition: plugin.h:73
impl::monitor
struct spa_device * monitor
Definition: alsa-monitor.c:125
sm_media_session_export_device
struct sm_device * sm_media_session_export_device(struct sm_media_session *sess, const struct spa_dict *props, struct spa_device *object)
Definition: media-session.c:1673
spa_device_info
Information about the device and parameters it supports.
Definition: build-12775836/doc/spa/monitor/device.h:60
pw_unload_spa_handle
int pw_unload_spa_handle(struct spa_handle *handle)
Definition: pipewire.c:321
impl::context
struct pw_context * context
Definition: settings.c:43
pw_properties_set
int pw_properties_set(struct pw_properties *properties, const char *key, const char *value)
Set a property value.
Definition: properties.c:435
impl::session
struct sm_media_session * session
Definition: access-flatpak.c:45
PW_KEY_DEVICE_ID
#define PW_KEY_DEVICE_ID
device properties
Definition: src/pipewire/keys.h:210
PW_KEY_FACTORY_NAME
#define PW_KEY_FACTORY_NAME
the name of the factory
Definition: src/pipewire/keys.h:260
pw_log_warn
#define pw_log_warn(...)
Definition: src/pipewire/log.h:87
device::device
struct spa_device * device
Definition: alsa-monitor.c:101
sm_object_sync_update
int sm_object_sync_update(struct sm_object *obj)
Definition: media-session.c:1163
device::node_list
struct spa_list node_list
Definition: alsa-monitor.c:113
SPA_PARAM_PROFILE_index
@ SPA_PARAM_PROFILE_index
profile index (Int)
Definition: param.h:113
device::device_id
uint32_t device_id
Definition: alsa-monitor.c:86
spa_pod_builder_add_object
#define spa_pod_builder_add_object(b, type, id,...)
Definition: builder.h:650
SPA_KEY_DEVICE_BUS_PATH
#define SPA_KEY_DEVICE_BUS_PATH
bus path to the device in the OS' format.
Definition: build-12775836/doc/spa/monitor/device.h:273
defs.h
spa_hook_remove
void spa_hook_remove(struct spa_hook *hook)
Remove a hook.
Definition: hook.h:336
pipewire.h
names.h
spa_device_add_listener
#define spa_device_add_listener(d,...)
Definition: build-12775836/doc/spa/monitor/device.h:253
SPA_NAME_API_LIBCAMERA_ENUM_CLIENT
#define SPA_NAME_API_LIBCAMERA_ENUM_CLIENT
keys for libcamera factory names
Definition: names.h:126
device::props
struct pw_properties * props
Definition: alsa-monitor.c:98
device::link
struct spa_list link
Definition: alsa-monitor.c:84
device::appeared
unsigned int appeared
Definition: alsa-monitor.c:110
pw_properties_setf
int pw_properties_setf(struct pw_properties *properties, const char *key, const char *format,...) 1(3
spa_device_events
spa_device_events:
Definition: build-12775836/doc/spa/monitor/device.h:117
spa_pod_builder
Definition: builder.h:63
hook.h
props.h
spa_device_object_info
Information about a device object.
Definition: build-12775836/doc/spa/monitor/device.h:81
sm_libcamera_monitor_start
int sm_libcamera_monitor_start(struct sm_media_session *sess)
Definition: libcamera-monitor.c:465
builder.h
pw_properties
Definition: properties.h:49
pw_properties_free
void pw_properties_free(struct pw_properties *properties)
Free a properties object.
Definition: properties.c:364
node::id
uint32_t id
Definition: alsa-monitor.c:72
pw_log_error
#define pw_log_error(...)
Definition: src/pipewire/log.h:86
spa_list_append
#define spa_list_append(list, item)
Definition: list.h:81
node::proxy
struct pw_proxy * proxy
Definition: v4l2-monitor.c:61