commit glitch-free work
[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.10 */
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 /** Connect the stream to a sink */
343 int pa_stream_connect_playback(
344         pa_stream *s                  /**< The stream to connect to a sink */,
345         const char *dev               /**< Name of the sink to connect to, or NULL for default */ ,
346         const pa_buffer_attr *attr    /**< Buffering attributes, or NULL for default */,
347         pa_stream_flags_t flags       /**< Additional flags, or 0 for default */,
348         pa_cvolume *volume            /**< Initial volume, or NULL for default */,
349         pa_stream *sync_stream        /**< Synchronize this stream with the specified one, or NULL for a standalone stream*/);
350
351 /** Connect the stream to a source */
352 int pa_stream_connect_record(
353         pa_stream *s                  /**< The stream to connect to a source */ ,
354         const char *dev               /**< Name of the source to connect to, or NULL for default */,
355         const pa_buffer_attr *attr    /**< Buffer attributes, or NULL for default */,
356         pa_stream_flags_t flags       /**< Additional flags, or 0 for default */);
357
358 /** Disconnect a stream from a source/sink */
359 int pa_stream_disconnect(pa_stream *s);
360
361 /** Write some data to the server (for playback sinks), if free_cb is
362  * non-NULL this routine is called when all data has been written out
363  * and an internal reference to the specified data is kept, the data
364  * is not copied. If NULL, the data is copied into an internal
365  * buffer. The client my freely seek around in the output buffer. For
366  * most applications passing 0 and PA_SEEK_RELATIVE as arguments for
367  * offset and seek should be useful.*/
368 int pa_stream_write(
369         pa_stream *p             /**< The stream to use */,
370         const void *data         /**< The data to write */,
371         size_t bytes             /**< The length of the data to write in bytes*/,
372         pa_free_cb_t free_cb     /**< A cleanup routine for the data or NULL to request an internal copy */,
373         int64_t offset,          /**< Offset for seeking, must be 0 for upload streams */
374         pa_seek_mode_t seek      /**< Seek mode, must be PA_SEEK_RELATIVE for upload streams */);
375
376 /** Read the next fragment from the buffer (for recording).
377  * data will point to the actual data and length will contain the size
378  * of the data in bytes (which can be less than a complete framgnet).
379  * Use pa_stream_drop() to actually remove the data from the
380  * buffer. If no data is available will return a NULL pointer  \since 0.8 */
381 int pa_stream_peek(
382         pa_stream *p                 /**< The stream to use */,
383         const void **data            /**< Pointer to pointer that will point to data */,
384         size_t *bytes                /**< The length of the data read in bytes */);
385
386 /** Remove the current fragment on record streams. It is invalid to do this without first
387  * calling pa_stream_peek(). \since 0.8 */
388 int pa_stream_drop(pa_stream *p);
389
390 /** Return the number of bytes that may be written using pa_stream_write() */
391 size_t pa_stream_writable_size(pa_stream *p);
392
393 /** Return the number of bytes that may be read using pa_stream_read() \since 0.8 */
394 size_t pa_stream_readable_size(pa_stream *p);
395
396 /** Drain a playback stream. Use this for notification when the buffer is empty */
397 pa_operation* pa_stream_drain(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
398
399 /** Request a timing info structure update for a stream. Use
400  * pa_stream_get_timing_info() to get access to the raw timing data,
401  * or pa_stream_get_time() or pa_stream_get_latency() to get cleaned
402  * up values. */
403 pa_operation* pa_stream_update_timing_info(pa_stream *p, pa_stream_success_cb_t cb, void *userdata);
404
405 /** Set the callback function that is called whenever the state of the stream changes */
406 void pa_stream_set_state_callback(pa_stream *s, pa_stream_notify_cb_t cb, void *userdata);
407
408 /** Set the callback function that is called when new data may be
409  * written to the stream. */
410 void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
411
412 /** Set the callback function that is called when new data is available from the stream.
413  * Return the number of bytes read. \since 0.8 */
414 void pa_stream_set_read_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
415
416 /** Set the callback function that is called when a buffer overflow happens. (Only for playback streams) \since 0.8 */
417 void pa_stream_set_overflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
418
419 /** Set the callback function that is called when a buffer underflow happens. (Only for playback streams) \since 0.8 */
420 void pa_stream_set_underflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
421
422 /** Set the callback function that is called whenever a latency
423  * information update happens. Useful on PA_STREAM_AUTO_TIMING_UPDATE
424  * streams only. (Only for playback streams) \since 0.8.2 */
425 void pa_stream_set_latency_update_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
426
427 /** Set the callback function that is called whenever the stream is
428  * moved to a different sink/source. Use pa_stream_get_device_name()or
429  * pa_stream_get_device_index() to query the new sink/source. This
430  * notification is only generated when the server is at least
431  * 0.9.8. \since 0.9.8 */
432 void pa_stream_set_moved_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
433
434 /** Set the callback function that is called whenever the sink/source
435  * this stream is connected to is suspended or resumed. Use
436  * pa_stream_is_suspended() to query the new suspend status. Please
437  * note that the suspend status might also change when the stream is
438  * moved between devices. Thus if you call this function you very
439  * likely want to call pa_stream_set_moved_callback, too. This
440  * notification is only generated when the server is at least
441  * 0.9.8. \since 0.9.8 */
442 void pa_stream_set_suspended_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
443
444 /** Pause (or resume) playback of this stream temporarily. Available on both playback and recording streams. \since 0.3 */
445 pa_operation* pa_stream_cork(pa_stream *s, int b, pa_stream_success_cb_t cb, void *userdata);
446
447 /** Flush the playback buffer of this stream. Most of the time you're
448  * better off using the parameter delta of pa_stream_write() instead of this
449  * function. Available on both playback and recording streams. \since 0.3 */
450 pa_operation* pa_stream_flush(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
451
452 /** Reenable prebuffering as specified in the pa_buffer_attr
453  * structure. Available for playback streams only. \since 0.6 */
454 pa_operation* pa_stream_prebuf(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
455
456 /** Request immediate start of playback on this stream. This disables
457  * prebuffering as specified in the pa_buffer_attr
458  * structure, temporarily. Available for playback streams only. \since 0.3 */
459 pa_operation* pa_stream_trigger(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
460
461 /** Rename the stream. \since 0.5 */
462 pa_operation* pa_stream_set_name(pa_stream *s, const char *name, pa_stream_success_cb_t cb, void *userdata);
463
464 /** Return the current playback/recording time. This is based on the
465  * data in the timing info structure returned by
466  * pa_stream_get_timing_info(). This function will usually only return
467  * new data if a timing info update has been recieved. Only if timing
468  * interpolation has been requested (PA_STREAM_INTERPOLATE_TIMING)
469  * the data from the last timing update is used for an estimation of
470  * the current playback/recording time based on the local time that
471  * passed since the timing info structure has been acquired. The time
472  * value returned by this function is guaranteed to increase
473  * monotonically. (that means: the returned value is always greater or
474  * equal to the value returned on the last call) This behaviour can
475  * be disabled by using PA_STREAM_NOT_MONOTONOUS. This may be
476  * desirable to deal better with bad estimations of transport
477  * latencies, but may have strange effects if the application is not
478  * able to deal with time going 'backwards'. \since 0.6 */
479 int pa_stream_get_time(pa_stream *s, pa_usec_t *r_usec);
480
481 /** Return the total stream latency. This function is based on
482  * pa_stream_get_time(). In case the stream is a monitoring stream the
483  * result can be negative, i.e. the captured samples are not yet
484  * played. In this case *negative is set to 1. \since 0.6 */
485 int pa_stream_get_latency(pa_stream *s, pa_usec_t *r_usec, int *negative);
486
487 /** Return the latest raw timing data structure. The returned pointer
488  * points to an internal read-only instance of the timing
489  * structure. The user should make a copy of this structure if he
490  * wants to modify it. An in-place update to this data structure may
491  * be requested using pa_stream_update_timing_info(). If no
492  * pa_stream_update_timing_info() call was issued before, this
493  * function will fail with PA_ERR_NODATA. Please note that the
494  * write_index member field (and only this field) is updated on each
495  * pa_stream_write() call, not just when a timing update has been
496  * recieved. \since 0.8 */
497 const pa_timing_info* pa_stream_get_timing_info(pa_stream *s);
498
499 /** Return a pointer to the stream's sample specification. \since 0.6 */
500 const pa_sample_spec* pa_stream_get_sample_spec(pa_stream *s);
501
502 /** Return a pointer to the stream's channel map. \since 0.8 */
503 const pa_channel_map* pa_stream_get_channel_map(pa_stream *s);
504
505 /** Return the buffer metrics of the stream. Only valid after the
506  * stream has been connected successfuly and if the server is at least
507  * PulseAudio 0.9. \since 0.9.0 */
508 const pa_buffer_attr* pa_stream_get_buffer_attr(pa_stream *s);
509
510 /** Change the buffer metrics of the stream during playback. The
511  * server might have chosen different buffer metrics then
512  * requested. The selected metrics may be queried with
513  * pa_stream_get_buffer_attr() as soon as the callback is called. Only
514  * valid after the stream has been connected successfully and if the
515  * server is at least PulseAudio 0.9.8. \since 0.9.8 */
516 pa_operation *pa_stream_set_buffer_attr(pa_stream *s, const pa_buffer_attr *attr, pa_stream_success_cb_t cb, void *userdata);
517
518 /* Change the stream sampling rate during playback. You need to pass
519  * PA_STREAM_VARIABLE_RATE in the flags parameter of
520  * pa_stream_connect() if you plan to use this function. Only valid
521  * after the stream has been connected successfully and if the server
522  * is at least PulseAudio 0.9.8. \since 0.9.8 */
523 pa_operation *pa_stream_update_sample_rate(pa_stream *s, uint32_t rate, pa_stream_success_cb_t cb, void *userdata);
524
525 /* Update the property list of the sink input/source output of this
526  * stream, adding new entries. Please note that it is highly
527  * recommended to set as much properties initially via
528  * pa_stream_new_with_proplist() as possible instead a posteriori with
529  * this function, since that information may then be used to route
530  * this stream to the right device. \since 0.9.10 */
531 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);
532
533 /* Update the property list of the sink input/source output of this stream, remove entries. \since 0.9.10 */
534 pa_operation *pa_stream_proplist_remove(pa_stream *s, const char *const keys[], pa_stream_success_cb_t cb, void *userdata);
535
536 PA_C_DECL_END
537
538 #endif