PipeWire  0.3.66
link.h
Go to the documentation of this file.
1 /* PipeWire */
2 /* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
3 /* SPDX-License-Identifier: MIT */
4 
5 #ifndef PIPEWIRE_LINK_H
6 #define PIPEWIRE_LINK_H
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #include <spa/utils/defs.h>
13 #include <spa/utils/hook.h>
14 
15 #include <pipewire/proxy.h>
16 
32 #define PW_TYPE_INTERFACE_Link PW_TYPE_INFO_INTERFACE_BASE "Link"
33 
34 #define PW_VERSION_LINK 3
35 struct pw_link;
36 
38 enum pw_link_state {
39  PW_LINK_STATE_ERROR = -2,
46 };
47 
49 const char * pw_link_state_as_string(enum pw_link_state state);
51 struct pw_link_info {
52  uint32_t id;
53  uint32_t output_node_id;
54  uint32_t output_port_id;
55  uint32_t input_node_id;
56  uint32_t input_port_id;
57 #define PW_LINK_CHANGE_MASK_STATE (1 << 0)
58 #define PW_LINK_CHANGE_MASK_FORMAT (1 << 1)
59 #define PW_LINK_CHANGE_MASK_PROPS (1 << 2)
60 #define PW_LINK_CHANGE_MASK_ALL ((1 << 3)-1)
61  uint64_t change_mask;
63  const char *error;
64  struct spa_pod *format;
65  struct spa_dict *props;
66 };
67 
68 struct pw_link_info *
70  const struct pw_link_info *update);
71 
72 struct pw_link_info *
73 pw_link_info_merge(struct pw_link_info *info,
74  const struct pw_link_info *update, bool reset);
75 
76 void
77 pw_link_info_free(struct pw_link_info *info);
78 
79 
80 #define PW_LINK_EVENT_INFO 0
81 #define PW_LINK_EVENT_NUM 1
82 
84 struct pw_link_events {
85 #define PW_VERSION_LINK_EVENTS 0
86  uint32_t version;
92  void (*info) (void *data, const struct pw_link_info *info);
93 };
94 
95 #define PW_LINK_METHOD_ADD_LISTENER 0
96 #define PW_LINK_METHOD_NUM 1
97 
100 #define PW_VERSION_LINK_METHODS 0
101  uint32_t version;
102 
103  int (*add_listener) (void *object,
104  struct spa_hook *listener,
105  const struct pw_link_events *events,
106  void *data);
107 };
108 
109 #define pw_link_method(o,method,version,...) \
110 ({ \
111  int _res = -ENOTSUP; \
112  spa_interface_call_res((struct spa_interface*)o, \
113  struct pw_link_methods, _res, \
114  method, version, ##__VA_ARGS__); \
115  _res; \
116 })
117 
118 #define pw_link_add_listener(c,...) pw_link_method(c,add_listener,0,__VA_ARGS__)
119 
124 #ifdef __cplusplus
125 } /* extern "C" */
126 #endif
127 
128 #endif /* PIPEWIRE_LINK_H */
spa/utils/defs.h
spa/utils/hook.h
pipewire/proxy.h
Definition: utils/dict.h:39
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:331
Definition: pod/pod.h:43