PipeWire  0.3.29
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;
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 */
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:76
Definition: utils/dict.h:48
Definition: pod/pod.h:50
Definition: filter.c:75