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