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