Debian Codegraph @

lib/wp/core.h

raw
1 /* WirePlumber
2 *
3 * Copyright © 2019 Collabora Ltd.
4 * @author George Kiagiadakis <[email protected]>
5 *
6 * SPDX-License-Identifier: MIT
7 */
8
9 #ifndef __WIREPLUMBER_CORE_H__
10 #define __WIREPLUMBER_CORE_H__
11
12 #include "object.h"
13 #include "properties.h"
14 #include "spa-json.h"
15 #include "conf.h"
16
17 G_BEGIN_DECLS
18
19 struct pw_context;
20 struct pw_core;
21 typedef struct _WpObjectManager WpObjectManager;
22
23 /*!
24 * \brief Flags to be used as WpObjectFeatures on WpCore
25 * \ingroup wpcore
26 */
27 typedef enum { /*< flags >*/
28 /*! connects to pipewire */
29 WP_CORE_FEATURE_CONNECTED = (1 << 0),
30 /*! loads components defined in the configuration */
31 WP_CORE_FEATURE_COMPONENTS = (1 << 1),
32 } WpCoreFeatures;
33
34 /*!
35 * \brief The WpCore GType
36 * \ingroup wpcore
37 */
38 #define WP_TYPE_CORE (wp_core_get_type ())
39 WP_API
40 G_DECLARE_FINAL_TYPE (WpCore, wp_core, WP, CORE, WpObject)
41
42 /* Basic */
43
44 WP_API
45 WpCore * wp_core_new (GMainContext * context, WpConf * conf,
46 WpProperties * properties);
47
48 WP_API
49 WpCore * wp_core_clone (WpCore * self);
50
51 WP_API
52 WpCore * wp_core_get_export_core (WpCore * self);
53
54 WP_API
55 WpConf * wp_core_get_conf (WpCore * self);
56
57 WP_API
58 GMainContext * wp_core_get_g_main_context (WpCore * self);
59
60 WP_API
61 struct pw_context * wp_core_get_pw_context (WpCore * self);
62
63 WP_API
64 struct pw_core * wp_core_get_pw_core (WpCore * self);
65
66 WP_API
67 gchar *wp_core_get_vm_type (WpCore *self);
68
69 /* Connection */
70
71 WP_API
72 gboolean wp_core_connect (WpCore *self);
73
74 WP_API
75 gboolean wp_core_connect_fd (WpCore *self, int fd);
76
77 WP_API
78 void wp_core_disconnect (WpCore *self);
79
80 WP_API
81 gboolean wp_core_is_connected (WpCore * self);
82
83 /* Properties */
84
85 WP_API
86 guint32 wp_core_get_own_bound_id (WpCore * self);
87
88 WP_API
89 guint32 wp_core_get_remote_cookie (WpCore * self);
90
91 WP_API
92 const gchar * wp_core_get_remote_name (WpCore * self);
93
94 WP_API
95 const gchar * wp_core_get_remote_user_name (WpCore * self);
96
97 WP_API
98 const gchar * wp_core_get_remote_host_name (WpCore * self);
99
100 WP_API
101 const gchar * wp_core_get_remote_version (WpCore * self);
102
103 WP_API
104 WpProperties * wp_core_get_remote_properties (WpCore * self);
105
106 WP_API
107 WpProperties * wp_core_get_properties (WpCore * self);
108
109 WP_API
110 void wp_core_update_properties (WpCore * self, WpProperties * updates);
111
112 /* Callback */
113
114 WP_API
115 void wp_core_idle_add (WpCore * self, GSource **source, GSourceFunc function,
116 gpointer data, GDestroyNotify destroy);
117
118 WP_API
119 void wp_core_idle_add_closure (WpCore * self, GSource **source,
120 GClosure * closure);
121
122 WP_API
123 void wp_core_timeout_add (WpCore * self, GSource **source, guint timeout_ms,
124 GSourceFunc function, gpointer data, GDestroyNotify destroy);
125
126 WP_API
127 void wp_core_timeout_add_closure (WpCore * self, GSource **source,
128 guint timeout_ms, GClosure * closure);
129
130 WP_API
131 gboolean wp_core_sync (WpCore * self, GCancellable * cancellable,
132 GAsyncReadyCallback callback, gpointer user_data);
133
134 WP_API
135 gboolean wp_core_sync_closure (WpCore * self, GCancellable * cancellable,
136 GClosure * closure);
137
138 WP_API
139 gboolean wp_core_sync_finish (WpCore * self, GAsyncResult * res,
140 GError ** error);
141
142 /* Object Registry */
143
144 WP_API
145 gpointer wp_core_find_object (WpCore * self, GEqualFunc func,
146 gconstpointer data);
147
148 WP_API
149 void wp_core_register_object (WpCore * self, gpointer obj);
150
151 WP_API
152 void wp_core_remove_object (WpCore * self, gpointer obj);
153
154 /* Object Manager */
155
156 WP_API
157 void wp_core_install_object_manager (WpCore * self, WpObjectManager * om);
158
159 /* Global Features */
160
161 WP_API
162 gboolean wp_core_test_feature (WpCore * self, const gchar * feature);
163
164 G_END_DECLS
165
166 #endif