]> code.delx.au - pulseaudio/blob - src/pulse/def.h
Merge commit 'origin/master-tx'
[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 #include <time.h>
29
30 #include <pulse/cdecl.h>
31 #include <pulse/sample.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 */
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 /** The state of a stream */
59 typedef enum pa_stream_state {
60 PA_STREAM_UNCONNECTED, /**< The stream is not yet connected to any sink or source */
61 PA_STREAM_CREATING, /**< The stream is being created */
62 PA_STREAM_READY, /**< The stream is established, you may pass audio data to it now */
63 PA_STREAM_FAILED, /**< An error occured that made the stream invalid */
64 PA_STREAM_TERMINATED /**< The stream has been terminated cleanly */
65 } pa_stream_state_t;
66
67 /** Return non-zero if the passed state is one of the connected states */
68 static inline int PA_STREAM_IS_GOOD(pa_stream_state_t x) {
69 return
70 x == PA_STREAM_CREATING ||
71 x == PA_STREAM_READY;
72 }
73
74 /** The state of an operation */
75 typedef enum pa_operation_state {
76 PA_OPERATION_RUNNING, /**< The operation is still running */
77 PA_OPERATION_DONE, /**< The operation has been completed */
78 PA_OPERATION_CANCELED /**< The operation has been canceled */
79 } pa_operation_state_t;
80
81 /** An invalid index */
82 #define PA_INVALID_INDEX ((uint32_t) -1)
83
84 /** Some special flags for contexts. */
85 typedef enum pa_context_flags {
86 PA_CONTEXT_NOAUTOSPAWN = 1
87 /**< Disabled autospawning of the PulseAudio daemon if required */
88 } pa_context_flags_t;
89
90 /** \cond fulldocs */
91 /* Allow clients to check with #ifdef for those flags */
92 #define PA_CONTEXT_NOAUTOSPAWN PA_CONTEXT_NOAUTOSPAWN
93 /** \endcond */
94
95 /** The direction of a pa_stream object */
96 typedef enum pa_stream_direction {
97 PA_STREAM_NODIRECTION, /**< Invalid direction */
98 PA_STREAM_PLAYBACK, /**< Playback stream */
99 PA_STREAM_RECORD, /**< Record stream */
100 PA_STREAM_UPLOAD /**< Sample upload stream */
101 } pa_stream_direction_t;
102
103 /** Some special flags for stream connections. */
104 typedef enum pa_stream_flags {
105
106 PA_STREAM_START_CORKED = 0x0001U,
107 /**< Create the stream corked, requiring an explicit
108 * pa_stream_cork() call to uncork it. */
109
110 PA_STREAM_INTERPOLATE_TIMING = 0x0002U,
111 /**< Interpolate the latency for this stream. When enabled,
112 * pa_stream_get_latency() and pa_stream_get_time() will try to
113 * estimate the current record/playback time based on the local
114 * time that passed since the last timing info update. Using this
115 * option has the advantage of not requiring a whole roundtrip
116 * when the current playback/recording time is needed. Consider
117 * using this option when requesting latency information
118 * frequently. This is especially useful on long latency network
119 * connections. It makes a lot of sense to combine this option
120 * with PA_STREAM_AUTO_TIMING_UPDATE. */
121
122 PA_STREAM_NOT_MONOTONIC = 0x0004U,
123 /**< Don't force the time to increase monotonically. If this
124 * option is enabled, pa_stream_get_time() will not necessarily
125 * return always monotonically increasing time values on each
126 * call. This may confuse applications which cannot deal with time
127 * going 'backwards', but has the advantage that bad transport
128 * latency estimations that caused the time to to jump ahead can
129 * be corrected quickly, without the need to wait. (Please note
130 * that this flag was named PA_STREAM_NOT_MONOTONOUS in releases
131 * prior to 0.9.11. The old name is still defined too, for
132 * compatibility reasons. */
133
134 PA_STREAM_AUTO_TIMING_UPDATE = 0x0008U,
135 /**< If set timing update requests are issued periodically
136 * automatically. Combined with PA_STREAM_INTERPOLATE_TIMING you
137 * will be able to query the current time and latency with
138 * pa_stream_get_time() and pa_stream_get_latency() at all times
139 * without a packet round trip.*/
140
141 PA_STREAM_NO_REMAP_CHANNELS = 0x0010U,
142 /**< Don't remap channels by their name, instead map them simply
143 * by their index. Implies PA_STREAM_NO_REMIX_CHANNELS. Only
144 * supported when the server is at least PA 0.9.8. It is ignored
145 * on older servers.\since 0.9.8 */
146
147 PA_STREAM_NO_REMIX_CHANNELS = 0x0020U,
148 /**< When remapping channels by name, don't upmix or downmix them
149 * to related channels. Copy them into matching channels of the
150 * device 1:1. Only supported when the server is at least PA
151 * 0.9.8. It is ignored on older servers. \since 0.9.8 */
152
153 PA_STREAM_FIX_FORMAT = 0x0040U,
154 /**< Use the sample format of the sink/device this stream is being
155 * connected to, and possibly ignore the format the sample spec
156 * contains -- but you still have to pass a valid value in it as a
157 * hint to PulseAudio what would suit your stream best. If this is
158 * used you should query the used sample format after creating the
159 * stream by using pa_stream_get_sample_spec(). Also, if you
160 * specified manual buffer metrics it is recommended to update
161 * them with pa_stream_set_buffer_attr() to compensate for the
162 * changed frame sizes. Only supported when the server is at least
163 * PA 0.9.8. It is ignored on older servers. \since 0.9.8 */
164
165 PA_STREAM_FIX_RATE = 0x0080U,
166 /**< Use the sample rate of the sink, and possibly ignore the rate
167 * the sample spec contains. Usage similar to
168 * PA_STREAM_FIX_FORMAT.Only supported when the server is at least
169 * PA 0.9.8. It is ignored on older servers. \since 0.9.8 */
170
171 PA_STREAM_FIX_CHANNELS = 0x0100,
172 /**< Use the number of channels and the channel map of the sink,
173 * and possibly ignore the number of channels and the map the
174 * sample spec and the passed channel map contains. Usage similar
175 * to PA_STREAM_FIX_FORMAT. Only supported when the server is at
176 * least PA 0.9.8. It is ignored on older servers. \since 0.9.8 */
177
178 PA_STREAM_DONT_MOVE = 0x0200U,
179 /**< Don't allow moving of this stream to another
180 * sink/device. Useful if you use any of the PA_STREAM_FIX_ flags
181 * and want to make sure that resampling never takes place --
182 * which might happen if the stream is moved to another
183 * sink/source whith a different sample spec/channel map. Only
184 * supported when the server is at least PA 0.9.8. It is ignored
185 * on older servers. \since 0.9.8 */
186
187 PA_STREAM_VARIABLE_RATE = 0x0400U,
188 /**< Allow dynamic changing of the sampling rate during playback
189 * with pa_stream_update_sample_rate(). Only supported when the
190 * server is at least PA 0.9.8. It is ignored on older
191 * servers. \since 0.9.8 */
192
193 PA_STREAM_PEAK_DETECT = 0x0800U,
194 /**< Find peaks instead of resampling. \since 0.9.11 */
195
196 PA_STREAM_START_MUTED = 0x1000U,
197 /**< Create in muted state. \since 0.9.11 */
198
199 PA_STREAM_ADJUST_LATENCY = 0x2000U,
200 /**< Try to adjust the latency of the sink/source based on the
201 * requested buffer metrics and adjust buffer metrics
202 * accordingly. Also see pa_buffer_attr. This option may not be
203 * specified at the same time as PA_STREAM_EARLY_REQUESTS. \since
204 * 0.9.11 */
205
206 PA_STREAM_EARLY_REQUESTS = 0x4000U
207 /**< Enable compatibility mode for legacy clients that rely on a
208 * "classic" hardware device fragment-style playback model. If
209 * this option is set, the minreq value of the buffer metrics gets
210 * a new meaning: instead of just specifying that no requests
211 * asking for less new data than this value will be made to the
212 * client it will also guarantee that requests are generated as
213 * early as this limit is reached. This flag should only be set in
214 * very few situations where compatiblity with a fragment-based
215 * playback model needs to be kept and the client applications
216 * cannot deal with data requests that are delayed to the latest
217 * moment possible. (Usually these are programs that use usleep()
218 * or a similar call in their playback loops instead of sleeping
219 * on the device itself.) Also see pa_buffer_attr. This option may
220 * not be specified at the same time as
221 * PA_STREAM_ADJUST_LATENCY. \since 0.9.12 */
222
223 } pa_stream_flags_t;
224
225 /** \cond fulldocs */
226
227 /* English is an evil language */
228 #define PA_STREAM_NOT_MONOTONOUS PA_STREAM_NOT_MONOTONIC
229
230 /* Allow clients to check with #ifdef for those flags */
231 #define PA_STREAM_START_CORKED PA_STREAM_START_CORKED
232 #define PA_STREAM_INTERPOLATE_TIMING PA_STREAM_INTERPOLATE_TIMING
233 #define PA_STREAM_NOT_MONOTONIC PA_STREAM_NOT_MONOTONIC
234 #define PA_STREAM_AUTO_TIMING_UPDATE PA_STREAM_AUTO_TIMING_UPDATE
235 #define PA_STREAM_NO_REMAP_CHANNELS PA_STREAM_NO_REMAP_CHANNELS
236 #define PA_STREAM_NO_REMIX_CHANNELS PA_STREAM_NO_REMIX_CHANNELS
237 #define PA_STREAM_FIX_FORMAT PA_STREAM_FIX_FORMAT
238 #define PA_STREAM_FIX_RATE PA_STREAM_FIX_RATE
239 #define PA_STREAM_FIX_CHANNELS PA_STREAM_FIX_CHANNELS
240 #define PA_STREAM_DONT_MOVE PA_STREAM_DONT_MOVE
241 #define PA_STREAM_VARIABLE_RATE PA_STREAM_VARIABLE_RATE
242 #define PA_STREAM_PEAK_DETECT PA_STREAM_PEAK_DETECT
243 #define PA_STREAM_START_MUTED PA_STREAM_START_MUTED
244 #define PA_STREAM_ADJUST_LATENCY PA_STREAM_ADJUST_LATENCY
245 #define PA_STREAM_EARLY_REQUESTS PA_STREAM_EARLY_REQUESTS
246
247 /** \endcond */
248
249 /** Playback and record buffer metrics */
250 typedef struct pa_buffer_attr {
251 uint32_t maxlength;
252 /**< Maximum length of the buffer. Setting this to (uint32_t) -1
253 * will initialize this to the maximum value supported by server,
254 * which is recommended. */
255
256 uint32_t tlength;
257 /**< Playback only: target length of the buffer. The server tries
258 * to assure that at least tlength bytes are always available in
259 * the per-stream server-side playback buffer. It is recommended
260 * to set this to (uint32_t) -1, which will initialize this to a
261 * value that is deemed sensible by the server. However, this
262 * value will default to something like 2s, i.e. for applications
263 * that have specific latency requirements this value should be
264 * set to the maximum latency that the application can deal
265 * with. When PA_STREAM_ADJUST_LATENCY is not set this value will
266 * influence only the per-stream playback buffer size. When
267 * PA_STREAM_ADJUST_LATENCY is set the overall latency of the sink
268 * plus the playback buffer size is configured to this value. Set
269 * PA_STREAM_ADJUST_LATENCY if you are interested in adjusting the
270 * overall latency. Don't set it if you are interested in
271 * configuring the server-sider per-stream playback buffer
272 * size. */
273
274 uint32_t prebuf;
275 /**< Playback only: pre-buffering. The server does not start with
276 * playback before at least prebug bytes are available in the
277 * buffer. It is recommended to set this to (uint32_t) -1, which
278 * will initialize this to the same value as tlength, whatever
279 * that may be. Initialize to 0 to enable manual start/stop
280 * control of the stream. This means that playback will not stop
281 * on underrun and playback will not start automatically. Instead
282 * pa_stream_corked() needs to be called explicitly. If you set
283 * this value to 0 you should also set PA_STREAM_START_CORKED. */
284
285 uint32_t minreq;
286 /**< Playback only: minimum request. The server does not request
287 * less than minreq bytes from the client, instead waits until the
288 * buffer is free enough to request more bytes at once. It is
289 * recommended to set this to (uint32_t) -1, which will initialize
290 * this to a value that is deemed sensible by the server. This
291 * should be set to a value that gives PulseAudio enough time to
292 * move the data from the per-stream playback buffer into the
293 * hardware playback buffer. */
294
295 uint32_t fragsize;
296 /**< Recording only: fragment size. The server sends data in
297 * blocks of fragsize bytes size. Large values deminish
298 * interactivity with other operations on the connection context
299 * but decrease control overhead. It is recommended to set this to
300 * (uint32_t) -1, which will initialize this to a value that is
301 * deemed sensible by the server. However, this value will default
302 * to something like 2s, i.e. for applications that have specific
303 * latency requirements this value should be set to the maximum
304 * latency that the application can deal with. If
305 * PA_STREAM_ADJUST_LATENCY is set the overall source latency will
306 * be adjusted according to this value. If it is not set the
307 * source latency is left unmodified. */
308
309 } pa_buffer_attr;
310
311 /** Error values as used by pa_context_errno(). Use pa_strerror() to convert these values to human readable strings */
312 enum {
313 PA_OK = 0, /**< No error */
314 PA_ERR_ACCESS, /**< Access failure */
315 PA_ERR_COMMAND, /**< Unknown command */
316 PA_ERR_INVALID, /**< Invalid argument */
317 PA_ERR_EXIST, /**< Entity exists */
318 PA_ERR_NOENTITY, /**< No such entity */
319 PA_ERR_CONNECTIONREFUSED, /**< Connection refused */
320 PA_ERR_PROTOCOL, /**< Protocol error */
321 PA_ERR_TIMEOUT, /**< Timeout */
322 PA_ERR_AUTHKEY, /**< No authorization key */
323 PA_ERR_INTERNAL, /**< Internal error */
324 PA_ERR_CONNECTIONTERMINATED, /**< Connection terminated */
325 PA_ERR_KILLED, /**< Entity killed */
326 PA_ERR_INVALIDSERVER, /**< Invalid server */
327 PA_ERR_MODINITFAILED, /**< Module initialization failed */
328 PA_ERR_BADSTATE, /**< Bad state */
329 PA_ERR_NODATA, /**< No data */
330 PA_ERR_VERSION, /**< Incompatible protocol version */
331 PA_ERR_TOOLARGE, /**< Data too large */
332 PA_ERR_NOTSUPPORTED, /**< Operation not supported \since 0.9.5 */
333 PA_ERR_UNKNOWN, /**< The error code was unknown to the client */
334 PA_ERR_NOEXTENSION, /**< Extension does not exist. \since 0.9.12 */
335 PA_ERR_MAX /**< Not really an error but the first invalid error code */
336 };
337
338 /** Subscription event mask, as used by pa_context_subscribe() */
339 typedef enum pa_subscription_mask {
340 PA_SUBSCRIPTION_MASK_NULL = 0x0000U,
341 /**< No events */
342
343 PA_SUBSCRIPTION_MASK_SINK = 0x0001U,
344 /**< Sink events */
345
346 PA_SUBSCRIPTION_MASK_SOURCE = 0x0002U,
347 /**< Source events */
348
349 PA_SUBSCRIPTION_MASK_SINK_INPUT = 0x0004U,
350 /**< Sink input events */
351
352 PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT = 0x0008U,
353 /**< Source output events */
354
355 PA_SUBSCRIPTION_MASK_MODULE = 0x0010U,
356 /**< Module events */
357
358 PA_SUBSCRIPTION_MASK_CLIENT = 0x0020U,
359 /**< Client events */
360
361 PA_SUBSCRIPTION_MASK_SAMPLE_CACHE = 0x0040U,
362 /**< Sample cache events */
363
364 PA_SUBSCRIPTION_MASK_SERVER = 0x0080U,
365 /**< Other global server changes. */
366
367 PA_SUBSCRIPTION_MASK_AUTOLOAD = 0x0100U,
368 /**< Autoload table events. */
369
370 PA_SUBSCRIPTION_MASK_ALL = 0x01ffU
371 /**< Catch all events */
372 } pa_subscription_mask_t;
373
374 /** Subscription event types, as used by pa_context_subscribe() */
375 typedef enum pa_subscription_event_type {
376 PA_SUBSCRIPTION_EVENT_SINK = 0x0000U,
377 /**< Event type: Sink */
378
379 PA_SUBSCRIPTION_EVENT_SOURCE = 0x0001U,
380 /**< Event type: Source */
381
382 PA_SUBSCRIPTION_EVENT_SINK_INPUT = 0x0002U,
383 /**< Event type: Sink input */
384
385 PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT = 0x0003U,
386 /**< Event type: Source output */
387
388 PA_SUBSCRIPTION_EVENT_MODULE = 0x0004U,
389 /**< Event type: Module */
390
391 PA_SUBSCRIPTION_EVENT_CLIENT = 0x0005U,
392 /**< Event type: Client */
393
394 PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE = 0x0006U,
395 /**< Event type: Sample cache item */
396
397 PA_SUBSCRIPTION_EVENT_SERVER = 0x0007U,
398 /**< Event type: Global server change, only occuring with PA_SUBSCRIPTION_EVENT_CHANGE. */
399
400 PA_SUBSCRIPTION_EVENT_AUTOLOAD = 0x0008U,
401 /**< Event type: Autoload table changes. */
402
403 PA_SUBSCRIPTION_EVENT_FACILITY_MASK = 0x000FU,
404 /**< A mask to extract the event type from an event value */
405
406 PA_SUBSCRIPTION_EVENT_NEW = 0x0000U,
407 /**< A new object was created */
408
409 PA_SUBSCRIPTION_EVENT_CHANGE = 0x0010U,
410 /**< A property of the object was modified */
411
412 PA_SUBSCRIPTION_EVENT_REMOVE = 0x0020U,
413 /**< An object was removed */
414
415 PA_SUBSCRIPTION_EVENT_TYPE_MASK = 0x0030U,
416 /**< A mask to extract the event operation from an event value */
417
418 } pa_subscription_event_type_t;
419
420 /** Return one if an event type t matches an event mask bitfield */
421 #define pa_subscription_match_flags(m, t) (!!((m) & (1 << ((t) & PA_SUBSCRIPTION_EVENT_FACILITY_MASK))))
422
423 /** A structure for all kinds of timing information of a stream. See
424 * pa_stream_update_timing_info() and pa_stream_get_timing_info(). The
425 * total output latency a sample that is written with
426 * pa_stream_write() takes to be played may be estimated by
427 * sink_usec+buffer_usec+transport_usec. (where buffer_usec is defined
428 * as pa_bytes_to_usec(write_index-read_index)) The output buffer
429 * which buffer_usec relates to may be manipulated freely (with
430 * pa_stream_write()'s seek argument, pa_stream_flush() and friends),
431 * the buffers sink_usec and source_usec relate to are first-in
432 * first-out (FIFO) buffers which cannot be flushed or manipulated in
433 * any way. The total input latency a sample that is recorded takes to
434 * be delivered to the application is:
435 * source_usec+buffer_usec+transport_usec-sink_usec. (Take care of
436 * sign issues!) When connected to a monitor source sink_usec contains
437 * the latency of the owning sink. The two latency estimations
438 * described here are implemented in pa_stream_get_latency(). Please
439 * note that this structure can be extended as part of evolutionary
440 * API updates at any time in any new release.*/
441 typedef struct pa_timing_info {
442 struct timeval timestamp;
443 /**< The time when this timing info structure was current */
444
445 int synchronized_clocks;
446 /**< Non-zero if the local and the remote machine have
447 * synchronized clocks. If synchronized clocks are detected
448 * transport_usec becomes much more reliable. However, the code
449 * that detects synchronized clocks is very limited und unreliable
450 * itself. */
451
452 pa_usec_t sink_usec;
453 /**< Time in usecs a sample takes to be played on the sink. For
454 * playback streams and record streams connected to a monitor
455 * source. */
456
457 pa_usec_t source_usec;
458 /**< Time in usecs a sample takes from being recorded to being
459 * delivered to the application. Only for record streams. */
460
461 pa_usec_t transport_usec;
462 /**< Estimated time in usecs a sample takes to be transferred
463 * to/from the daemon. For both playback and record streams. */
464
465 int playing;
466 /**< Non-zero when the stream is currently not underrun and data
467 * is being passed on to the device. Only for playback
468 * streams. This field does not say whether the data is actually
469 * already being played. To determine this check whether
470 * since_underrun (converted to usec) is larger than sink_usec.*/
471
472 int write_index_corrupt;
473 /**< Non-zero if write_index is not up-to-date because a local
474 * write command that corrupted it has been issued in the time
475 * since this latency info was current . Only write commands with
476 * SEEK_RELATIVE_ON_READ and SEEK_RELATIVE_END can corrupt
477 * write_index. */
478
479 int64_t write_index;
480 /**< Current write index into the playback buffer in bytes. Think
481 * twice before using this for seeking purposes: it might be out
482 * of date a the time you want to use it. Consider using
483 * PA_SEEK_RELATIVE instead. */
484
485 int read_index_corrupt;
486 /**< Non-zero if read_index is not up-to-date because a local
487 * pause or flush request that corrupted it has been issued in the
488 * time since this latency info was current. */
489
490 int64_t read_index;
491 /**< Current read index into the playback buffer in bytes. Think
492 * twice before using this for seeking purposes: it might be out
493 * of date a the time you want to use it. Consider using
494 * PA_SEEK_RELATIVE_ON_READ instead. */
495
496 pa_usec_t configured_sink_usec;
497 /**< The configured latency for the sink. \since 0.9.11 */
498
499 pa_usec_t configured_source_usec;
500 /**< The configured latency for * the source. \since 0.9.11 */
501
502 int64_t since_underrun;
503 /**< Bytes that were handed to the sink since the last underrun
504 * happened, or since playback started again after the last
505 * underrun. playing will tell you which case it is. \since
506 * 0.9.11 */
507
508 } pa_timing_info;
509
510 /** A structure for the spawn api. This may be used to integrate auto
511 * spawned daemons into your application. For more information see
512 * pa_context_connect(). When spawning a new child process the
513 * waitpid() is used on the child's PID. The spawn routine will not
514 * block or ignore SIGCHLD signals, since this cannot be done in a
515 * thread compatible way. You might have to do this in
516 * prefork/postfork. */
517 typedef struct pa_spawn_api {
518 void (*prefork)(void);
519 /**< Is called just before the fork in the parent process. May be
520 * NULL. */
521
522 void (*postfork)(void);
523 /**< Is called immediately after the fork in the parent
524 * process. May be NULL.*/
525
526 void (*atfork)(void);
527 /**< Is called immediately after the fork in the child
528 * process. May be NULL. It is not safe to close all file
529 * descriptors in this function unconditionally, since a UNIX
530 * socket (created using socketpair()) is passed to the new
531 * process. */
532 } pa_spawn_api;
533
534 /** Seek type for pa_stream_write(). */
535 typedef enum pa_seek_mode {
536 PA_SEEK_RELATIVE = 0,
537 /**< Seek relatively to the write index */
538
539 PA_SEEK_ABSOLUTE = 1,
540 /**< Seek relatively to the start of the buffer queue */
541
542 PA_SEEK_RELATIVE_ON_READ = 2,
543 /**< Seek relatively to the read index. */
544
545 PA_SEEK_RELATIVE_END = 3
546 /**< Seek relatively to the current end of the buffer queue. */
547 } pa_seek_mode_t;
548
549 /** Special sink flags. */
550 typedef enum pa_sink_flags {
551 PA_SINK_HW_VOLUME_CTRL = 0x0001U,
552 /**< Supports hardware volume control */
553
554 PA_SINK_LATENCY = 0x0002U,
555 /**< Supports latency querying */
556
557 PA_SINK_HARDWARE = 0x0004U,
558 /**< Is a hardware sink of some kind, in contrast to
559 * "virtual"/software sinks \since 0.9.3 */
560
561 PA_SINK_NETWORK = 0x0008U,
562 /**< Is a networked sink of some kind. \since 0.9.7 */
563
564 PA_SINK_HW_MUTE_CTRL = 0x0010U,
565 /**< Supports hardware mute control \since 0.9.11 */
566
567 PA_SINK_DECIBEL_VOLUME = 0x0020U
568 /**< Volume can be translated to dB with pa_sw_volume_to_dB()
569 * \since 0.9.11 */
570 } pa_sink_flags_t;
571
572 /** \cond fulldocs */
573 #define PA_SINK_HW_VOLUME_CTRL PA_SINK_HW_VOLUME_CTRL
574 #define PA_SINK_LATENCY PA_SINK_LATENCY
575 #define PA_SINK_HARDWARE PA_SINK_HARDWARE
576 #define PA_SINK_NETWORK PA_SINK_NETWORK
577 #define PA_SINK_HW_VOLUME_CTRL PA_SINK_HW_VOLUME_CTRL
578 #define PA_SINK_DECIBEL_VOLUME PA_SINK_DECIBEL_VOLUME
579 /** \endcond */
580
581 /** Special source flags. */
582 typedef enum pa_source_flags {
583 PA_SOURCE_HW_VOLUME_CTRL = 0x0001U,
584 /**< Supports hardware volume control */
585
586 PA_SOURCE_LATENCY = 0x0002U,
587 /**< Supports latency querying */
588
589 PA_SOURCE_HARDWARE = 0x0004U,
590 /**< Is a hardware source of some kind, in contrast to
591 * "virtual"/software source \since 0.9.3 */
592
593 PA_SOURCE_NETWORK = 0x0008U,
594 /**< Is a networked sink of some kind. \since 0.9.7 */
595
596 PA_SOURCE_HW_MUTE_CTRL = 0x0010U,
597 /**< Supports hardware mute control \since 0.9.11 */
598
599 PA_SOURCE_DECIBEL_VOLUME = 0x0020U
600 /**< Volume can be translated to dB with pa_sw_volume_to_dB()
601 * \since 0.9.11 */
602 } pa_source_flags_t;
603
604 /** \cond fulldocs */
605 #define PA_SOURCE_HW_VOLUME_CTRL PA_SOURCE_HW_VOLUME_CTRL
606 #define PA_SOURCE_LATENCY PA_SOURCE_LATENCY
607 #define PA_SOURCE_HARDWARE PA_SOURCE_HARDWARE
608 #define PA_SOURCE_NETWORK PA_SOURCE_NETWORK
609 #define PA_SOURCE_HW_VOLUME_CTRL PA_SOURCE_HW_VOLUME_CTRL
610 #define PA_SOURCE_DECIBEL_VOLUME PA_SOURCE_DECIBEL_VOLUME
611 /** \endcond */
612
613 /** A generic free() like callback prototype */
614 typedef void (*pa_free_cb_t)(void *p);
615
616 PA_C_DECL_END
617
618 #endif