PipeWire  1.4.1
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_LINK_PERM_MASK PW_PERM_R | PW_PERM_X
35 
36 #define PW_VERSION_LINK 3
37 struct pw_link;
38 
39 #ifndef PW_API_LINK_IMPL
40 #define PW_API_LINK_IMPL static inline
41 #endif
42 
43 
45 enum pw_link_state {
46  PW_LINK_STATE_ERROR = -2,
48  PW_LINK_STATE_INIT = 0,
53 };
54 
56 const char * pw_link_state_as_string(enum pw_link_state state);
58 struct pw_link_info {
59  uint32_t id;
60  uint32_t output_node_id;
61  uint32_t output_port_id;
62  uint32_t input_node_id;
63  uint32_t input_port_id;
64 #define PW_LINK_CHANGE_MASK_STATE (1 << 0)
65 #define PW_LINK_CHANGE_MASK_FORMAT (1 << 1)
66 #define PW_LINK_CHANGE_MASK_PROPS (1 << 2)
67 #define PW_LINK_CHANGE_MASK_ALL ((1 << 3)-1)
68  uint64_t change_mask;
70  const char *error;
71  struct spa_pod *format;
72  struct spa_dict *props;
73 };
74 
75 struct pw_link_info *
77  const struct pw_link_info *update);
78 
79 struct pw_link_info *
81  const struct pw_link_info *update, bool reset);
82 
83 void
85 
86 
87 #define PW_LINK_EVENT_INFO 0
88 #define PW_LINK_EVENT_NUM 1
89 
91 struct pw_link_events {
92 #define PW_VERSION_LINK_EVENTS 0
93  uint32_t version;
99  void (*info) (void *data, const struct pw_link_info *info);
100 };
101 
102 #define PW_LINK_METHOD_ADD_LISTENER 0
103 #define PW_LINK_METHOD_NUM 1
104 
107 #define PW_VERSION_LINK_METHODS 0
108  uint32_t version;
109 
110  int (*add_listener) (void *object,
111  struct spa_hook *listener,
112  const struct pw_link_events *events,
113  void *data);
114 };
115 
119  struct spa_hook *listener,
120  const struct pw_link_events *events,
121  void *data)
122 {
123  return spa_api_method_r(int, -ENOTSUP,
124  pw_link, (struct spa_interface*)object, add_listener, 0,
125  listener, events, data);
126 }
127 
132 #ifdef __cplusplus
133 } /* extern "C" */
134 #endif
135 
136 #endif /* PIPEWIRE_LINK_H */
spa/utils/defs.h
#define spa_api_method_r(rtype, def, type, o, method, version,...)
Definition: hook.h:291
spa/utils/hook.h
pipewire/proxy.h
Definition: dict.h:51
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:427
Definition: hook.h:148
Definition: pod.h:43