Yes, yet another evil all-in-one commit of intervowen changes. I suck.
[platform/upstream/pulseaudio.git] / src / pulse / stream.h
1 #ifndef foostreamhfoo
2 #define foostreamhfoo
3
4 /* $Id$ */
5
6 /***
7   This file is part of PulseAudio.
8
9   Copyright 2004-2006 Lennart Poettering
10   Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
11
12   PulseAudio is free software; you can redistribute it and/or modify
13   it under the terms of the GNU Lesser General Public License as published
14   by the Free Software Foundation; either version 2 of the License,
15   or (at your option) any later version.
16
17   PulseAudio is distributed in the hope that it will be useful, but
18   WITHOUT ANY WARRANTY; without even the implied warranty of
19   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20   General Public License for more details.
21
22   You should have received a copy of the GNU Lesser General Public License
23   along with PulseAudio; if not, write to the Free Software
24   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
25   USA.
26 ***/
27
28 #include <sys/types.h>
29
30 #include <pulse/sample.h>
31 #include <pulse/channelmap.h>
32 #include <pulse/volume.h>
33 #include <pulse/def.h>
34 #include <pulse/cdecl.h>
35 #include <pulse/operation.h>
36
37 /** \page streams Audio Streams
38  *
39  * \section overv_sec Overview
40  *
41  * Audio streams form the central functionality of the sound server. Data is
42  * routed, converted and mixed from several sources before it is passed along
43  * to a final output. Currently, there are three forms of audio streams:
44  *
45  * \li Playback streams - Data flows from the client to the server.
46  * \li Record streams - Data flows from the server to the client.
47  * \li Upload streams - Similar to playback streams, but the data is stored in
48  *                      the sample cache. See \ref scache for more information
49  *                      about controlling the sample cache.
50  *
51  * \section create_sec Creating
52  *
53  * To access a stream, a pa_stream object must be created using
54  * pa_stream_new(). At this point the audio sample format and mapping of
55  * channels must be specified. See \ref sample and \ref channelmap for more
56  * information about those structures.
57  *
58  * This first step will only create a client-side object, representing the
59  * stream. To use the stream, a server-side object must be created and
60  * associated with the local object. Depending on which type of stream is
61  * desired, a different function is needed:
62  *
63  * \li Playback stream - pa_stream_connect_playback()
64  * \li Record stream - pa_stream_connect_record()
65  * \li Upload stream - pa_stream_connect_upload() (see \ref scache)
66  *
67  * Similar to how connections are done in contexts, connecting a stream will
68  * not generate a pa_operation object. Also like contexts, the application
69  * should register a state change callback, using
70  * pa_stream_set_state_callback(), and wait for the stream to enter an active
71  * state.
72  *
73  * \subsection bufattr_subsec Buffer Attributes
74  *
75  * Playback and record streams always have a server side buffer as
76  * part of the data flow.  The size of this buffer strikes a
77  * compromise between low latency and sensitivity for buffer
78  * overflows/underruns.
79  *
80  * The buffer metrics may be controlled by the application. They are
81  * described with a pa_buffer_attr structure which contains a number
82  * of fields:
83  *
84  * \li maxlength - The absolute maximum number of bytes that can be stored in
85  *                 the buffer. If this value is exceeded then data will be
86  *                 lost.
87  * \li tlength - The target length of a playback buffer. The server will only
88  *               send requests for more data as long as the buffer has less
89  *               than this number of bytes of data.
90  * \li prebuf - Number of bytes that need to be in the buffer before
91  * playback will commence. Start of playback can be forced using
92  * pa_stream_trigger() even though the prebuffer size hasn't been
93  * reached. If a buffer underrun occurs, this prebuffering will be
94  * again enabled. If the playback shall never stop in case of a buffer
95  * underrun, this value should be set to 0. In that case the read
96  * index of the output buffer overtakes the write index, and hence the
97  * fill level of the buffer is negative.
98  * \li minreq - Minimum free number of the bytes in the playback buffer before
99  *              the server will request more data.
100  * \li fragsize - Maximum number of bytes that the server will push in one
101  *                chunk for record streams.
102  *
103  * The server side playback buffers are indexed by a write and a read
104  * index. The application writes to the write index and the sound
105  * device reads from the read index. The read index is increased
106  * monotonically, while the write index may be freely controlled by
107  * the application. Substracting the read index from the write index
108  * will give you the current fill level of the buffer. The read/write
109  * indexes are 64bit values and measured in bytes, they will never
110  * wrap. The current read/write index may be queried using
111  * pa_stream_get_timing_info() (see below for more information). In
112  * case of a buffer underrun the read index is equal or larger than
113  * the write index. Unless the prebuf value is 0, PulseAudio will
114  * temporarily pause playback in such a case, and wait until the
115  * buffer is filled up to prebuf bytes again. If prebuf is 0, the
116  * read index may be larger than the write index, in which case
117  * silence is played. If the application writes data to indexes lower
118  * than the read index, the data is immediately lost.
119  *
120  * \section transfer_sec Transferring Data
121  *
122  * Once the stream is up, data can start flowing between the client and the
123  * server. Two different access models can be used to transfer the data:
124  *
125  * \li Asynchronous - The application register a callback using
126  *                    pa_stream_set_write_callback() and
127  *                    pa_stream_set_read_callback() to receive notifications
128  *                    that data can either be written or read.
129  * \li Polled - Query the library for available data/space using
130  *              pa_stream_writable_size() and pa_stream_readable_size() and
131  *              transfer data as needed. The sizes are stored locally, in the
132  *              client end, so there is no delay when reading them.
133  *
134  * It is also possible to mix the two models freely.
135  *
136  * Once there is data/space available, it can be transferred using either
137  * pa_stream_write() for playback, or pa_stream_peek() / pa_stream_drop() for
138  * record. Make sure you do not overflow the playback buffers as data will be
139  * dropped.
140  *
141  * \section bufctl_sec Buffer Control
142  *
143  * The transfer buffers can be controlled through a number of operations:
144  *
145  * \li pa_stream_cork() - Start or stop the playback or recording.
146  * \li pa_stream_trigger() - Start playback immediatly and do not wait for
147  *                           the buffer to fill up to the set trigger level.
148  * \li pa_stream_prebuf() - Reenable the playback trigger level.
149  * \li pa_stream_drain() - Wait for the playback buffer to go empty. Will
150  *                         return a pa_operation object that will indicate when
151  *                         the buffer is completely drained.
152  * \li pa_stream_flush() - Drop all data from the playback buffer and do not
153  *                         wait for it to finish playing.
154  *
155  * \section seek_modes Seeking in the Playback Buffer
156  *
157  * A client application may freely seek in the playback buffer. To
158  * accomplish that the pa_stream_write() function takes a seek mode
159  * and an offset argument. The seek mode is one of:
160  *
161  * \li PA_SEEK_RELATIVE - seek relative to the current write index
162  * \li PA_SEEK_ABSOLUTE - seek relative to the beginning of the playback buffer, (i.e. the first that was ever played in the stream)
163  * \li PA_SEEK_RELATIVE_ON_READ - seek relative to the current read index. Use this to write data to the output buffer that should be played as soon as possible
164  * \li PA_SEEK_RELATIVE_END - seek relative to the last byte ever written.
165  *
166  * If an application just wants to append some data to the output
167  * buffer, PA_SEEK_RELATIVE and an offset of 0 should be used.
168  *
169  * After a call to pa_stream_write() the write index will be left at
170  * the position right after the last byte of the written data.
171  *
172  * \section latency_sec Latency
173  *
174  * A major problem with networked audio is the increased latency caused by
175  * the network. To remedy this, PulseAudio supports an advanced system of
176  * monitoring the current latency.
177  *
178  * To get the raw data needed to calculate latencies, call
179  * pa_stream_get_timing_info(). This will give you a pa_timing_info
180  * structure that contains everything that is known about the server
181  * side buffer transport delays and the backend active in the
182  * server. (Besides other things it contains the write and read index
183  * values mentioned above.)
184  *
185  * This structure is updated every time a
186  * pa_stream_update_timing_info() operation is executed. (i.e. before
187  * the first call to this function the timing information structure is
188  * not available!) Since it is a lot of work to keep this structure
189  * up-to-date manually, PulseAudio can do that automatically for you:
190  * if PA_STREAM_AUTO_TIMING_UPDATE is passed when connecting the
191  * stream PulseAudio will automatically update the structure every
192  * 100ms and every time a function is called that might invalidate the
193  * previously known timing data (such as pa_stream_write() or
194  * pa_stream_flush()). Please note however, that there always is a
195  * short time window when the data in the timing information structure
196  * is out-of-date. PulseAudio tries to mark these situations by
197  * setting the write_index_corrupt and read_index_corrupt fields
198  * accordingly.
199  *
200  * The raw timing data in the pa_timing_info structure is usually hard
201  * to deal with. Therefore a more simplistic interface is available:
202  * you can call pa_stream_get_time() or pa_stream_get_latency(). The
203  * former will return the current playback time of the hardware since
204  * the stream has been started. The latter returns the time a sample
205  * that you write now takes to be played by the hardware. These two
206  * functions base their calculations on the same data that is returned
207  * by pa_stream_get_timing_info(). Hence the same rules for keeping
208  * the timing data up-to-date apply here. In case the write or read
209  * index is corrupted, these two functions will fail with
210  * PA_ERR_NODATA set.
211  *
212  * Since updating the timing info structure usually requires a full
213  * network round trip and some applications monitor the timing very
214  * often PulseAudio offers a timing interpolation system. If
215  * PA_STREAM_INTERPOLATE_TIMING is passed when connecting the stream,
216  * pa_stream_get_time() and pa_stream_get_latency() will try to
217  * interpolate the current playback time/latency by estimating the
218  * number of samples that have been played back by the hardware since
219  * the last regular timing update. It is espcially useful to combine
220  * this option with PA_STREAM_AUTO_TIMING_UPDATE, which will enable
221  * you to monitor the current playback time/latency very precisely and
222  * very frequently without requiring a network round trip every time.
223  *
224  * \section flow_sec Overflow and underflow
225  *
226  * Even with the best precautions, buffers will sometime over - or
227  * underflow.  To handle this gracefully, the application can be
228  * notified when this happens. Callbacks are registered using
229  * pa_stream_set_overflow_callback() and
230  * pa_stream_set_underflow_callback().
231  *
232  * \section sync_streams Sychronizing Multiple Playback Streams
233  *
234  * PulseAudio allows applications to fully synchronize multiple
235  * playback streams that are connected to the same output device. That
236  * means the streams will always be played back sample-by-sample
237  * synchronously. If stream operations like pa_stream_cork() are
238  * issued on one of the synchronized streams, they are simultaneously
239  * issued on the others.
240  *
241  * To synchronize a stream to another, just pass the "master" stream
242  * as last argument to pa_stream_connect_playack(). To make sure that
243  * the freshly created stream doesn't start playback right-away, make
244  * sure to pass PA_STREAM_START_CORKED and - after all streams have
245  * been created - uncork them all with a single call to
246  * pa_stream_cork() for the master stream.
247  *
248  * To make sure that a particular stream doesn't stop to play when a
249  * server side buffer underrun happens on it while the other
250  * synchronized streams continue playing and hence deviate you need to
251  * pass a "prebuf" pa_buffer_attr of 0 when connecting it.
252  *
253  * \section disc_sec Disconnecting
254  *
255  * When a stream has served is purpose it must be disconnected with
256  * pa_stream_disconnect(). If you only unreference it, then it will live on
257  * and eat resources both locally and on the server until you disconnect the
258  * context.
259  *
260  */
261
262 /** \file
263  * Audio streams for input, output and sample upload */
264
265 PA_C_DECL_BEGIN
266
267 /** An opaque stream for playback or recording */
268 typedef struct pa_stream pa_stream;
269
270 /** A generic callback for operation completion */
271 typedef void (*pa_stream_success_cb_t) (pa_stream*s, int success, void *userdata);
272
273 /** A generic request callback */
274 typedef void (*pa_stream_request_cb_t)(pa_stream *p, size_t bytes, void *userdata);
275
276 /** A generic notification callback */
277 typedef void (*pa_stream_notify_cb_t)(pa_stream *p, void *userdata);
278
279 /** Create a new, unconnected stream with the specified name and
280  * sample type. It is recommended to use pa_stream_new_with_proplist()
281  * instead and specify some initial properties. */
282 pa_stream* pa_stream_new(
283         pa_context *c                     /**< The context to create this stream in */,
284         const char *name                  /**< A name for this stream */,
285         const pa_sample_spec *ss          /**< The desired sample format */,
286         const pa_channel_map *map         /**< The desired channel map, or NULL for default */);
287
288 /** Create a new, unconnected stream with the specified name and
289  * sample type, and specify the the initial stream property
290  * list. \since 0.9.11 */
291 pa_stream* pa_stream_new_with_proplist(
292         pa_context *c                     /**< The context to create this stream in */,
293         const char *name                  /**< A name for this stream */,
294         const pa_sample_spec *ss          /**< The desired sample format */,
295         const pa_channel_map *map         /**< The desired channel map, or NULL for default */,
296         pa_proplist *p                    /**< The initial property list */);
297
298 /** Decrease the reference counter by one */
299 void pa_stream_unref(pa_stream *s);
300
301 /** Increase the reference counter by one */
302 pa_stream *pa_stream_ref(pa_stream *s);
303
304 /** Return the current state of the stream */
305 pa_stream_state_t pa_stream_get_state(pa_stream *p);
306
307 /** Return the context this stream is attached to */
308 pa_context* pa_stream_get_context(pa_stream *p);
309
310 /** Return the sink input resp. source output index this stream is
311  * identified in the server with. This is useful for usage with the
312  * introspection functions, such as pa_context_get_sink_input_info()
313  * resp. pa_context_get_source_output_info(). */
314 uint32_t pa_stream_get_index(pa_stream *s);
315
316 /** Return the index of the sink or source this stream is connected to
317  * in the server. This is useful for usage with the introspection
318  * functions, such as pa_context_get_sink_info_by_index()
319  * resp. pa_context_get_source_info_by_index(). Please note that
320  * streams may be moved between sinks/sources and thus it is
321  * recommended to use pa_stream_set_moved_callback() to be notified
322  * about this. This function will return with PA_ERR_NOTSUPPORTED when the
323  * server is older than 0.9.8. \since 0.9.8 */
324 uint32_t pa_stream_get_device_index(pa_stream *s);
325
326 /** Return the name of the sink or source this stream is connected to
327  * in the server. This is useful for usage with the introspection
328  * functions, such as pa_context_get_sink_info_by_name()
329  * resp. pa_context_get_source_info_by_name(). Please note that
330  * streams may be moved between sinks/sources and thus it is
331  * recommended to use pa_stream_set_moved_callback() to be notified
332  * about this. This function will return with PA_ERR_NOTSUPPORTED when the
333  * server is older than 0.9.8. \since 0.9.8 */
334 const char *pa_stream_get_device_name(pa_stream *s);
335
336 /** Return 1 if the sink or source this stream is connected to has
337  * been suspended. This will return 0 if not, and negative on
338  * error. This function will return with PA_ERR_NOTSUPPORTED when the
339  * server is older than 0.9.8. \since 0.9.8 */
340 int pa_stream_is_suspended(pa_stream *s);
341
342 /** Return 1 if the this stream has been corked. This will return 0 if
343  * not, and negative on error. \since 0.9.11 */
344 int pa_stream_is_corked(pa_stream *s);
345
346 /** Connect the stream to a sink */
347 int pa_stream_connect_playback(
348         pa_stream *s                  /**< The stream to connect to a sink */,
349         const char *dev               /**< Name of the sink to connect to, or NULL for default */ ,
350         const pa_buffer_attr *attr    /**< Buffering attributes, or NULL for default */,
351         pa_stream_flags_t flags       /**< Additional flags, or 0 for default */,
352         pa_cvolume *volume            /**< Initial volume, or NULL for default */,
353         pa_stream *sync_stream        /**< Synchronize this stream with the specified one, or NULL for a standalone stream*/);
354
355 /** Connect the stream to a source */
356 int pa_stream_connect_record(
357         pa_stream *s                  /**< The stream to connect to a source */ ,
358         const char *dev               /**< Name of the source to connect to, or NULL for default */,
359         const pa_buffer_attr *attr    /**< Buffer attributes, or NULL for default */,
360         pa_stream_flags_t flags       /**< Additional flags, or 0 for default */);
361
362 /** Disconnect a stream from a source/sink */
363 int pa_stream_disconnect(pa_stream *s);
364
365 /** Write some data to the server (for playback sinks), if free_cb is
366  * non-NULL this routine is called when all data has been written out
367  * and an internal reference to the specified data is kept, the data
368  * is not copied. If NULL, the data is copied into an internal
369  * buffer. The client my freely seek around in the output buffer. For
370  * most applications passing 0 and PA_SEEK_RELATIVE as arguments for
371  * offset and seek should be useful.*/
372 int pa_stream_write(
373         pa_stream *p             /**< The stream to use */,
374         const void *data         /**< The data to write */,
375         size_t nbytes            /**< The length of the data to write in bytes*/,
376         pa_free_cb_t free_cb     /**< A cleanup routine for the data or NULL to request an internal copy */,
377         int64_t offset,          /**< Offset for seeking, must be 0 for upload streams */
378         pa_seek_mode_t seek      /**< Seek mode, must be PA_SEEK_RELATIVE for upload streams */);
379
380 /** Read the next fragment from the buffer (for recording).
381  * data will point to the actual data and length will contain the size
382  * of the data in bytes (which can be less than a complete framgnet).
383  * Use pa_stream_drop() to actually remove the data from the
384  * buffer. If no data is available will return a NULL pointer */
385 int pa_stream_peek(
386         pa_stream *p                 /**< The stream to use */,
387         const void **data            /**< Pointer to pointer that will point to data */,
388         size_t *nbytes               /**< The length of the data read in bytes */);
389
390 /** Remove the current fragment on record streams. It is invalid to do this without first
391  * calling pa_stream_peek(). */
392 int pa_stream_drop(pa_stream *p);
393
394 /** Return the number of bytes that may be written using pa_stream_write() */
395 size_t pa_stream_writable_size(pa_stream *p);
396
397 /** Return the number of bytes that may be read using pa_stream_read()*/
398 size_t pa_stream_readable_size(pa_stream *p);
399
400 /** Drain a playback stream. Use this for notification when the buffer is empty */
401 pa_operation* pa_stream_drain(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
402
403 /** Request a timing info structure update for a stream. Use
404  * pa_stream_get_timing_info() to get access to the raw timing data,
405  * or pa_stream_get_time() or pa_stream_get_latency() to get cleaned
406  * up values. */
407 pa_operation* pa_stream_update_timing_info(pa_stream *p, pa_stream_success_cb_t cb, void *userdata);
408
409 /** Set the callback function that is called whenever the state of the stream changes */
410 void pa_stream_set_state_callback(pa_stream *s, pa_stream_notify_cb_t cb, void *userdata);
411
412 /** Set the callback function that is called when new data may be
413  * written to the stream. */
414 void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
415
416 /** Set the callback function that is called when new data is available from the stream.
417  * Return the number of bytes read.*/
418 void pa_stream_set_read_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
419
420 /** Set the callback function that is called when a buffer overflow happens. (Only for playback streams) */
421 void pa_stream_set_overflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
422
423 /** Set the callback function that is called when a buffer underflow happens. (Only for playback streams) */
424 void pa_stream_set_underflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
425
426 /** Set the callback function that is called when a the server starts
427  * playback after an underrun or on initial startup. This only informs
428  * that audio is flowing again, it is no indication that audio startet
429  * to reach the speakers already. (Only for playback streams). \since
430  * 0.9.11 */
431 void pa_stream_set_started_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
432
433 /** Set the callback function that is called whenever a latency
434  * information update happens. Useful on PA_STREAM_AUTO_TIMING_UPDATE
435  * streams only. (Only for playback streams) */
436 void pa_stream_set_latency_update_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
437
438 /** Set the callback function that is called whenever the stream is
439  * moved to a different sink/source. Use pa_stream_get_device_name()or
440  * pa_stream_get_device_index() to query the new sink/source. This
441  * notification is only generated when the server is at least
442  * 0.9.8. \since 0.9.8 */
443 void pa_stream_set_moved_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
444
445 /** Set the callback function that is called whenever the sink/source
446  * this stream is connected to is suspended or resumed. Use
447  * pa_stream_is_suspended() to query the new suspend status. Please
448  * note that the suspend status might also change when the stream is
449  * moved between devices. Thus if you call this function you very
450  * likely want to call pa_stream_set_moved_callback, too. This
451  * notification is only generated when the server is at least
452  * 0.9.8. \since 0.9.8 */
453 void pa_stream_set_suspended_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
454
455 /** Pause (or resume) playback of this stream temporarily. Available on both playback and recording streams. */
456 pa_operation* pa_stream_cork(pa_stream *s, int b, pa_stream_success_cb_t cb, void *userdata);
457
458 /** Flush the playback buffer of this stream. Most of the time you're
459  * better off using the parameter delta of pa_stream_write() instead
460  * of this function. Available on both playback and recording
461  * streams. */
462 pa_operation* pa_stream_flush(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
463
464 /** Reenable prebuffering as specified in the pa_buffer_attr
465  * structure. Available for playback streams only. */
466 pa_operation* pa_stream_prebuf(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
467
468 /** Request immediate start of playback on this stream. This disables
469  * prebuffering as specified in the pa_buffer_attr structure,
470  * temporarily. Available for playback streams only. */
471 pa_operation* pa_stream_trigger(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
472
473 /** Rename the stream. */
474 pa_operation* pa_stream_set_name(pa_stream *s, const char *name, pa_stream_success_cb_t cb, void *userdata);
475
476 /** Return the current playback/recording time. This is based on the
477  * data in the timing info structure returned by
478  * pa_stream_get_timing_info(). This function will usually only return
479  * new data if a timing info update has been recieved. Only if timing
480  * interpolation has been requested (PA_STREAM_INTERPOLATE_TIMING)
481  * the data from the last timing update is used for an estimation of
482  * the current playback/recording time based on the local time that
483  * passed since the timing info structure has been acquired. The time
484  * value returned by this function is guaranteed to increase
485  * monotonically. (that means: the returned value is always greater or
486  * equal to the value returned on the last call) This behaviour can
487  * be disabled by using PA_STREAM_NOT_MONOTONOUS. This may be
488  * desirable to deal better with bad estimations of transport
489  * latencies, but may have strange effects if the application is not
490  * able to deal with time going 'backwards'. */
491 int pa_stream_get_time(pa_stream *s, pa_usec_t *r_usec);
492
493 /** Return the total stream latency. This function is based on
494  * pa_stream_get_time(). In case the stream is a monitoring stream the
495  * result can be negative, i.e. the captured samples are not yet
496  * played. In this case *negative is set to 1. */
497 int pa_stream_get_latency(pa_stream *s, pa_usec_t *r_usec, int *negative);
498
499 /** Return the latest raw timing data structure. The returned pointer
500  * points to an internal read-only instance of the timing
501  * structure. The user should make a copy of this structure if he
502  * wants to modify it. An in-place update to this data structure may
503  * be requested using pa_stream_update_timing_info(). If no
504  * pa_stream_update_timing_info() call was issued before, this
505  * function will fail with PA_ERR_NODATA. Please note that the
506  * write_index member field (and only this field) is updated on each
507  * pa_stream_write() call, not just when a timing update has been
508  * recieved. */
509 const pa_timing_info* pa_stream_get_timing_info(pa_stream *s);
510
511 /** Return a pointer to the stream's sample specification. */
512 const pa_sample_spec* pa_stream_get_sample_spec(pa_stream *s);
513
514 /** Return a pointer to the stream's channel map. */
515 const pa_channel_map* pa_stream_get_channel_map(pa_stream *s);
516
517 /** Return the buffer metrics of the stream. Only valid after the
518  * stream has been connected successfuly and if the server is at least
519  * PulseAudio 0.9. \since 0.9.0 */
520 const pa_buffer_attr* pa_stream_get_buffer_attr(pa_stream *s);
521
522 /** Change the buffer metrics of the stream during playback. The
523  * server might have chosen different buffer metrics then
524  * requested. The selected metrics may be queried with
525  * pa_stream_get_buffer_attr() as soon as the callback is called. Only
526  * valid after the stream has been connected successfully and if the
527  * server is at least PulseAudio 0.9.8. \since 0.9.8 */
528 pa_operation *pa_stream_set_buffer_attr(pa_stream *s, const pa_buffer_attr *attr, pa_stream_success_cb_t cb, void *userdata);
529
530 /* Change the stream sampling rate during playback. You need to pass
531  * PA_STREAM_VARIABLE_RATE in the flags parameter of
532  * pa_stream_connect() if you plan to use this function. Only valid
533  * after the stream has been connected successfully and if the server
534  * is at least PulseAudio 0.9.8. \since 0.9.8 */
535 pa_operation *pa_stream_update_sample_rate(pa_stream *s, uint32_t rate, pa_stream_success_cb_t cb, void *userdata);
536
537 /* Update the property list of the sink input/source output of this
538  * stream, adding new entries. Please note that it is highly
539  * recommended to set as much properties initially via
540  * pa_stream_new_with_proplist() as possible instead a posteriori with
541  * this function, since that information may then be used to route
542  * this stream to the right device. \since 0.9.11 */
543 pa_operation *pa_stream_proplist_update(pa_stream *s, pa_update_mode_t mode, pa_proplist *p, pa_stream_success_cb_t cb, void *userdata);
544
545 /* Update the property list of the sink input/source output of this
546  * stream, remove entries. \since 0.9.11 */
547 pa_operation *pa_stream_proplist_remove(pa_stream *s, const char *const keys[], pa_stream_success_cb_t cb, void *userdata);
548
549 PA_C_DECL_END
550
551 #endif