Debian Codegraph @

lib/wp/proxy.h

raw
1 /* WirePlumber
2 *
3 * Copyright © 2020 Collabora Ltd.
4 * @author George Kiagiadakis <[email protected]>
5 *
6 * SPDX-License-Identifier: MIT
7 */
8
9 #ifndef __WIREPLUMBER_PROXY_H__
10 #define __WIREPLUMBER_PROXY_H__
11
12 #include "object.h"
13
14 G_BEGIN_DECLS
15
16 struct pw_proxy;
17
18 /*!
19 * \brief Flags to be used as WpObjectFeatures for WpProxy subclasses.
20 * \ingroup wpproxy
21 */
22 typedef enum { /*< flags >*/
23 /* standard features */
24 WP_PROXY_FEATURE_BOUND = (1 << 0),
25
26 /* WpPipewireObjectInterface */
27 WP_PIPEWIRE_OBJECT_FEATURE_INFO = (1 << 4),
28 WP_PIPEWIRE_OBJECT_FEATURE_PARAM_PROPS = (1 << 5),
29 WP_PIPEWIRE_OBJECT_FEATURE_PARAM_FORMAT = (1 << 6),
30 WP_PIPEWIRE_OBJECT_FEATURE_PARAM_PROFILE = (1 << 7),
31 WP_PIPEWIRE_OBJECT_FEATURE_PARAM_PORT_CONFIG = (1 << 8),
32 WP_PIPEWIRE_OBJECT_FEATURE_PARAM_ROUTE = (1 << 9),
33
34 /*!
35 * The minimal feature set for proxies implementing WpPipewireObject.
36 * This is a subset of \em WP_PIPEWIRE_OBJECT_FEATURES_ALL
37 */
38 WP_PIPEWIRE_OBJECT_FEATURES_MINIMAL =
39 (WP_PROXY_FEATURE_BOUND | WP_PIPEWIRE_OBJECT_FEATURE_INFO),
40
41 /*!
42 * The complete common feature set for proxies implementing
43 * WpPipewireObject. This is a subset of \em WP_OBJECT_FEATURES_ALL
44 */
45 WP_PIPEWIRE_OBJECT_FEATURES_ALL =
46 (WP_PIPEWIRE_OBJECT_FEATURES_MINIMAL |
47 WP_PIPEWIRE_OBJECT_FEATURE_PARAM_PROPS |
48 WP_PIPEWIRE_OBJECT_FEATURE_PARAM_FORMAT |
49 WP_PIPEWIRE_OBJECT_FEATURE_PARAM_PROFILE |
50 WP_PIPEWIRE_OBJECT_FEATURE_PARAM_PORT_CONFIG |
51 WP_PIPEWIRE_OBJECT_FEATURE_PARAM_ROUTE),
52
53 WP_PROXY_FEATURE_CUSTOM_START = (1 << 16), /*< skip >*/
54 } WpProxyFeatures;
55
56 /*!
57 * \brief The WpProxy GType
58 * \ingroup wpproxy
59 */
60 #define WP_TYPE_PROXY (wp_proxy_get_type ())
61 WP_API
62 G_DECLARE_DERIVABLE_TYPE (WpProxy, wp_proxy, WP, PROXY, WpObject)
63
64 struct _WpProxyClass
65 {
66 WpObjectClass parent_class;
67
68 /*! \brief the PipeWire type of the interface that is being proxied by
69 * this class (ex. `PW_TYPE_INTERFACE_Node` for WpNode */
70 const gchar * pw_iface_type;
71
72 /*! \brief the PipeWire version of the interface that is being
73 * proxied by this class */
74 guint32 pw_iface_version;
75
76 /* signals */
77
78 void (*pw_proxy_created) (WpProxy * self, struct pw_proxy * proxy);
79 void (*pw_proxy_destroyed) (WpProxy * self);
80 void (*bound) (WpProxy * self, guint32 id);
81 void (*error) (WpProxy * self, int seq, int res, const char *message);
82
83 /*< private >*/
84 WP_PADDING(6)
85 };
86
87 WP_API
88 guint32 wp_proxy_get_bound_id (WpProxy * self);
89
90 WP_API
91 const gchar * wp_proxy_get_interface_type (WpProxy * self, guint32 * version);
92
93 WP_API
94 struct pw_proxy * wp_proxy_get_pw_proxy (WpProxy * self);
95
96 /* for subclasses only */
97
98 WP_API
99 void wp_proxy_set_pw_proxy (WpProxy * self, struct pw_proxy * proxy);
100
101 G_END_DECLS
102
103 #endif