build: fix few warnings
[pulseaudio-raopUDP/pulseaudio-raop-alac.git] / src / pulse / def.h
blob7a715b66544baa3abb07119f13fab4e3abc5613f
1 #ifndef foodefhfoo
2 #define foodefhfoo
4 /***
5 This file is part of PulseAudio.
7 Copyright 2004-2006 Lennart Poettering
8 Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
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.
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.
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 ***/
26 #include <inttypes.h>
27 #include <sys/time.h>
28 #include <time.h>
30 #include <pulse/cdecl.h>
31 #include <pulse/sample.h>
33 /** \file
34 * Global definitions */
36 PA_C_DECL_BEGIN
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;
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;
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;
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;
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;
81 /** An invalid index */
82 #define PA_INVALID_INDEX ((uint32_t) -1)
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;
90 /** \cond fulldocs */
91 /* Allow clients to check with #ifdef for those flags */
92 #define PA_CONTEXT_NOAUTOSPAWN PA_CONTEXT_NOAUTOSPAWN
93 /** \endcond */
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;
103 /** Some special flags for stream connections. */
104 typedef enum pa_stream_flags {
106 PA_STREAM_START_CORKED = 0x0001U,
107 /**< Create the stream corked, requiring an explicit
108 * pa_stream_cork() call to uncork it. */
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. */
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. */
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.*/
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 */
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 */
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 */
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 */
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 */
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 */
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 */
193 PA_STREAM_PEAK_DETECT = 0x0800U,
194 /**< Find peaks instead of resampling. \since 0.9.11 */
196 PA_STREAM_START_MUTED = 0x1000U,
197 /**< Create in muted state. If neither PA_STREAM_START_UNMUTED nor
198 * PA_STREAM_START_MUTED it is left to the server to decide
199 * whether to create the stream in muted or in unmuted
200 * state. \since 0.9.11 */
202 PA_STREAM_ADJUST_LATENCY = 0x2000U,
203 /**< Try to adjust the latency of the sink/source based on the
204 * requested buffer metrics and adjust buffer metrics
205 * accordingly. Also see pa_buffer_attr. This option may not be
206 * specified at the same time as PA_STREAM_EARLY_REQUESTS. \since
207 * 0.9.11 */
209 PA_STREAM_EARLY_REQUESTS = 0x4000U,
210 /**< Enable compatibility mode for legacy clients that rely on a
211 * "classic" hardware device fragment-style playback model. If
212 * this option is set, the minreq value of the buffer metrics gets
213 * a new meaning: instead of just specifying that no requests
214 * asking for less new data than this value will be made to the
215 * client it will also guarantee that requests are generated as
216 * early as this limit is reached. This flag should only be set in
217 * very few situations where compatiblity with a fragment-based
218 * playback model needs to be kept and the client applications
219 * cannot deal with data requests that are delayed to the latest
220 * moment possible. (Usually these are programs that use usleep()
221 * or a similar call in their playback loops instead of sleeping
222 * on the device itself.) Also see pa_buffer_attr. This option may
223 * not be specified at the same time as
224 * PA_STREAM_ADJUST_LATENCY. \since 0.9.12 */
226 PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND = 0x8000U,
227 /**< If set this stream won't be taken into account when we it is
228 * checked whether the device this stream is connected to should
229 * auto-suspend. \ since 0.9.14 */
231 PA_STREAM_START_UNMUTED = 0x10000U
232 /**< Create in unmuted state. If neither PA_STREAM_START_UNMUTED
233 * nor PA_STREAM_START_MUTED it is left to the server to decide
234 * whether to create the stream in muted or in unmuted
235 * state. \since 0.9.14 */
237 } pa_stream_flags_t;
239 /** \cond fulldocs */
241 /* English is an evil language */
242 #define PA_STREAM_NOT_MONOTONOUS PA_STREAM_NOT_MONOTONIC
244 /* Allow clients to check with #ifdef for those flags */
245 #define PA_STREAM_START_CORKED PA_STREAM_START_CORKED
246 #define PA_STREAM_INTERPOLATE_TIMING PA_STREAM_INTERPOLATE_TIMING
247 #define PA_STREAM_NOT_MONOTONIC PA_STREAM_NOT_MONOTONIC
248 #define PA_STREAM_AUTO_TIMING_UPDATE PA_STREAM_AUTO_TIMING_UPDATE
249 #define PA_STREAM_NO_REMAP_CHANNELS PA_STREAM_NO_REMAP_CHANNELS
250 #define PA_STREAM_NO_REMIX_CHANNELS PA_STREAM_NO_REMIX_CHANNELS
251 #define PA_STREAM_FIX_FORMAT PA_STREAM_FIX_FORMAT
252 #define PA_STREAM_FIX_RATE PA_STREAM_FIX_RATE
253 #define PA_STREAM_FIX_CHANNELS PA_STREAM_FIX_CHANNELS
254 #define PA_STREAM_DONT_MOVE PA_STREAM_DONT_MOVE
255 #define PA_STREAM_VARIABLE_RATE PA_STREAM_VARIABLE_RATE
256 #define PA_STREAM_PEAK_DETECT PA_STREAM_PEAK_DETECT
257 #define PA_STREAM_START_MUTED PA_STREAM_START_MUTED
258 #define PA_STREAM_ADJUST_LATENCY PA_STREAM_ADJUST_LATENCY
259 #define PA_STREAM_EARLY_REQUESTS PA_STREAM_EARLY_REQUESTS
260 #define PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND
261 #define PA_STREAM_START_UNMUTED PA_STREAM_START_UNMUTED
263 /** \endcond */
265 /** Playback and record buffer metrics */
266 typedef struct pa_buffer_attr {
267 uint32_t maxlength;
268 /**< Maximum length of the buffer. Setting this to (uint32_t) -1
269 * will initialize this to the maximum value supported by server,
270 * which is recommended. */
272 uint32_t tlength;
273 /**< Playback only: target length of the buffer. The server tries
274 * to assure that at least tlength bytes are always available in
275 * the per-stream server-side playback buffer. It is recommended
276 * to set this to (uint32_t) -1, which will initialize this to a
277 * value that is deemed sensible by the server. However, this
278 * value will default to something like 2s, i.e. for applications
279 * that have specific latency requirements this value should be
280 * set to the maximum latency that the application can deal
281 * with. When PA_STREAM_ADJUST_LATENCY is not set this value will
282 * influence only the per-stream playback buffer size. When
283 * PA_STREAM_ADJUST_LATENCY is set the overall latency of the sink
284 * plus the playback buffer size is configured to this value. Set
285 * PA_STREAM_ADJUST_LATENCY if you are interested in adjusting the
286 * overall latency. Don't set it if you are interested in
287 * configuring the server-sider per-stream playback buffer
288 * size. */
290 uint32_t prebuf;
291 /**< Playback only: pre-buffering. The server does not start with
292 * playback before at least prebug bytes are available in the
293 * buffer. It is recommended to set this to (uint32_t) -1, which
294 * will initialize this to the same value as tlength, whatever
295 * that may be. Initialize to 0 to enable manual start/stop
296 * control of the stream. This means that playback will not stop
297 * on underrun and playback will not start automatically. Instead
298 * pa_stream_corked() needs to be called explicitly. If you set
299 * this value to 0 you should also set PA_STREAM_START_CORKED. */
301 uint32_t minreq;
302 /**< Playback only: minimum request. The server does not request
303 * less than minreq bytes from the client, instead waits until the
304 * buffer is free enough to request more bytes at once. It is
305 * recommended to set this to (uint32_t) -1, which will initialize
306 * this to a value that is deemed sensible by the server. This
307 * should be set to a value that gives PulseAudio enough time to
308 * move the data from the per-stream playback buffer into the
309 * hardware playback buffer. */
311 uint32_t fragsize;
312 /**< Recording only: fragment size. The server sends data in
313 * blocks of fragsize bytes size. Large values deminish
314 * interactivity with other operations on the connection context
315 * but decrease control overhead. It is recommended to set this to
316 * (uint32_t) -1, which will initialize this to a value that is
317 * deemed sensible by the server. However, this value will default
318 * to something like 2s, i.e. for applications that have specific
319 * latency requirements this value should be set to the maximum
320 * latency that the application can deal with. If
321 * PA_STREAM_ADJUST_LATENCY is set the overall source latency will
322 * be adjusted according to this value. If it is not set the
323 * source latency is left unmodified. */
325 } pa_buffer_attr;
327 /** Error values as used by pa_context_errno(). Use pa_strerror() to convert these values to human readable strings */
328 enum {
329 PA_OK = 0, /**< No error */
330 PA_ERR_ACCESS, /**< Access failure */
331 PA_ERR_COMMAND, /**< Unknown command */
332 PA_ERR_INVALID, /**< Invalid argument */
333 PA_ERR_EXIST, /**< Entity exists */
334 PA_ERR_NOENTITY, /**< No such entity */
335 PA_ERR_CONNECTIONREFUSED, /**< Connection refused */
336 PA_ERR_PROTOCOL, /**< Protocol error */
337 PA_ERR_TIMEOUT, /**< Timeout */
338 PA_ERR_AUTHKEY, /**< No authorization key */
339 PA_ERR_INTERNAL, /**< Internal error */
340 PA_ERR_CONNECTIONTERMINATED, /**< Connection terminated */
341 PA_ERR_KILLED, /**< Entity killed */
342 PA_ERR_INVALIDSERVER, /**< Invalid server */
343 PA_ERR_MODINITFAILED, /**< Module initialization failed */
344 PA_ERR_BADSTATE, /**< Bad state */
345 PA_ERR_NODATA, /**< No data */
346 PA_ERR_VERSION, /**< Incompatible protocol version */
347 PA_ERR_TOOLARGE, /**< Data too large */
348 PA_ERR_NOTSUPPORTED, /**< Operation not supported \since 0.9.5 */
349 PA_ERR_UNKNOWN, /**< The error code was unknown to the client */
350 PA_ERR_NOEXTENSION, /**< Extension does not exist. \since 0.9.12 */
351 PA_ERR_MAX /**< Not really an error but the first invalid error code */
354 /** Subscription event mask, as used by pa_context_subscribe() */
355 typedef enum pa_subscription_mask {
356 PA_SUBSCRIPTION_MASK_NULL = 0x0000U,
357 /**< No events */
359 PA_SUBSCRIPTION_MASK_SINK = 0x0001U,
360 /**< Sink events */
362 PA_SUBSCRIPTION_MASK_SOURCE = 0x0002U,
363 /**< Source events */
365 PA_SUBSCRIPTION_MASK_SINK_INPUT = 0x0004U,
366 /**< Sink input events */
368 PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT = 0x0008U,
369 /**< Source output events */
371 PA_SUBSCRIPTION_MASK_MODULE = 0x0010U,
372 /**< Module events */
374 PA_SUBSCRIPTION_MASK_CLIENT = 0x0020U,
375 /**< Client events */
377 PA_SUBSCRIPTION_MASK_SAMPLE_CACHE = 0x0040U,
378 /**< Sample cache events */
380 PA_SUBSCRIPTION_MASK_SERVER = 0x0080U,
381 /**< Other global server changes. */
383 PA_SUBSCRIPTION_MASK_AUTOLOAD = 0x0100U,
384 /**< Autoload table events. */
386 PA_SUBSCRIPTION_MASK_ALL = 0x01ffU
387 /**< Catch all events */
388 } pa_subscription_mask_t;
390 /** Subscription event types, as used by pa_context_subscribe() */
391 typedef enum pa_subscription_event_type {
392 PA_SUBSCRIPTION_EVENT_SINK = 0x0000U,
393 /**< Event type: Sink */
395 PA_SUBSCRIPTION_EVENT_SOURCE = 0x0001U,
396 /**< Event type: Source */
398 PA_SUBSCRIPTION_EVENT_SINK_INPUT = 0x0002U,
399 /**< Event type: Sink input */
401 PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT = 0x0003U,
402 /**< Event type: Source output */
404 PA_SUBSCRIPTION_EVENT_MODULE = 0x0004U,
405 /**< Event type: Module */
407 PA_SUBSCRIPTION_EVENT_CLIENT = 0x0005U,
408 /**< Event type: Client */
410 PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE = 0x0006U,
411 /**< Event type: Sample cache item */
413 PA_SUBSCRIPTION_EVENT_SERVER = 0x0007U,
414 /**< Event type: Global server change, only occuring with PA_SUBSCRIPTION_EVENT_CHANGE. */
416 PA_SUBSCRIPTION_EVENT_AUTOLOAD = 0x0008U,
417 /**< Event type: Autoload table changes. */
419 PA_SUBSCRIPTION_EVENT_FACILITY_MASK = 0x000FU,
420 /**< A mask to extract the event type from an event value */
422 PA_SUBSCRIPTION_EVENT_NEW = 0x0000U,
423 /**< A new object was created */
425 PA_SUBSCRIPTION_EVENT_CHANGE = 0x0010U,
426 /**< A property of the object was modified */
428 PA_SUBSCRIPTION_EVENT_REMOVE = 0x0020U,
429 /**< An object was removed */
431 PA_SUBSCRIPTION_EVENT_TYPE_MASK = 0x0030U
432 /**< A mask to extract the event operation from an event value */
434 } pa_subscription_event_type_t;
436 /** Return one if an event type t matches an event mask bitfield */
437 #define pa_subscription_match_flags(m, t) (!!((m) & (1 << ((t) & PA_SUBSCRIPTION_EVENT_FACILITY_MASK))))
439 /** A structure for all kinds of timing information of a stream. See
440 * pa_stream_update_timing_info() and pa_stream_get_timing_info(). The
441 * total output latency a sample that is written with
442 * pa_stream_write() takes to be played may be estimated by
443 * sink_usec+buffer_usec+transport_usec. (where buffer_usec is defined
444 * as pa_bytes_to_usec(write_index-read_index)) The output buffer
445 * which buffer_usec relates to may be manipulated freely (with
446 * pa_stream_write()'s seek argument, pa_stream_flush() and friends),
447 * the buffers sink_usec and source_usec relate to are first-in
448 * first-out (FIFO) buffers which cannot be flushed or manipulated in
449 * any way. The total input latency a sample that is recorded takes to
450 * be delivered to the application is:
451 * source_usec+buffer_usec+transport_usec-sink_usec. (Take care of
452 * sign issues!) When connected to a monitor source sink_usec contains
453 * the latency of the owning sink. The two latency estimations
454 * described here are implemented in pa_stream_get_latency(). Please
455 * note that this structure can be extended as part of evolutionary
456 * API updates at any time in any new release.*/
457 typedef struct pa_timing_info {
458 struct timeval timestamp;
459 /**< The time when this timing info structure was current */
461 int synchronized_clocks;
462 /**< Non-zero if the local and the remote machine have
463 * synchronized clocks. If synchronized clocks are detected
464 * transport_usec becomes much more reliable. However, the code
465 * that detects synchronized clocks is very limited und unreliable
466 * itself. */
468 pa_usec_t sink_usec;
469 /**< Time in usecs a sample takes to be played on the sink. For
470 * playback streams and record streams connected to a monitor
471 * source. */
473 pa_usec_t source_usec;
474 /**< Time in usecs a sample takes from being recorded to being
475 * delivered to the application. Only for record streams. */
477 pa_usec_t transport_usec;
478 /**< Estimated time in usecs a sample takes to be transferred
479 * to/from the daemon. For both playback and record streams. */
481 int playing;
482 /**< Non-zero when the stream is currently not underrun and data
483 * is being passed on to the device. Only for playback
484 * streams. This field does not say whether the data is actually
485 * already being played. To determine this check whether
486 * since_underrun (converted to usec) is larger than sink_usec.*/
488 int write_index_corrupt;
489 /**< Non-zero if write_index is not up-to-date because a local
490 * write command that corrupted it has been issued in the time
491 * since this latency info was current . Only write commands with
492 * SEEK_RELATIVE_ON_READ and SEEK_RELATIVE_END can corrupt
493 * write_index. */
495 int64_t write_index;
496 /**< Current write index into the playback buffer in bytes. Think
497 * twice before using this for seeking purposes: it might be out
498 * of date a the time you want to use it. Consider using
499 * PA_SEEK_RELATIVE instead. */
501 int read_index_corrupt;
502 /**< Non-zero if read_index is not up-to-date because a local
503 * pause or flush request that corrupted it has been issued in the
504 * time since this latency info was current. */
506 int64_t read_index;
507 /**< Current read index into the playback buffer in bytes. Think
508 * twice before using this for seeking purposes: it might be out
509 * of date a the time you want to use it. Consider using
510 * PA_SEEK_RELATIVE_ON_READ instead. */
512 pa_usec_t configured_sink_usec;
513 /**< The configured latency for the sink. \since 0.9.11 */
515 pa_usec_t configured_source_usec;
516 /**< The configured latency for * the source. \since 0.9.11 */
518 int64_t since_underrun;
519 /**< Bytes that were handed to the sink since the last underrun
520 * happened, or since playback started again after the last
521 * underrun. playing will tell you which case it is. \since
522 * 0.9.11 */
524 } pa_timing_info;
526 /** A structure for the spawn api. This may be used to integrate auto
527 * spawned daemons into your application. For more information see
528 * pa_context_connect(). When spawning a new child process the
529 * waitpid() is used on the child's PID. The spawn routine will not
530 * block or ignore SIGCHLD signals, since this cannot be done in a
531 * thread compatible way. You might have to do this in
532 * prefork/postfork. */
533 typedef struct pa_spawn_api {
534 void (*prefork)(void);
535 /**< Is called just before the fork in the parent process. May be
536 * NULL. */
538 void (*postfork)(void);
539 /**< Is called immediately after the fork in the parent
540 * process. May be NULL.*/
542 void (*atfork)(void);
543 /**< Is called immediately after the fork in the child
544 * process. May be NULL. It is not safe to close all file
545 * descriptors in this function unconditionally, since a UNIX
546 * socket (created using socketpair()) is passed to the new
547 * process. */
548 } pa_spawn_api;
550 /** Seek type for pa_stream_write(). */
551 typedef enum pa_seek_mode {
552 PA_SEEK_RELATIVE = 0,
553 /**< Seek relatively to the write index */
555 PA_SEEK_ABSOLUTE = 1,
556 /**< Seek relatively to the start of the buffer queue */
558 PA_SEEK_RELATIVE_ON_READ = 2,
559 /**< Seek relatively to the read index. */
561 PA_SEEK_RELATIVE_END = 3
562 /**< Seek relatively to the current end of the buffer queue. */
563 } pa_seek_mode_t;
565 /** Special sink flags. */
566 typedef enum pa_sink_flags {
567 PA_SINK_HW_VOLUME_CTRL = 0x0001U,
568 /**< Supports hardware volume control */
570 PA_SINK_LATENCY = 0x0002U,
571 /**< Supports latency querying */
573 PA_SINK_HARDWARE = 0x0004U,
574 /**< Is a hardware sink of some kind, in contrast to
575 * "virtual"/software sinks \since 0.9.3 */
577 PA_SINK_NETWORK = 0x0008U,
578 /**< Is a networked sink of some kind. \since 0.9.7 */
580 PA_SINK_HW_MUTE_CTRL = 0x0010U,
581 /**< Supports hardware mute control \since 0.9.11 */
583 PA_SINK_DECIBEL_VOLUME = 0x0020U
584 /**< Volume can be translated to dB with pa_sw_volume_to_dB()
585 * \since 0.9.11 */
586 } pa_sink_flags_t;
588 /** \cond fulldocs */
589 #define PA_SINK_HW_VOLUME_CTRL PA_SINK_HW_VOLUME_CTRL
590 #define PA_SINK_LATENCY PA_SINK_LATENCY
591 #define PA_SINK_HARDWARE PA_SINK_HARDWARE
592 #define PA_SINK_NETWORK PA_SINK_NETWORK
593 #define PA_SINK_HW_VOLUME_CTRL PA_SINK_HW_VOLUME_CTRL
594 #define PA_SINK_DECIBEL_VOLUME PA_SINK_DECIBEL_VOLUME
595 /** \endcond */
597 /** Special source flags. */
598 typedef enum pa_source_flags {
599 PA_SOURCE_HW_VOLUME_CTRL = 0x0001U,
600 /**< Supports hardware volume control */
602 PA_SOURCE_LATENCY = 0x0002U,
603 /**< Supports latency querying */
605 PA_SOURCE_HARDWARE = 0x0004U,
606 /**< Is a hardware source of some kind, in contrast to
607 * "virtual"/software source \since 0.9.3 */
609 PA_SOURCE_NETWORK = 0x0008U,
610 /**< Is a networked sink of some kind. \since 0.9.7 */
612 PA_SOURCE_HW_MUTE_CTRL = 0x0010U,
613 /**< Supports hardware mute control \since 0.9.11 */
615 PA_SOURCE_DECIBEL_VOLUME = 0x0020U
616 /**< Volume can be translated to dB with pa_sw_volume_to_dB()
617 * \since 0.9.11 */
618 } pa_source_flags_t;
620 /** \cond fulldocs */
621 #define PA_SOURCE_HW_VOLUME_CTRL PA_SOURCE_HW_VOLUME_CTRL
622 #define PA_SOURCE_LATENCY PA_SOURCE_LATENCY
623 #define PA_SOURCE_HARDWARE PA_SOURCE_HARDWARE
624 #define PA_SOURCE_NETWORK PA_SOURCE_NETWORK
625 #define PA_SOURCE_HW_VOLUME_CTRL PA_SOURCE_HW_VOLUME_CTRL
626 #define PA_SOURCE_DECIBEL_VOLUME PA_SOURCE_DECIBEL_VOLUME
627 /** \endcond */
629 /** A generic free() like callback prototype */
630 typedef void (*pa_free_cb_t)(void *p);
632 PA_C_DECL_END
634 #endif