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