Branch data Line data Source code
1 : : #ifndef foodefhfoo
2 : : #define foodefhfoo
3 : :
4 : : /***
5 : : This file is part of PulseAudio.
6 : :
7 : : Copyright 2004-2006 Lennart Poettering
8 : : Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
9 : :
10 : : PulseAudio is free software; you can redistribute it and/or modify
11 : : it under the terms of the GNU Lesser General Public License as
12 : : published by the Free Software Foundation; either version 2.1 of the
13 : : License, or (at your option) any later version.
14 : :
15 : : PulseAudio is distributed in the hope that it will be useful, but
16 : : WITHOUT ANY WARRANTY; without even the implied warranty of
17 : : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 : : Lesser General Public License for more details.
19 : :
20 : : You should have received a copy of the GNU Lesser General Public
21 : : License along with PulseAudio; if not, write to the Free Software
22 : : Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 : : USA.
24 : : ***/
25 : :
26 : : #include <inttypes.h>
27 : : #include <sys/time.h>
28 : :
29 : : #include <pulse/cdecl.h>
30 : : #include <pulse/sample.h>
31 : : #include <pulse/version.h>
32 : :
33 : : /** \file
34 : : * Global definitions */
35 : :
36 : : PA_C_DECL_BEGIN
37 : :
38 : : /** The state of a connection context */
39 : : typedef enum pa_context_state {
40 : : PA_CONTEXT_UNCONNECTED, /**< The context hasn't been connected yet */
41 : : PA_CONTEXT_CONNECTING, /**< A connection is being established */
42 : : PA_CONTEXT_AUTHORIZING, /**< The client is authorizing itself to the daemon */
43 : : PA_CONTEXT_SETTING_NAME, /**< The client is passing its application name to the daemon */
44 : : PA_CONTEXT_READY, /**< The connection is established, the context is ready to execute operations */
45 : : PA_CONTEXT_FAILED, /**< The connection failed or was disconnected */
46 : : PA_CONTEXT_TERMINATED /**< The connection was terminated cleanly */
47 : : } pa_context_state_t;
48 : :
49 : : /** Return non-zero if the passed state is one of the connected states. \since 0.9.11 */
50 : : static inline int PA_CONTEXT_IS_GOOD(pa_context_state_t x) {
51 : : return
52 : : x == PA_CONTEXT_CONNECTING ||
53 : : x == PA_CONTEXT_AUTHORIZING ||
54 : 0 : x == PA_CONTEXT_SETTING_NAME ||
55 : : x == PA_CONTEXT_READY;
56 : : }
57 : :
58 : : /** \cond fulldocs */
59 : : #define PA_CONTEXT_UNCONNECTED PA_CONTEXT_UNCONNECTED
60 : : #define PA_CONTEXT_CONNECTING PA_CONTEXT_CONNECTING
61 : : #define PA_CONTEXT_AUTHORIZING PA_CONTEXT_AUTHORIZING
62 : : #define PA_CONTEXT_SETTING_NAME PA_CONTEXT_SETTING_NAME
63 : : #define PA_CONTEXT_READY PA_CONTEXT_READY
64 : : #define PA_CONTEXT_FAILED PA_CONTEXT_FAILED
65 : : #define PA_CONTEXT_TERMINATED PA_CONTEXT_TERMINATED
66 : : #define PA_CONTEXT_IS_GOOD PA_CONTEXT_IS_GOOD
67 : : /** \endcond */
68 : :
69 : : /** The state of a stream */
70 : : typedef enum pa_stream_state {
71 : : PA_STREAM_UNCONNECTED, /**< The stream is not yet connected to any sink or source */
72 : : PA_STREAM_CREATING, /**< The stream is being created */
73 : : PA_STREAM_READY, /**< The stream is established, you may pass audio data to it now */
74 : : PA_STREAM_FAILED, /**< An error occurred that made the stream invalid */
75 : : PA_STREAM_TERMINATED /**< The stream has been terminated cleanly */
76 : : } pa_stream_state_t;
77 : :
78 : : /** Return non-zero if the passed state is one of the connected states. \since 0.9.11 */
79 : : static inline int PA_STREAM_IS_GOOD(pa_stream_state_t x) {
80 : : return
81 : : x == PA_STREAM_CREATING ||
82 : : x == PA_STREAM_READY;
83 : : }
84 : :
85 : : /** \cond fulldocs */
86 : : #define PA_STREAM_UNCONNECTED PA_STREAM_UNCONNECTED
87 : : #define PA_STREAM_CREATING PA_STREAM_CREATING
88 : : #define PA_STREAM_READY PA_STREAM_READY
89 : : #define PA_STREAM_FAILED PA_STREAM_FAILED
90 : : #define PA_STREAM_TERMINATED PA_STREAM_TERMINATED
91 : : #define PA_STREAM_IS_GOOD PA_STREAM_IS_GOOD
92 : : /** \endcond */
93 : :
94 : : /** The state of an operation */
95 : : typedef enum pa_operation_state {
96 : : PA_OPERATION_RUNNING, /**< The operation is still running */
97 : : PA_OPERATION_DONE, /**< The operation has been completed */
98 : : PA_OPERATION_CANCELLED /**< The operation has been cancelled. Before 0.9.18 this was called PA_OPERATION_CANCELED. That name is still available for compatibility. */
99 : : } pa_operation_state_t;
100 : :
101 : : /** \cond fulldocs */
102 : : #define PA_OPERATION_RUNNING PA_OPERATION_RUNNING
103 : : #define PA_OPERATION_DONE PA_OPERATION_DONE
104 : : #define PA_OPERATION_CANCELED PA_OPERATION_CANCELLED
105 : : #define PA_OPERATION_CANCELLED PA_OPERATION_CANCELLED
106 : : /** \endcond */
107 : :
108 : : /** An invalid index */
109 : : #define PA_INVALID_INDEX ((uint32_t) -1)
110 : :
111 : : /** Some special flags for contexts. */
112 : : typedef enum pa_context_flags {
113 : : PA_CONTEXT_NOFLAGS = 0x0000U,
114 : : /**< Flag to pass when no specific options are needed (used to avoid casting) \since 0.9.19 */
115 : : PA_CONTEXT_NOAUTOSPAWN = 0x0001U,
116 : : /**< Disabled autospawning of the PulseAudio daemon if required */
117 : : PA_CONTEXT_NOFAIL = 0x0002U
118 : : /**< Don't fail if the daemon is not available when pa_context_connect() is called, instead enter PA_CONTEXT_CONNECTING state and wait for the daemon to appear. \since 0.9.15 */
119 : : } pa_context_flags_t;
120 : :
121 : : /** \cond fulldocs */
122 : : /* Allow clients to check with #ifdef for those flags */
123 : : #define PA_CONTEXT_NOAUTOSPAWN PA_CONTEXT_NOAUTOSPAWN
124 : : #define PA_CONTEXT_NOFAIL PA_CONTEXT_NOFAIL
125 : : /** \endcond */
126 : :
127 : : /** Direction bitfield - while we currently do not expose anything bidirectional,
128 : : one should test against the bit instead of the value (e g if (d & PA_DIRECTION_OUTPUT)),
129 : : because we might add bidirectional stuff in the future. \since 2.0
130 : : */
131 : : typedef enum pa_direction {
132 : : PA_DIRECTION_OUTPUT = 0x0001U, /**< Output direction */
133 : : PA_DIRECTION_INPUT = 0x0002U /**< Input direction */
134 : : } pa_direction_t;
135 : :
136 : : /** \cond fulldocs */
137 : : #define PA_DIRECTION_OUTPUT PA_DIRECTION_OUTPUT
138 : : #define PA_DIRECTION_INPUT PA_DIRECTION_INPUT
139 : : /** \endcond */
140 : :
141 : : /** The type of device we are dealing with */
142 : : typedef enum pa_device_type {
143 : : PA_DEVICE_TYPE_SINK, /**< Playback device */
144 : : PA_DEVICE_TYPE_SOURCE /**< Recording device */
145 : : } pa_device_type_t;
146 : :
147 : : /** \cond fulldocs */
148 : : #define PA_DEVICE_TYPE_SINK PA_DEVICE_TYPE_SINK
149 : : #define PA_DEVICE_TYPE_SOURCE PA_DEVICE_TYPE_SOURCE
150 : : /** \endcond */
151 : :
152 : : /** The direction of a pa_stream object */
153 : : typedef enum pa_stream_direction {
154 : : PA_STREAM_NODIRECTION, /**< Invalid direction */
155 : : PA_STREAM_PLAYBACK, /**< Playback stream */
156 : : PA_STREAM_RECORD, /**< Record stream */
157 : : PA_STREAM_UPLOAD /**< Sample upload stream */
158 : : } pa_stream_direction_t;
159 : :
160 : : /** \cond fulldocs */
161 : : #define PA_STREAM_NODIRECTION PA_STREAM_NODIRECTION
162 : : #define PA_STREAM_PLAYBACK PA_STREAM_PLAYBACK
163 : : #define PA_STREAM_RECORD PA_STREAM_RECORD
164 : : #define PA_STREAM_UPLOAD PA_STREAM_UPLOAD
165 : : /** \endcond */
166 : :
167 : : /** Some special flags for stream connections. */
168 : : typedef enum pa_stream_flags {
169 : :
170 : : PA_STREAM_NOFLAGS = 0x0000U,
171 : : /**< Flag to pass when no specific options are needed (used to avoid casting) \since 0.9.19 */
172 : :
173 : : PA_STREAM_START_CORKED = 0x0001U,
174 : : /**< Create the stream corked, requiring an explicit
175 : : * pa_stream_cork() call to uncork it. */
176 : :
177 : : PA_STREAM_INTERPOLATE_TIMING = 0x0002U,
178 : : /**< Interpolate the latency for this stream. When enabled,
179 : : * pa_stream_get_latency() and pa_stream_get_time() will try to
180 : : * estimate the current record/playback time based on the local
181 : : * time that passed since the last timing info update. Using this
182 : : * option has the advantage of not requiring a whole roundtrip
183 : : * when the current playback/recording time is needed. Consider
184 : : * using this option when requesting latency information
185 : : * frequently. This is especially useful on long latency network
186 : : * connections. It makes a lot of sense to combine this option
187 : : * with PA_STREAM_AUTO_TIMING_UPDATE. */
188 : :
189 : : PA_STREAM_NOT_MONOTONIC = 0x0004U,
190 : : /**< Don't force the time to increase monotonically. If this
191 : : * option is enabled, pa_stream_get_time() will not necessarily
192 : : * return always monotonically increasing time values on each
193 : : * call. This may confuse applications which cannot deal with time
194 : : * going 'backwards', but has the advantage that bad transport
195 : : * latency estimations that caused the time to to jump ahead can
196 : : * be corrected quickly, without the need to wait. (Please note
197 : : * that this flag was named PA_STREAM_NOT_MONOTONOUS in releases
198 : : * prior to 0.9.11. The old name is still defined too, for
199 : : * compatibility reasons. */
200 : :
201 : : PA_STREAM_AUTO_TIMING_UPDATE = 0x0008U,
202 : : /**< If set timing update requests are issued periodically
203 : : * automatically. Combined with PA_STREAM_INTERPOLATE_TIMING you
204 : : * will be able to query the current time and latency with
205 : : * pa_stream_get_time() and pa_stream_get_latency() at all times
206 : : * without a packet round trip.*/
207 : :
208 : : PA_STREAM_NO_REMAP_CHANNELS = 0x0010U,
209 : : /**< Don't remap channels by their name, instead map them simply
210 : : * by their index. Implies PA_STREAM_NO_REMIX_CHANNELS. Only
211 : : * supported when the server is at least PA 0.9.8. It is ignored
212 : : * on older servers.\since 0.9.8 */
213 : :
214 : : PA_STREAM_NO_REMIX_CHANNELS = 0x0020U,
215 : : /**< When remapping channels by name, don't upmix or downmix them
216 : : * to related channels. Copy them into matching channels of the
217 : : * device 1:1. Only supported when the server is at least PA
218 : : * 0.9.8. It is ignored on older servers. \since 0.9.8 */
219 : :
220 : : PA_STREAM_FIX_FORMAT = 0x0040U,
221 : : /**< Use the sample format of the sink/device this stream is being
222 : : * connected to, and possibly ignore the format the sample spec
223 : : * contains -- but you still have to pass a valid value in it as a
224 : : * hint to PulseAudio what would suit your stream best. If this is
225 : : * used you should query the used sample format after creating the
226 : : * stream by using pa_stream_get_sample_spec(). Also, if you
227 : : * specified manual buffer metrics it is recommended to update
228 : : * them with pa_stream_set_buffer_attr() to compensate for the
229 : : * changed frame sizes. Only supported when the server is at least
230 : : * PA 0.9.8. It is ignored on older servers. \since 0.9.8 */
231 : :
232 : : PA_STREAM_FIX_RATE = 0x0080U,
233 : : /**< Use the sample rate of the sink, and possibly ignore the rate
234 : : * the sample spec contains. Usage similar to
235 : : * PA_STREAM_FIX_FORMAT.Only supported when the server is at least
236 : : * PA 0.9.8. It is ignored on older servers. \since 0.9.8 */
237 : :
238 : : PA_STREAM_FIX_CHANNELS = 0x0100,
239 : : /**< Use the number of channels and the channel map of the sink,
240 : : * and possibly ignore the number of channels and the map the
241 : : * sample spec and the passed channel map contains. Usage similar
242 : : * to PA_STREAM_FIX_FORMAT. Only supported when the server is at
243 : : * least PA 0.9.8. It is ignored on older servers. \since 0.9.8 */
244 : :
245 : : PA_STREAM_DONT_MOVE = 0x0200U,
246 : : /**< Don't allow moving of this stream to another
247 : : * sink/device. Useful if you use any of the PA_STREAM_FIX_ flags
248 : : * and want to make sure that resampling never takes place --
249 : : * which might happen if the stream is moved to another
250 : : * sink/source with a different sample spec/channel map. Only
251 : : * supported when the server is at least PA 0.9.8. It is ignored
252 : : * on older servers. \since 0.9.8 */
253 : :
254 : : PA_STREAM_VARIABLE_RATE = 0x0400U,
255 : : /**< Allow dynamic changing of the sampling rate during playback
256 : : * with pa_stream_update_sample_rate(). Only supported when the
257 : : * server is at least PA 0.9.8. It is ignored on older
258 : : * servers. \since 0.9.8 */
259 : :
260 : : PA_STREAM_PEAK_DETECT = 0x0800U,
261 : : /**< Find peaks instead of resampling. \since 0.9.11 */
262 : :
263 : : PA_STREAM_START_MUTED = 0x1000U,
264 : : /**< Create in muted state. If neither PA_STREAM_START_UNMUTED nor
265 : : * PA_STREAM_START_MUTED it is left to the server to decide
266 : : * whether to create the stream in muted or in unmuted
267 : : * state. \since 0.9.11 */
268 : :
269 : : PA_STREAM_ADJUST_LATENCY = 0x2000U,
270 : : /**< Try to adjust the latency of the sink/source based on the
271 : : * requested buffer metrics and adjust buffer metrics
272 : : * accordingly. Also see pa_buffer_attr. This option may not be
273 : : * specified at the same time as PA_STREAM_EARLY_REQUESTS. \since
274 : : * 0.9.11 */
275 : :
276 : : PA_STREAM_EARLY_REQUESTS = 0x4000U,
277 : : /**< Enable compatibility mode for legacy clients that rely on a
278 : : * "classic" hardware device fragment-style playback model. If
279 : : * this option is set, the minreq value of the buffer metrics gets
280 : : * a new meaning: instead of just specifying that no requests
281 : : * asking for less new data than this value will be made to the
282 : : * client it will also guarantee that requests are generated as
283 : : * early as this limit is reached. This flag should only be set in
284 : : * very few situations where compatibility with a fragment-based
285 : : * playback model needs to be kept and the client applications
286 : : * cannot deal with data requests that are delayed to the latest
287 : : * moment possible. (Usually these are programs that use usleep()
288 : : * or a similar call in their playback loops instead of sleeping
289 : : * on the device itself.) Also see pa_buffer_attr. This option may
290 : : * not be specified at the same time as
291 : : * PA_STREAM_ADJUST_LATENCY. \since 0.9.12 */
292 : :
293 : : PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND = 0x8000U,
294 : : /**< If set this stream won't be taken into account when we it is
295 : : * checked whether the device this stream is connected to should
296 : : * auto-suspend. \since 0.9.15 */
297 : :
298 : : PA_STREAM_START_UNMUTED = 0x10000U,
299 : : /**< Create in unmuted state. If neither PA_STREAM_START_UNMUTED
300 : : * nor PA_STREAM_START_MUTED it is left to the server to decide
301 : : * whether to create the stream in muted or in unmuted
302 : : * state. \since 0.9.15 */
303 : :
304 : : PA_STREAM_FAIL_ON_SUSPEND = 0x20000U,
305 : : /**< If the sink/source this stream is connected to is suspended
306 : : * during the creation of this stream, cause it to fail. If the
307 : : * sink/source is being suspended during creation of this stream,
308 : : * make sure this stream is terminated. \since 0.9.15 */
309 : :
310 : : PA_STREAM_RELATIVE_VOLUME = 0x40000U,
311 : : /**< If a volume is passed when this stream is created, consider
312 : : * it relative to the sink's current volume, never as absolute
313 : : * device volume. If this is not specified the volume will be
314 : : * consider absolute when the sink is in flat volume mode,
315 : : * relative otherwise. \since 0.9.20 */
316 : :
317 : : PA_STREAM_PASSTHROUGH = 0x80000U
318 : : /**< Used to tag content that will be rendered by passthrough sinks.
319 : : * The data will be left as is and not reformatted, resampled.
320 : : * \since 1.0 */
321 : :
322 : : } pa_stream_flags_t;
323 : :
324 : : /** \cond fulldocs */
325 : :
326 : : /* English is an evil language */
327 : : #define PA_STREAM_NOT_MONOTONOUS PA_STREAM_NOT_MONOTONIC
328 : :
329 : : /* Allow clients to check with #ifdef for those flags */
330 : : #define PA_STREAM_START_CORKED PA_STREAM_START_CORKED
331 : : #define PA_STREAM_INTERPOLATE_TIMING PA_STREAM_INTERPOLATE_TIMING
332 : : #define PA_STREAM_NOT_MONOTONIC PA_STREAM_NOT_MONOTONIC
333 : : #define PA_STREAM_AUTO_TIMING_UPDATE PA_STREAM_AUTO_TIMING_UPDATE
334 : : #define PA_STREAM_NO_REMAP_CHANNELS PA_STREAM_NO_REMAP_CHANNELS
335 : : #define PA_STREAM_NO_REMIX_CHANNELS PA_STREAM_NO_REMIX_CHANNELS
336 : : #define PA_STREAM_FIX_FORMAT PA_STREAM_FIX_FORMAT
337 : : #define PA_STREAM_FIX_RATE PA_STREAM_FIX_RATE
338 : : #define PA_STREAM_FIX_CHANNELS PA_STREAM_FIX_CHANNELS
339 : : #define PA_STREAM_DONT_MOVE PA_STREAM_DONT_MOVE
340 : : #define PA_STREAM_VARIABLE_RATE PA_STREAM_VARIABLE_RATE
341 : : #define PA_STREAM_PEAK_DETECT PA_STREAM_PEAK_DETECT
342 : : #define PA_STREAM_START_MUTED PA_STREAM_START_MUTED
343 : : #define PA_STREAM_ADJUST_LATENCY PA_STREAM_ADJUST_LATENCY
344 : : #define PA_STREAM_EARLY_REQUESTS PA_STREAM_EARLY_REQUESTS
345 : : #define PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND
346 : : #define PA_STREAM_START_UNMUTED PA_STREAM_START_UNMUTED
347 : : #define PA_STREAM_FAIL_ON_SUSPEND PA_STREAM_FAIL_ON_SUSPEND
348 : : #define PA_STREAM_RELATIVE_VOLUME PA_STREAM_RELATIVE_VOLUME
349 : : #define PA_STREAM_PASSTHROUGH PA_STREAM_PASSTHROUGH
350 : :
351 : : /** \endcond */
352 : :
353 : : /** Playback and record buffer metrics */
354 : : typedef struct pa_buffer_attr {
355 : : uint32_t maxlength;
356 : : /**< Maximum length of the buffer in bytes. Setting this to (uint32_t) -1
357 : : * will initialize this to the maximum value supported by server,
358 : : * which is recommended. */
359 : :
360 : : uint32_t tlength;
361 : : /**< Playback only: target length of the buffer. The server tries
362 : : * to assure that at least tlength bytes are always available in
363 : : * the per-stream server-side playback buffer. It is recommended
364 : : * to set this to (uint32_t) -1, which will initialize this to a
365 : : * value that is deemed sensible by the server. However, this
366 : : * value will default to something like 2s, i.e. for applications
367 : : * that have specific latency requirements this value should be
368 : : * set to the maximum latency that the application can deal
369 : : * with. When PA_STREAM_ADJUST_LATENCY is not set this value will
370 : : * influence only the per-stream playback buffer size. When
371 : : * PA_STREAM_ADJUST_LATENCY is set the overall latency of the sink
372 : : * plus the playback buffer size is configured to this value. Set
373 : : * PA_STREAM_ADJUST_LATENCY if you are interested in adjusting the
374 : : * overall latency. Don't set it if you are interested in
375 : : * configuring the server-side per-stream playback buffer
376 : : * size. */
377 : :
378 : : uint32_t prebuf;
379 : : /**< Playback only: pre-buffering. The server does not start with
380 : : * playback before at least prebuf bytes are available in the
381 : : * buffer. It is recommended to set this to (uint32_t) -1, which
382 : : * will initialize this to the same value as tlength, whatever
383 : : * that may be. Initialize to 0 to enable manual start/stop
384 : : * control of the stream. This means that playback will not stop
385 : : * on underrun and playback will not start automatically. Instead
386 : : * pa_stream_cork() needs to be called explicitly. If you set
387 : : * this value to 0 you should also set PA_STREAM_START_CORKED. */
388 : :
389 : : uint32_t minreq;
390 : : /**< Playback only: minimum request. The server does not request
391 : : * less than minreq bytes from the client, instead waits until the
392 : : * buffer is free enough to request more bytes at once. It is
393 : : * recommended to set this to (uint32_t) -1, which will initialize
394 : : * this to a value that is deemed sensible by the server. This
395 : : * should be set to a value that gives PulseAudio enough time to
396 : : * move the data from the per-stream playback buffer into the
397 : : * hardware playback buffer. */
398 : :
399 : : uint32_t fragsize;
400 : : /**< Recording only: fragment size. The server sends data in
401 : : * blocks of fragsize bytes size. Large values diminish
402 : : * interactivity with other operations on the connection context
403 : : * but decrease control overhead. It is recommended to set this to
404 : : * (uint32_t) -1, which will initialize this to a value that is
405 : : * deemed sensible by the server. However, this value will default
406 : : * to something like 2s, i.e. for applications that have specific
407 : : * latency requirements this value should be set to the maximum
408 : : * latency that the application can deal with. If
409 : : * PA_STREAM_ADJUST_LATENCY is set the overall source latency will
410 : : * be adjusted according to this value. If it is not set the
411 : : * source latency is left unmodified. */
412 : :
413 : : } pa_buffer_attr;
414 : :
415 : : /** Error values as used by pa_context_errno(). Use pa_strerror() to convert these values to human readable strings */
416 : : typedef enum pa_error_code {
417 : : PA_OK = 0, /**< No error */
418 : : PA_ERR_ACCESS, /**< Access failure */
419 : : PA_ERR_COMMAND, /**< Unknown command */
420 : : PA_ERR_INVALID, /**< Invalid argument */
421 : : PA_ERR_EXIST, /**< Entity exists */
422 : : PA_ERR_NOENTITY, /**< No such entity */
423 : : PA_ERR_CONNECTIONREFUSED, /**< Connection refused */
424 : : PA_ERR_PROTOCOL, /**< Protocol error */
425 : : PA_ERR_TIMEOUT, /**< Timeout */
426 : : PA_ERR_AUTHKEY, /**< No authorization key */
427 : : PA_ERR_INTERNAL, /**< Internal error */
428 : : PA_ERR_CONNECTIONTERMINATED, /**< Connection terminated */
429 : : PA_ERR_KILLED, /**< Entity killed */
430 : : PA_ERR_INVALIDSERVER, /**< Invalid server */
431 : : PA_ERR_MODINITFAILED, /**< Module initialization failed */
432 : : PA_ERR_BADSTATE, /**< Bad state */
433 : : PA_ERR_NODATA, /**< No data */
434 : : PA_ERR_VERSION, /**< Incompatible protocol version */
435 : : PA_ERR_TOOLARGE, /**< Data too large */
436 : : PA_ERR_NOTSUPPORTED, /**< Operation not supported \since 0.9.5 */
437 : : PA_ERR_UNKNOWN, /**< The error code was unknown to the client */
438 : : PA_ERR_NOEXTENSION, /**< Extension does not exist. \since 0.9.12 */
439 : : PA_ERR_OBSOLETE, /**< Obsolete functionality. \since 0.9.15 */
440 : : PA_ERR_NOTIMPLEMENTED, /**< Missing implementation. \since 0.9.15 */
441 : : PA_ERR_FORKED, /**< The caller forked without calling execve() and tried to reuse the context. \since 0.9.15 */
442 : : PA_ERR_IO, /**< An IO error happened. \since 0.9.16 */
443 : : PA_ERR_BUSY, /**< Device or resource busy. \since 0.9.17 */
444 : : PA_ERR_MAX /**< Not really an error but the first invalid error code */
445 : : } pa_error_code_t;
446 : :
447 : : /** \cond fulldocs */
448 : : #define PA_OK PA_OK
449 : : #define PA_ERR_ACCESS PA_ERR_ACCESS
450 : : #define PA_ERR_COMMAND PA_ERR_COMMAND
451 : : #define PA_ERR_INVALID PA_ERR_INVALID
452 : : #define PA_ERR_EXIST PA_ERR_EXIST
453 : : #define PA_ERR_NOENTITY PA_ERR_NOENTITY
454 : : #define PA_ERR_CONNECTIONREFUSED PA_ERR_CONNECTIONREFUSED
455 : : #define PA_ERR_PROTOCOL PA_ERR_PROTOCOL
456 : : #define PA_ERR_TIMEOUT PA_ERR_TIMEOUT
457 : : #define PA_ERR_AUTHKEY PA_ERR_AUTHKEY
458 : : #define PA_ERR_INTERNAL PA_ERR_INTERNAL
459 : : #define PA_ERR_CONNECTIONTERMINATED PA_ERR_CONNECTIONTERMINATED
460 : : #define PA_ERR_KILLED PA_ERR_KILLED
461 : : #define PA_ERR_INVALIDSERVER PA_ERR_INVALIDSERVER
462 : : #define PA_ERR_MODINITFAILED PA_ERR_MODINITFAILED
463 : : #define PA_ERR_BADSTATE PA_ERR_BADSTATE
464 : : #define PA_ERR_NODATA PA_ERR_NODATA
465 : : #define PA_ERR_VERSION PA_ERR_VERSION
466 : : #define PA_ERR_TOOLARGE PA_ERR_TOOLARGE
467 : : #define PA_ERR_NOTSUPPORTED PA_ERR_NOTSUPPORTED
468 : : #define PA_ERR_UNKNOWN PA_ERR_UNKNOWN
469 : : #define PA_ERR_NOEXTENSION PA_ERR_NOEXTENSION
470 : : #define PA_ERR_OBSOLETE PA_ERR_OBSOLETE
471 : : #define PA_ERR_NOTIMPLEMENTED PA_ERR_NOTIMPLEMENTED
472 : : #define PA_ERR_FORKED PA_ERR_FORKED
473 : : #define PA_ERR_MAX PA_ERR_MAX
474 : : /** \endcond */
475 : :
476 : : /** Subscription event mask, as used by pa_context_subscribe() */
477 : : typedef enum pa_subscription_mask {
478 : : PA_SUBSCRIPTION_MASK_NULL = 0x0000U,
479 : : /**< No events */
480 : :
481 : : PA_SUBSCRIPTION_MASK_SINK = 0x0001U,
482 : : /**< Sink events */
483 : :
484 : : PA_SUBSCRIPTION_MASK_SOURCE = 0x0002U,
485 : : /**< Source events */
486 : :
487 : : PA_SUBSCRIPTION_MASK_SINK_INPUT = 0x0004U,
488 : : /**< Sink input events */
489 : :
490 : : PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT = 0x0008U,
491 : : /**< Source output events */
492 : :
493 : : PA_SUBSCRIPTION_MASK_MODULE = 0x0010U,
494 : : /**< Module events */
495 : :
496 : : PA_SUBSCRIPTION_MASK_CLIENT = 0x0020U,
497 : : /**< Client events */
498 : :
499 : : PA_SUBSCRIPTION_MASK_SAMPLE_CACHE = 0x0040U,
500 : : /**< Sample cache events */
501 : :
502 : : PA_SUBSCRIPTION_MASK_SERVER = 0x0080U,
503 : : /**< Other global server changes. */
504 : :
505 : : /** \cond fulldocs */
506 : : PA_SUBSCRIPTION_MASK_AUTOLOAD = 0x0100U,
507 : : /**< \deprecated Autoload table events. */
508 : : /** \endcond */
509 : :
510 : : PA_SUBSCRIPTION_MASK_CARD = 0x0200U,
511 : : /**< Card events. \since 0.9.15 */
512 : :
513 : : PA_SUBSCRIPTION_MASK_ALL = 0x02ffU
514 : : /**< Catch all events */
515 : : } pa_subscription_mask_t;
516 : :
517 : : /** Subscription event types, as used by pa_context_subscribe() */
518 : : typedef enum pa_subscription_event_type {
519 : : PA_SUBSCRIPTION_EVENT_SINK = 0x0000U,
520 : : /**< Event type: Sink */
521 : :
522 : : PA_SUBSCRIPTION_EVENT_SOURCE = 0x0001U,
523 : : /**< Event type: Source */
524 : :
525 : : PA_SUBSCRIPTION_EVENT_SINK_INPUT = 0x0002U,
526 : : /**< Event type: Sink input */
527 : :
528 : : PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT = 0x0003U,
529 : : /**< Event type: Source output */
530 : :
531 : : PA_SUBSCRIPTION_EVENT_MODULE = 0x0004U,
532 : : /**< Event type: Module */
533 : :
534 : : PA_SUBSCRIPTION_EVENT_CLIENT = 0x0005U,
535 : : /**< Event type: Client */
536 : :
537 : : PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE = 0x0006U,
538 : : /**< Event type: Sample cache item */
539 : :
540 : : PA_SUBSCRIPTION_EVENT_SERVER = 0x0007U,
541 : : /**< Event type: Global server change, only occurring with PA_SUBSCRIPTION_EVENT_CHANGE. */
542 : :
543 : : /** \cond fulldocs */
544 : : PA_SUBSCRIPTION_EVENT_AUTOLOAD = 0x0008U,
545 : : /**< \deprecated Event type: Autoload table changes. */
546 : : /** \endcond */
547 : :
548 : : PA_SUBSCRIPTION_EVENT_CARD = 0x0009U,
549 : : /**< Event type: Card \since 0.9.15 */
550 : :
551 : : PA_SUBSCRIPTION_EVENT_FACILITY_MASK = 0x000FU,
552 : : /**< A mask to extract the event type from an event value */
553 : :
554 : : PA_SUBSCRIPTION_EVENT_NEW = 0x0000U,
555 : : /**< A new object was created */
556 : :
557 : : PA_SUBSCRIPTION_EVENT_CHANGE = 0x0010U,
558 : : /**< A property of the object was modified */
559 : :
560 : : PA_SUBSCRIPTION_EVENT_REMOVE = 0x0020U,
561 : : /**< An object was removed */
562 : :
563 : : PA_SUBSCRIPTION_EVENT_TYPE_MASK = 0x0030U
564 : : /**< A mask to extract the event operation from an event value */
565 : :
566 : : } pa_subscription_event_type_t;
567 : :
568 : : /** Return one if an event type t matches an event mask bitfield */
569 : : #define pa_subscription_match_flags(m, t) (!!((m) & (1 << ((t) & PA_SUBSCRIPTION_EVENT_FACILITY_MASK))))
570 : :
571 : : /** \cond fulldocs */
572 : : #define PA_SUBSCRIPTION_MASK_NULL PA_SUBSCRIPTION_MASK_NULL
573 : : #define PA_SUBSCRIPTION_MASK_SINK PA_SUBSCRIPTION_MASK_SINK
574 : : #define PA_SUBSCRIPTION_MASK_SOURCE PA_SUBSCRIPTION_MASK_SOURCE
575 : : #define PA_SUBSCRIPTION_MASK_SINK_INPUT PA_SUBSCRIPTION_MASK_SINK_INPUT
576 : : #define PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT
577 : : #define PA_SUBSCRIPTION_MASK_MODULE PA_SUBSCRIPTION_MASK_MODULE
578 : : #define PA_SUBSCRIPTION_MASK_CLIENT PA_SUBSCRIPTION_MASK_CLIENT
579 : : #define PA_SUBSCRIPTION_MASK_SAMPLE_CACHE PA_SUBSCRIPTION_MASK_SAMPLE_CACHE
580 : : #define PA_SUBSCRIPTION_MASK_SERVER PA_SUBSCRIPTION_MASK_SERVER
581 : : #define PA_SUBSCRIPTION_MASK_AUTOLOAD PA_SUBSCRIPTION_MASK_AUTOLOAD
582 : : #define PA_SUBSCRIPTION_MASK_CARD PA_SUBSCRIPTION_MASK_CARD
583 : : #define PA_SUBSCRIPTION_MASK_ALL PA_SUBSCRIPTION_MASK_ALL
584 : : #define PA_SUBSCRIPTION_EVENT_SINK PA_SUBSCRIPTION_EVENT_SINK
585 : : #define PA_SUBSCRIPTION_EVENT_SOURCE PA_SUBSCRIPTION_EVENT_SOURCE
586 : : #define PA_SUBSCRIPTION_EVENT_SINK_INPUT PA_SUBSCRIPTION_EVENT_SINK_INPUT
587 : : #define PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT
588 : : #define PA_SUBSCRIPTION_EVENT_MODULE PA_SUBSCRIPTION_EVENT_MODULE
589 : : #define PA_SUBSCRIPTION_EVENT_CLIENT PA_SUBSCRIPTION_EVENT_CLIENT
590 : : #define PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE
591 : : #define PA_SUBSCRIPTION_EVENT_SERVER PA_SUBSCRIPTION_EVENT_SERVER
592 : : #define PA_SUBSCRIPTION_EVENT_AUTOLOAD PA_SUBSCRIPTION_EVENT_AUTOLOAD
593 : : #define PA_SUBSCRIPTION_EVENT_CARD PA_SUBSCRIPTION_EVENT_CARD
594 : : #define PA_SUBSCRIPTION_EVENT_FACILITY_MASK PA_SUBSCRIPTION_EVENT_FACILITY_MASK
595 : : #define PA_SUBSCRIPTION_EVENT_NEW PA_SUBSCRIPTION_EVENT_NEW
596 : : #define PA_SUBSCRIPTION_EVENT_CHANGE PA_SUBSCRIPTION_EVENT_CHANGE
597 : : #define PA_SUBSCRIPTION_EVENT_REMOVE PA_SUBSCRIPTION_EVENT_REMOVE
598 : : #define PA_SUBSCRIPTION_EVENT_TYPE_MASK PA_SUBSCRIPTION_EVENT_TYPE_MASK
599 : : /** \endcond */
600 : :
601 : : /** A structure for all kinds of timing information of a stream. See
602 : : * pa_stream_update_timing_info() and pa_stream_get_timing_info(). The
603 : : * total output latency a sample that is written with
604 : : * pa_stream_write() takes to be played may be estimated by
605 : : * sink_usec+buffer_usec+transport_usec. (where buffer_usec is defined
606 : : * as pa_bytes_to_usec(write_index-read_index)) The output buffer
607 : : * which buffer_usec relates to may be manipulated freely (with
608 : : * pa_stream_write()'s seek argument, pa_stream_flush() and friends),
609 : : * the buffers sink_usec and source_usec relate to are first-in
610 : : * first-out (FIFO) buffers which cannot be flushed or manipulated in
611 : : * any way. The total input latency a sample that is recorded takes to
612 : : * be delivered to the application is:
613 : : * source_usec+buffer_usec+transport_usec-sink_usec. (Take care of
614 : : * sign issues!) When connected to a monitor source sink_usec contains
615 : : * the latency of the owning sink. The two latency estimations
616 : : * described here are implemented in pa_stream_get_latency(). Please
617 : : * note that this structure can be extended as part of evolutionary
618 : : * API updates at any time in any new release.*/
619 : : typedef struct pa_timing_info {
620 : : struct timeval timestamp;
621 : : /**< The time when this timing info structure was current */
622 : :
623 : : int synchronized_clocks;
624 : : /**< Non-zero if the local and the remote machine have
625 : : * synchronized clocks. If synchronized clocks are detected
626 : : * transport_usec becomes much more reliable. However, the code
627 : : * that detects synchronized clocks is very limited and unreliable
628 : : * itself. */
629 : :
630 : : pa_usec_t sink_usec;
631 : : /**< Time in usecs a sample takes to be played on the sink. For
632 : : * playback streams and record streams connected to a monitor
633 : : * source. */
634 : :
635 : : pa_usec_t source_usec;
636 : : /**< Time in usecs a sample takes from being recorded to being
637 : : * delivered to the application. Only for record streams. */
638 : :
639 : : pa_usec_t transport_usec;
640 : : /**< Estimated time in usecs a sample takes to be transferred
641 : : * to/from the daemon. For both playback and record streams. */
642 : :
643 : : int playing;
644 : : /**< Non-zero when the stream is currently not underrun and data
645 : : * is being passed on to the device. Only for playback
646 : : * streams. This field does not say whether the data is actually
647 : : * already being played. To determine this check whether
648 : : * since_underrun (converted to usec) is larger than sink_usec.*/
649 : :
650 : : int write_index_corrupt;
651 : : /**< Non-zero if write_index is not up-to-date because a local
652 : : * write command that corrupted it has been issued in the time
653 : : * since this latency info was current . Only write commands with
654 : : * SEEK_RELATIVE_ON_READ and SEEK_RELATIVE_END can corrupt
655 : : * write_index. */
656 : :
657 : : int64_t write_index;
658 : : /**< Current write index into the playback buffer in bytes. Think
659 : : * twice before using this for seeking purposes: it might be out
660 : : * of date a the time you want to use it. Consider using
661 : : * PA_SEEK_RELATIVE instead. */
662 : :
663 : : int read_index_corrupt;
664 : : /**< Non-zero if read_index is not up-to-date because a local
665 : : * pause or flush request that corrupted it has been issued in the
666 : : * time since this latency info was current. */
667 : :
668 : : int64_t read_index;
669 : : /**< Current read index into the playback buffer in bytes. Think
670 : : * twice before using this for seeking purposes: it might be out
671 : : * of date a the time you want to use it. Consider using
672 : : * PA_SEEK_RELATIVE_ON_READ instead. */
673 : :
674 : : pa_usec_t configured_sink_usec;
675 : : /**< The configured latency for the sink. \since 0.9.11 */
676 : :
677 : : pa_usec_t configured_source_usec;
678 : : /**< The configured latency for the source. \since 0.9.11 */
679 : :
680 : : int64_t since_underrun;
681 : : /**< Bytes that were handed to the sink since the last underrun
682 : : * happened, or since playback started again after the last
683 : : * underrun. playing will tell you which case it is. \since
684 : : * 0.9.11 */
685 : :
686 : : } pa_timing_info;
687 : :
688 : : /** A structure for the spawn api. This may be used to integrate auto
689 : : * spawned daemons into your application. For more information see
690 : : * pa_context_connect(). When spawning a new child process the
691 : : * waitpid() is used on the child's PID. The spawn routine will not
692 : : * block or ignore SIGCHLD signals, since this cannot be done in a
693 : : * thread compatible way. You might have to do this in
694 : : * prefork/postfork. */
695 : : typedef struct pa_spawn_api {
696 : : void (*prefork)(void);
697 : : /**< Is called just before the fork in the parent process. May be
698 : : * NULL. */
699 : :
700 : : void (*postfork)(void);
701 : : /**< Is called immediately after the fork in the parent
702 : : * process. May be NULL.*/
703 : :
704 : : void (*atfork)(void);
705 : : /**< Is called immediately after the fork in the child
706 : : * process. May be NULL. It is not safe to close all file
707 : : * descriptors in this function unconditionally, since a UNIX
708 : : * socket (created using socketpair()) is passed to the new
709 : : * process. */
710 : : } pa_spawn_api;
711 : :
712 : : /** Seek type for pa_stream_write(). */
713 : : typedef enum pa_seek_mode {
714 : : PA_SEEK_RELATIVE = 0,
715 : : /**< Seek relatively to the write index */
716 : :
717 : : PA_SEEK_ABSOLUTE = 1,
718 : : /**< Seek relatively to the start of the buffer queue */
719 : :
720 : : PA_SEEK_RELATIVE_ON_READ = 2,
721 : : /**< Seek relatively to the read index. */
722 : :
723 : : PA_SEEK_RELATIVE_END = 3
724 : : /**< Seek relatively to the current end of the buffer queue. */
725 : : } pa_seek_mode_t;
726 : :
727 : : /** \cond fulldocs */
728 : : #define PA_SEEK_RELATIVE PA_SEEK_RELATIVE
729 : : #define PA_SEEK_ABSOLUTE PA_SEEK_ABSOLUTE
730 : : #define PA_SEEK_RELATIVE_ON_READ PA_SEEK_RELATIVE_ON_READ
731 : : #define PA_SEEK_RELATIVE_END PA_SEEK_RELATIVE_END
732 : : /** \endcond */
733 : :
734 : : /** Special sink flags. */
735 : : typedef enum pa_sink_flags {
736 : : PA_SINK_NOFLAGS = 0x0000U,
737 : : /**< Flag to pass when no specific options are needed (used to avoid casting) \since 0.9.19 */
738 : :
739 : : PA_SINK_HW_VOLUME_CTRL = 0x0001U,
740 : : /**< Supports hardware volume control. This is a dynamic flag and may
741 : : * change at runtime after the sink has initialized */
742 : :
743 : : PA_SINK_LATENCY = 0x0002U,
744 : : /**< Supports latency querying */
745 : :
746 : : PA_SINK_HARDWARE = 0x0004U,
747 : : /**< Is a hardware sink of some kind, in contrast to
748 : : * "virtual"/software sinks \since 0.9.3 */
749 : :
750 : : PA_SINK_NETWORK = 0x0008U,
751 : : /**< Is a networked sink of some kind. \since 0.9.7 */
752 : :
753 : : PA_SINK_HW_MUTE_CTRL = 0x0010U,
754 : : /**< Supports hardware mute control. This is a dynamic flag and may
755 : : * change at runtime after the sink has initialized \since 0.9.11 */
756 : :
757 : : PA_SINK_DECIBEL_VOLUME = 0x0020U,
758 : : /**< Volume can be translated to dB with pa_sw_volume_to_dB(). This is a
759 : : * dynamic flag and may change at runtime after the sink has initialized
760 : : * \since 0.9.11 */
761 : :
762 : : PA_SINK_FLAT_VOLUME = 0x0040U,
763 : : /**< This sink is in flat volume mode, i.e. always the maximum of
764 : : * the volume of all connected inputs. \since 0.9.15 */
765 : :
766 : : PA_SINK_DYNAMIC_LATENCY = 0x0080U,
767 : : /**< The latency can be adjusted dynamically depending on the
768 : : * needs of the connected streams. \since 0.9.15 */
769 : :
770 : : PA_SINK_SET_FORMATS = 0x0100U,
771 : : /**< The sink allows setting what formats are supported by the connected
772 : : * hardware. The actual functionality to do this might be provided by an
773 : : * extension. \since 1.0 */
774 : :
775 : : #ifdef __INCLUDED_FROM_PULSE_AUDIO
776 : : /** \cond fulldocs */
777 : : /* PRIVATE: Server-side values -- do not try to use these at client-side.
778 : : * The server will filter out these flags anyway, so you should never see
779 : : * these flags in sinks. */
780 : :
781 : : PA_SINK_SHARE_VOLUME_WITH_MASTER = 0x1000000U,
782 : : /**< This sink shares the volume with the master sink (used by some filter
783 : : * sinks). */
784 : :
785 : : PA_SINK_DEFERRED_VOLUME = 0x2000000U,
786 : : /**< The HW volume changes are syncronized with SW volume. */
787 : : /** \endcond */
788 : : #endif
789 : :
790 : : } pa_sink_flags_t;
791 : :
792 : : /** \cond fulldocs */
793 : : #define PA_SINK_HW_VOLUME_CTRL PA_SINK_HW_VOLUME_CTRL
794 : : #define PA_SINK_LATENCY PA_SINK_LATENCY
795 : : #define PA_SINK_HARDWARE PA_SINK_HARDWARE
796 : : #define PA_SINK_NETWORK PA_SINK_NETWORK
797 : : #define PA_SINK_HW_MUTE_CTRL PA_SINK_HW_MUTE_CTRL
798 : : #define PA_SINK_DECIBEL_VOLUME PA_SINK_DECIBEL_VOLUME
799 : : #define PA_SINK_FLAT_VOLUME PA_SINK_FLAT_VOLUME
800 : : #define PA_SINK_DYNAMIC_LATENCY PA_SINK_DYNAMIC_LATENCY
801 : : #define PA_SINK_SET_FORMATS PA_SINK_SET_FORMATS
802 : : #ifdef __INCLUDED_FROM_PULSE_AUDIO
803 : : #define PA_SINK_CLIENT_FLAGS_MASK 0xFFFFFF
804 : : #endif
805 : :
806 : : /** \endcond */
807 : :
808 : : /** Sink state. \since 0.9.15 */
809 : : typedef enum pa_sink_state { /* enum serialized in u8 */
810 : : PA_SINK_INVALID_STATE = -1,
811 : : /**< This state is used when the server does not support sink state introspection \since 0.9.15 */
812 : :
813 : : PA_SINK_RUNNING = 0,
814 : : /**< Running, sink is playing and used by at least one non-corked sink-input \since 0.9.15 */
815 : :
816 : : PA_SINK_IDLE = 1,
817 : : /**< When idle, the sink is playing but there is no non-corked sink-input attached to it \since 0.9.15 */
818 : :
819 : : PA_SINK_SUSPENDED = 2,
820 : : /**< When suspended, actual sink access can be closed, for instance \since 0.9.15 */
821 : :
822 : : /** \cond fulldocs */
823 : : /* PRIVATE: Server-side values -- DO NOT USE THIS ON THE CLIENT
824 : : * SIDE! These values are *not* considered part of the official PA
825 : : * API/ABI. If you use them your application might break when PA
826 : : * is upgraded. Also, please note that these values are not useful
827 : : * on the client side anyway. */
828 : :
829 : : PA_SINK_INIT = -2,
830 : : /**< Initialization state */
831 : :
832 : : PA_SINK_UNLINKED = -3
833 : : /**< The state when the sink is getting unregistered and removed from client access */
834 : : /** \endcond */
835 : :
836 : : } pa_sink_state_t;
837 : :
838 : : /** Returns non-zero if sink is playing: running or idle. \since 0.9.15 */
839 : : static inline int PA_SINK_IS_OPENED(pa_sink_state_t x) {
840 : 0 : return x == PA_SINK_RUNNING || x == PA_SINK_IDLE;
841 : : }
842 : :
843 : : /** Returns non-zero if sink is running. \since 1.0 */
844 : : static inline int PA_SINK_IS_RUNNING(pa_sink_state_t x) {
845 : : return x == PA_SINK_RUNNING;
846 : : }
847 : :
848 : : /** \cond fulldocs */
849 : : #define PA_SINK_INVALID_STATE PA_SINK_INVALID_STATE
850 : : #define PA_SINK_RUNNING PA_SINK_RUNNING
851 : : #define PA_SINK_IDLE PA_SINK_IDLE
852 : : #define PA_SINK_SUSPENDED PA_SINK_SUSPENDED
853 : : #define PA_SINK_INIT PA_SINK_INIT
854 : : #define PA_SINK_UNLINKED PA_SINK_UNLINKED
855 : : #define PA_SINK_IS_OPENED PA_SINK_IS_OPENED
856 : : /** \endcond */
857 : :
858 : : /** Special source flags. */
859 : : typedef enum pa_source_flags {
860 : : PA_SOURCE_NOFLAGS = 0x0000U,
861 : : /**< Flag to pass when no specific options are needed (used to avoid casting) \since 0.9.19 */
862 : :
863 : : PA_SOURCE_HW_VOLUME_CTRL = 0x0001U,
864 : : /**< Supports hardware volume control. This is a dynamic flag and may
865 : : * change at runtime after the source has initialized */
866 : :
867 : : PA_SOURCE_LATENCY = 0x0002U,
868 : : /**< Supports latency querying */
869 : :
870 : : PA_SOURCE_HARDWARE = 0x0004U,
871 : : /**< Is a hardware source of some kind, in contrast to
872 : : * "virtual"/software source \since 0.9.3 */
873 : :
874 : : PA_SOURCE_NETWORK = 0x0008U,
875 : : /**< Is a networked source of some kind. \since 0.9.7 */
876 : :
877 : : PA_SOURCE_HW_MUTE_CTRL = 0x0010U,
878 : : /**< Supports hardware mute control. This is a dynamic flag and may
879 : : * change at runtime after the source has initialized \since 0.9.11 */
880 : :
881 : : PA_SOURCE_DECIBEL_VOLUME = 0x0020U,
882 : : /**< Volume can be translated to dB with pa_sw_volume_to_dB(). This is a
883 : : * dynamic flag and may change at runtime after the source has initialized
884 : : * \since 0.9.11 */
885 : :
886 : : PA_SOURCE_DYNAMIC_LATENCY = 0x0040U,
887 : : /**< The latency can be adjusted dynamically depending on the
888 : : * needs of the connected streams. \since 0.9.15 */
889 : :
890 : : PA_SOURCE_FLAT_VOLUME = 0x0080U,
891 : : /**< This source is in flat volume mode, i.e. always the maximum of
892 : : * the volume of all connected outputs. \since 1.0 */
893 : :
894 : : #ifdef __INCLUDED_FROM_PULSE_AUDIO
895 : : /** \cond fulldocs */
896 : : /* PRIVATE: Server-side values -- do not try to use these at client-side.
897 : : * The server will filter out these flags anyway, so you should never see
898 : : * these flags in sources. */
899 : :
900 : : PA_SOURCE_SHARE_VOLUME_WITH_MASTER = 0x1000000U,
901 : : /**< This source shares the volume with the master source (used by some filter
902 : : * sources). */
903 : :
904 : : PA_SOURCE_DEFERRED_VOLUME = 0x2000000U,
905 : : /**< The HW volume changes are syncronized with SW volume. */
906 : : #endif
907 : : } pa_source_flags_t;
908 : :
909 : : /** \cond fulldocs */
910 : : #define PA_SOURCE_HW_VOLUME_CTRL PA_SOURCE_HW_VOLUME_CTRL
911 : : #define PA_SOURCE_LATENCY PA_SOURCE_LATENCY
912 : : #define PA_SOURCE_HARDWARE PA_SOURCE_HARDWARE
913 : : #define PA_SOURCE_NETWORK PA_SOURCE_NETWORK
914 : : #define PA_SOURCE_HW_MUTE_CTRL PA_SOURCE_HW_MUTE_CTRL
915 : : #define PA_SOURCE_DECIBEL_VOLUME PA_SOURCE_DECIBEL_VOLUME
916 : : #define PA_SOURCE_DYNAMIC_LATENCY PA_SOURCE_DYNAMIC_LATENCY
917 : : #define PA_SOURCE_FLAT_VOLUME PA_SOURCE_FLAT_VOLUME
918 : : #ifdef __INCLUDED_FROM_PULSE_AUDIO
919 : : #define PA_SOURCE_CLIENT_FLAGS_MASK 0xFFFFFF
920 : : #endif
921 : :
922 : : /** \endcond */
923 : :
924 : : /** Source state. \since 0.9.15 */
925 : : typedef enum pa_source_state {
926 : : PA_SOURCE_INVALID_STATE = -1,
927 : : /**< This state is used when the server does not support source state introspection \since 0.9.15 */
928 : :
929 : : PA_SOURCE_RUNNING = 0,
930 : : /**< Running, source is recording and used by at least one non-corked source-output \since 0.9.15 */
931 : :
932 : : PA_SOURCE_IDLE = 1,
933 : : /**< When idle, the source is still recording but there is no non-corked source-output \since 0.9.15 */
934 : :
935 : : PA_SOURCE_SUSPENDED = 2,
936 : : /**< When suspended, actual source access can be closed, for instance \since 0.9.15 */
937 : :
938 : : /** \cond fulldocs */
939 : : /* PRIVATE: Server-side values -- DO NOT USE THIS ON THE CLIENT
940 : : * SIDE! These values are *not* considered part of the official PA
941 : : * API/ABI. If you use them your application might break when PA
942 : : * is upgraded. Also, please note that these values are not useful
943 : : * on the client side anyway. */
944 : :
945 : : PA_SOURCE_INIT = -2,
946 : : /**< Initialization state */
947 : :
948 : : PA_SOURCE_UNLINKED = -3
949 : : /**< The state when the source is getting unregistered and removed from client access */
950 : : /** \endcond */
951 : :
952 : : } pa_source_state_t;
953 : :
954 : : /** Returns non-zero if source is recording: running or idle. \since 0.9.15 */
955 : : static inline int PA_SOURCE_IS_OPENED(pa_source_state_t x) {
956 : 0 : return x == PA_SOURCE_RUNNING || x == PA_SOURCE_IDLE;
957 : : }
958 : :
959 : : /** Returns non-zero if source is running \since 1.0 */
960 : : static inline int PA_SOURCE_IS_RUNNING(pa_source_state_t x) {
961 : : return x == PA_SOURCE_RUNNING;
962 : : }
963 : :
964 : : /** \cond fulldocs */
965 : : #define PA_SOURCE_INVALID_STATE PA_SOURCE_INVALID_STATE
966 : : #define PA_SOURCE_RUNNING PA_SOURCE_RUNNING
967 : : #define PA_SOURCE_IDLE PA_SOURCE_IDLE
968 : : #define PA_SOURCE_SUSPENDED PA_SOURCE_SUSPENDED
969 : : #define PA_SOURCE_INIT PA_SOURCE_INIT
970 : : #define PA_SOURCE_UNLINKED PA_SOURCE_UNLINKED
971 : : #define PA_SOURCE_IS_OPENED PA_SOURCE_IS_OPENED
972 : : /** \endcond */
973 : :
974 : : /** A generic free() like callback prototype */
975 : : typedef void (*pa_free_cb_t)(void *p);
976 : :
977 : : /** A stream policy/meta event requesting that an application should
978 : : * cork a specific stream. See pa_stream_event_cb_t for more
979 : : * information, \since 0.9.15 */
980 : : #define PA_STREAM_EVENT_REQUEST_CORK "request-cork"
981 : :
982 : : /** A stream policy/meta event requesting that an application should
983 : : * cork a specific stream. See pa_stream_event_cb_t for more
984 : : * information, \since 0.9.15 */
985 : : #define PA_STREAM_EVENT_REQUEST_UNCORK "request-uncork"
986 : :
987 : : /** A stream event notifying that the stream is going to be
988 : : * disconnected because the underlying sink changed and no longer
989 : : * supports the format that was originally negotiated. Clients need
990 : : * to connect a new stream to renegotiate a format and continue
991 : : * playback, \since 1.0 */
992 : : #define PA_STREAM_EVENT_FORMAT_LOST "format-lost"
993 : :
994 : : /** Port availability / jack detection status
995 : : * \since 2.0 */
996 : : typedef enum pa_port_available {
997 : : PA_PORT_AVAILABLE_UNKNOWN = 0, /**< This port does not support jack detection \since 2.0 */
998 : : PA_PORT_AVAILABLE_NO = 1, /**< This port is not available, likely because the jack is not plugged in. \since 2.0 */
999 : : PA_PORT_AVAILABLE_YES = 2, /**< This port is available, likely because the jack is plugged in. \since 2.0 */
1000 : : } pa_port_available_t;
1001 : :
1002 : : /** \cond fulldocs */
1003 : : #define PA_PORT_AVAILABLE_UNKNOWN PA_PORT_AVAILABLE_UNKNOWN
1004 : : #define PA_PORT_AVAILABLE_NO PA_PORT_AVAILABLE_NO
1005 : : #define PA_PORT_AVAILABLE_YES PA_PORT_AVAILABLE_YES
1006 : :
1007 : : /** \endcond */
1008 : :
1009 : : PA_C_DECL_END
1010 : :
1011 : : #endif
|