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