blob: 61e14b48a20327af4d5e6779a999c175f8e28fb5 [file] [log] [blame]
Benny Prijono2cd64f82009-02-17 19:57:48 +00001/* $Id$ */
2/*
3 * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
4 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
Benny Prijono10454dc2009-02-21 14:21:59 +000020#ifndef __PJMEDIA_AUDIODEV_AUDIODEV_H__
21#define __PJMEDIA_AUDIODEV_AUDIODEV_H__
Benny Prijono2cd64f82009-02-17 19:57:48 +000022
23/**
24 * @file audiodev.h
25 * @brief Audio device API.
26 */
Benny Prijono2058f472009-02-22 17:15:34 +000027#include <pjmedia-audiodev/config.h>
Benny Prijono8eeab0b2009-03-04 19:00:28 +000028#include <pjmedia-audiodev/errno.h>
Benny Prijono64f91382009-03-05 18:02:28 +000029#include <pjmedia/types.h>
Benny Prijono2cd64f82009-02-17 19:57:48 +000030#include <pj/pool.h>
31
32
33PJ_BEGIN_DECL
34
35/**
Benny Prijono2058f472009-02-22 17:15:34 +000036 * @defgroup s2_audio_device_reference Audio Device API Reference
37 * @ingroup audio_device_api
38 * @brief API Reference
Benny Prijono2cd64f82009-02-17 19:57:48 +000039 * @{
40 */
41
Benny Prijono10454dc2009-02-21 14:21:59 +000042/**
43 * Type for device index.
44 */
45typedef pj_int32_t pjmedia_aud_dev_index;
Benny Prijono2cd64f82009-02-17 19:57:48 +000046
Benny Prijono96e74f32009-02-22 12:00:12 +000047/**
48 * Device index constants.
Benny Prijono10454dc2009-02-21 14:21:59 +000049 */
Benny Prijono96e74f32009-02-22 12:00:12 +000050enum
51{
52 /**
53 * Constant to denote default capture device
54 */
55 PJMEDIA_AUD_DEFAULT_CAPTURE_DEV = -1,
56
57 /**
58 * Constant to denote default playback device
59 */
60 PJMEDIA_AUD_DEFAULT_PLAYBACK_DEV = -2,
61
62 /**
63 * Constant to denote invalid device index.
64 */
65 PJMEDIA_AUD_INVALID_DEV = -3
66};
67
Benny Prijono10454dc2009-02-21 14:21:59 +000068
69/**
70 * Type for device unique identifier. The unique device ID can be used to save
71 * a reference to a particular device across software reboots.
72 */
73typedef pj_uint32_t pjmedia_aud_dev_uid;
Benny Prijono2cd64f82009-02-17 19:57:48 +000074
75
76/**
77 * This enumeration identifies various audio device capabilities. These audio
78 * capabilities indicates what features are supported by the underlying
79 * audio device implementation.
80 *
81 * Applications get these capabilities in the #pjmedia_aud_dev_info structure.
82 *
83 * Application can also set the specific features/capabilities when opening
Benny Prijono10454dc2009-02-21 14:21:59 +000084 * the audio stream by setting the \a flags member of #pjmedia_aud_param
Benny Prijono2cd64f82009-02-17 19:57:48 +000085 * structure.
86 *
87 * Once audio stream is running, application can also retrieve or set some
88 * specific audio capability, by using #pjmedia_aud_stream_get_cap() and
89 * #pjmedia_aud_stream_set_cap() and specifying the desired capability. The
90 * value of the capability is specified as pointer, and application needs to
91 * supply the pointer with the correct value, according to the documentation
92 * of each of the capability.
93 */
94typedef enum pjmedia_aud_dev_cap
95{
96 /**
97 * Support for audio formats other than PCM. The value of this capability
98 * is represented by #pjmedia_format structure.
99 */
100 PJMEDIA_AUD_DEV_CAP_EXT_FORMAT = 1,
101
102 /**
103 * Support for audio input latency control or query. The value of this
104 * capability is an unsigned integer containing milliseconds value of
105 * the latency.
106 */
107 PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY = 2,
108
109 /**
110 * Support for audio output latency control or query. The value of this
111 * capability is an unsigned integer containing milliseconds value of
112 * the latency.
113 */
114 PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY = 4,
115
116 /**
Benny Prijono598b01d2009-02-18 13:55:03 +0000117 * Support for setting/retrieving the audio input device volume level.
118 * The value of this capability is an unsigned integer representing
119 * the input audio volume setting in percent.
Benny Prijono2cd64f82009-02-17 19:57:48 +0000120 */
Benny Prijono598b01d2009-02-18 13:55:03 +0000121 PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING = 8,
Benny Prijono2cd64f82009-02-17 19:57:48 +0000122
123 /**
Benny Prijono598b01d2009-02-18 13:55:03 +0000124 * Support for setting/retrieving the audio output device volume level.
125 * The value of this capability is an unsigned integer representing
126 * the output audio volume setting in percent.
Benny Prijono2cd64f82009-02-17 19:57:48 +0000127 */
Benny Prijono598b01d2009-02-18 13:55:03 +0000128 PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING = 16,
Benny Prijono2cd64f82009-02-17 19:57:48 +0000129
130 /**
Benny Prijono598b01d2009-02-18 13:55:03 +0000131 * Support for monitoring the current audio input signal volume.
132 * The value of this capability is an unsigned integer representing
133 * the audio volume in percent.
134 */
Benny Prijono10454dc2009-02-21 14:21:59 +0000135 PJMEDIA_AUD_DEV_CAP_INPUT_SIGNAL_METER = 32,
Benny Prijono598b01d2009-02-18 13:55:03 +0000136
137 /**
138 * Support for monitoring the current audio output signal volume.
139 * The value of this capability is an unsigned integer representing
140 * the audio volume in percent.
141 */
Benny Prijono10454dc2009-02-21 14:21:59 +0000142 PJMEDIA_AUD_DEV_CAP_OUTPUT_SIGNAL_METER = 64,
Benny Prijono598b01d2009-02-18 13:55:03 +0000143
144 /**
145 * Support for audio input routing. The value of this capability is an
146 * integer containing #pjmedia_aud_dev_route enumeration.
147 */
148 PJMEDIA_AUD_DEV_CAP_INPUT_ROUTE = 128,
149
150 /**
151 * Support for audio output routing (e.g. loudspeaker vs earpiece). The
152 * value of this capability is an integer containing #pjmedia_aud_dev_route
Benny Prijono2cd64f82009-02-17 19:57:48 +0000153 * enumeration.
154 */
Benny Prijono598b01d2009-02-18 13:55:03 +0000155 PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE = 256,
Benny Prijono2cd64f82009-02-17 19:57:48 +0000156
157 /**
158 * The audio device has echo cancellation feature. The value of this
Benny Prijono10454dc2009-02-21 14:21:59 +0000159 * capability is a pj_bool_t containing boolean PJ_TRUE or PJ_FALSE.
Benny Prijono2cd64f82009-02-17 19:57:48 +0000160 */
Benny Prijono598b01d2009-02-18 13:55:03 +0000161 PJMEDIA_AUD_DEV_CAP_EC = 512,
Benny Prijono2cd64f82009-02-17 19:57:48 +0000162
163 /**
164 * The audio device supports setting echo cancellation fail length. The
165 * value of this capability is an unsigned integer representing the
166 * echo tail in milliseconds.
167 */
Benny Prijono598b01d2009-02-18 13:55:03 +0000168 PJMEDIA_AUD_DEV_CAP_EC_TAIL = 1024,
Benny Prijono2cd64f82009-02-17 19:57:48 +0000169
170 /**
171 * The audio device has voice activity detection feature. The value
Benny Prijono10454dc2009-02-21 14:21:59 +0000172 * of this capability is a pj_bool_t containing boolean PJ_TRUE or
Benny Prijono2cd64f82009-02-17 19:57:48 +0000173 * PJ_FALSE.
174 */
Benny Prijono598b01d2009-02-18 13:55:03 +0000175 PJMEDIA_AUD_DEV_CAP_VAD = 2048,
Benny Prijono2cd64f82009-02-17 19:57:48 +0000176
177 /**
178 * The audio device has comfort noise generation feature. The value
Benny Prijono10454dc2009-02-21 14:21:59 +0000179 * of this capability is a pj_bool_t containing boolean PJ_TRUE or
Benny Prijono2cd64f82009-02-17 19:57:48 +0000180 * PJ_FALSE.
181 */
Benny Prijono598b01d2009-02-18 13:55:03 +0000182 PJMEDIA_AUD_DEV_CAP_CNG = 4096,
Benny Prijono2cd64f82009-02-17 19:57:48 +0000183
184 /**
185 * The audio device has packet loss concealment feature. The value
Benny Prijono10454dc2009-02-21 14:21:59 +0000186 * of this capability is a pj_bool_t containing boolean PJ_TRUE or
Benny Prijono2cd64f82009-02-17 19:57:48 +0000187 * PJ_FALSE.
188 */
Benny Prijono598b01d2009-02-18 13:55:03 +0000189 PJMEDIA_AUD_DEV_CAP_PLC = 8192
Benny Prijono2cd64f82009-02-17 19:57:48 +0000190
191} pjmedia_aud_dev_cap;
192
193
194/**
195 * This enumeration describes audio routing setting.
196 */
197typedef enum pjmedia_aud_dev_route
198{
199 /** Default route. */
200 PJMEDIA_AUD_DEV_ROUTE_DEFAULT = 0,
201
202 /** Route to loudspeaker */
203 PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER = 1,
204
205 /** Route to earpiece */
206 PJMEDIA_AUD_DEV_ROUTE_EARPIECE = 2
207
208} pjmedia_aud_dev_route;
209
210
211/**
Benny Prijono2058f472009-02-22 17:15:34 +0000212 * Device information structure returned by #pjmedia_aud_dev_get_info().
Benny Prijono2cd64f82009-02-17 19:57:48 +0000213 */
214typedef struct pjmedia_aud_dev_info
215{
216 /**
217 * The device name
218 */
219 char name[64];
220
221 /**
222 * Maximum number of input channels supported by this device. If the
223 * value is zero, the device does not support input operation (i.e.
224 * it is a playback only device).
225 */
226 unsigned input_count;
227
228 /**
229 * Maximum number of output channels supported by this device. If the
230 * value is zero, the device does not support output operation (i.e.
231 * it is an input only device).
232 */
233 unsigned output_count;
234
235 /**
236 * Default sampling rate.
237 */
238 unsigned default_samples_per_sec;
239
240 /**
241 * The underlying driver name
242 */
Benny Prijono10454dc2009-02-21 14:21:59 +0000243 char driver[32];
Benny Prijono2cd64f82009-02-17 19:57:48 +0000244
245 /**
246 * Device capabilities, as bitmask combination of #pjmedia_aud_dev_cap.
247 */
248 unsigned caps;
249
250 /**
251 * Supported audio device routes, as bitmask combination of
252 * #pjmedia_aud_dev_route. The value may be zero if the device
253 * does not support audio routing.
254 */
255 unsigned routes;
256
257 /**
258 * Number of audio formats supported by this device. The value may be
259 * zero if the device does not support non-PCM format.
260 */
261 unsigned ext_fmt_cnt;
262
263 /**
264 * Array of supported extended audio formats
265 */
266 pjmedia_format ext_fmt[8];
267
268
269} pjmedia_aud_dev_info;
270
271
272/**
273 * This callback is called by player stream when it needs additional data
274 * to be played by the device. Application must fill in the whole of output
275 * buffer with audio samples.
276 *
Benny Prijono598b01d2009-02-18 13:55:03 +0000277 * The frame argument contains the following values:
278 * - timestamp Playback timestamp, in samples.
279 * - buf Buffer to be filled out by application.
280 * - size The size requested in bytes, which will be equal to
281 * the size of one whole packet.
Benny Prijono2cd64f82009-02-17 19:57:48 +0000282 *
Benny Prijono598b01d2009-02-18 13:55:03 +0000283 * @param user_data User data associated with the stream.
284 * @param frame Audio frame, which buffer is to be filled in by
285 * the application.
286 *
287 * @return Returning non-PJ_SUCCESS will cause the audio stream
288 * to stop
Benny Prijono2cd64f82009-02-17 19:57:48 +0000289 */
Benny Prijono598b01d2009-02-18 13:55:03 +0000290typedef pj_status_t (*pjmedia_aud_play_cb)(void *user_data,
291 pjmedia_frame *frame);
Benny Prijono2cd64f82009-02-17 19:57:48 +0000292
293/**
294 * This callback is called by recorder stream when it has captured the whole
295 * packet worth of audio samples.
296 *
Benny Prijono598b01d2009-02-18 13:55:03 +0000297 * @param user_data User data associated with the stream.
298 * @param frame Captured frame.
Benny Prijono2cd64f82009-02-17 19:57:48 +0000299 *
Benny Prijono598b01d2009-02-18 13:55:03 +0000300 * @return Returning non-PJ_SUCCESS will cause the audio stream
301 * to stop
Benny Prijono2cd64f82009-02-17 19:57:48 +0000302 */
Benny Prijono598b01d2009-02-18 13:55:03 +0000303typedef pj_status_t (*pjmedia_aud_rec_cb)(void *user_data,
304 pjmedia_frame *frame);
Benny Prijono2cd64f82009-02-17 19:57:48 +0000305
306/**
Benny Prijono10454dc2009-02-21 14:21:59 +0000307 * This structure specifies the parameters to open the audio stream.
Benny Prijono2cd64f82009-02-17 19:57:48 +0000308 */
Benny Prijono10454dc2009-02-21 14:21:59 +0000309typedef struct pjmedia_aud_param
Benny Prijono2cd64f82009-02-17 19:57:48 +0000310{
311 /**
312 * The audio direction. This setting is mandatory.
313 */
314 pjmedia_dir dir;
315
316 /**
317 * The audio recorder device ID. This setting is mandatory if the audio
318 * direction includes input/capture direction.
319 */
Benny Prijono10454dc2009-02-21 14:21:59 +0000320 pjmedia_aud_dev_index rec_id;
Benny Prijono2cd64f82009-02-17 19:57:48 +0000321
322 /**
323 * The audio playback device ID. This setting is mandatory if the audio
324 * direction includes output/playback direction.
325 */
Benny Prijono10454dc2009-02-21 14:21:59 +0000326 pjmedia_aud_dev_index play_id;
Benny Prijono2cd64f82009-02-17 19:57:48 +0000327
328 /**
329 * Clock rate/sampling rate. This setting is mandatory.
330 */
331 unsigned clock_rate;
332
333 /**
334 * Number of channels. This setting is mandatory.
335 */
336 unsigned channel_count;
337
338 /**
339 * Number of samples per frame. This setting is mandatory.
340 */
341 unsigned samples_per_frame;
342
343 /**
344 * Number of bits per sample. This setting is mandatory.
345 */
346 unsigned bits_per_sample;
347
348 /**
349 * This flags specifies which of the optional settings are valid in this
350 * structure. The flags is bitmask combination of pjmedia_aud_dev_cap.
351 */
352 unsigned flags;
353
354 /**
355 * Set the audio format. This setting is optional, and will only be used
356 * if PJMEDIA_AUD_DEV_CAP_EXT_FORMAT is set in the flags.
357 */
358 pjmedia_format ext_fmt;
359
360 /**
361 * Input latency, in milliseconds. This setting is optional, and will
362 * only be used if PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY is set in the flags.
363 */
364 unsigned input_latency_ms;
365
366 /**
367 * Input latency, in milliseconds. This setting is optional, and will
368 * only be used if PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY is set in the flags.
369 */
370 unsigned output_latency_ms;
371
372 /**
Benny Prijono598b01d2009-02-18 13:55:03 +0000373 * Set the audio output route. This setting is optional, and will only be
374 * used if PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE is set in the flags.
Benny Prijono2cd64f82009-02-17 19:57:48 +0000375 */
Benny Prijono598b01d2009-02-18 13:55:03 +0000376 pjmedia_aud_dev_route out_route;
Benny Prijono2cd64f82009-02-17 19:57:48 +0000377
378 /**
379 * Enable/disable echo canceller, if the device supports it. This setting
380 * is optional, and will only be used if PJMEDIA_AUD_DEV_CAP_EC is set in
381 * the flags.
382 */
383 pj_bool_t ec_enabled;
384
385 /**
386 * Set echo canceller tail length in milliseconds, if the device supports
387 * it. This setting is optional, and will only be used if
388 * PJMEDIA_AUD_DEV_CAP_EC_TAIL is set in the flags.
389 */
390 unsigned ec_tail_ms;
391
392 /**
393 * Enable/disable PLC. This setting is optional, and will only be used
394 * if PJMEDIA_AUD_DEV_CAP_PLC is set in the flags.
395 */
396 pj_bool_t plc_enabled;
397
398 /**
399 * Enable/disable CNG. This setting is optional, and will only be used
400 * if PJMEDIA_AUD_DEV_CAP_CNG is set in the flags.
401 */
402 pj_bool_t cng_enabled;
403
Benny Prijono10454dc2009-02-21 14:21:59 +0000404} pjmedia_aud_param;
Benny Prijono2cd64f82009-02-17 19:57:48 +0000405
406
407/** Forward declaration for pjmedia_aud_stream */
408typedef struct pjmedia_aud_stream pjmedia_aud_stream;
409
410/** Forward declaration for audio device factory */
411typedef struct pjmedia_aud_dev_factory pjmedia_aud_dev_factory;
412
413
414/**
415 * Initialize the audio subsystem. This will register all supported audio
416 * device factories to the audio subsystem. This function may be called
417 * more than once, but each call to this function must have the
418 * corresponding #pjmedia_aud_subsys_shutdown() call.
419 *
420 * @param pf The pool factory.
421 *
422 * @return PJ_SUCCESS on successful operation or the appropriate
423 * error code.
424 */
425PJ_DECL(pj_status_t) pjmedia_aud_subsys_init(pj_pool_factory *pf);
426
427
428/**
Benny Prijonoe3ebd552009-02-18 20:14:15 +0000429 * Get the pool factory registered to the audio subsystem.
430 *
431 * @return The pool factory.
432 */
433PJ_DECL(pj_pool_factory*) pjmedia_aud_subsys_get_pool_factory(void);
434
435
436/**
Benny Prijono2cd64f82009-02-17 19:57:48 +0000437 * Shutdown the audio subsystem. This will destroy all audio device factories
438 * registered in the audio subsystem. Note that currently opened audio streams
439 * may or may not be closed, depending on the implementation of the audio
440 * device factories.
441 *
442 * @return PJ_SUCCESS on successful operation or the appropriate
443 * error code.
444 */
445PJ_DECL(pj_status_t) pjmedia_aud_subsys_shutdown(void);
446
447
448/**
Benny Prijono10454dc2009-02-21 14:21:59 +0000449 * Get string info for the specified capability.
450 *
451 * @param cap The capability ID.
452 * @param p_desc Optional pointer which will be filled with longer
453 * description about the capability.
454 *
455 * @return Capability name.
456 */
457PJ_DECL(const char*) pjmedia_aud_dev_cap_name(pjmedia_aud_dev_cap cap,
458 const char **p_desc);
459
460
461/**
Benny Prijono2cd64f82009-02-17 19:57:48 +0000462 * Get the number of sound devices installed in the system.
463 *
464 * @return The number of sound devices installed in the system.
465 */
466PJ_DECL(unsigned) pjmedia_aud_dev_count(void);
467
468
469/**
Benny Prijono2cd64f82009-02-17 19:57:48 +0000470 * Get device information.
471 *
472 * @param id The audio device ID.
473 * @param info The device information which will be filled in by this
474 * function once it returns successfully.
475 *
476 * @return PJ_SUCCESS on successful operation or the appropriate
477 * error code.
478 */
Benny Prijono10454dc2009-02-21 14:21:59 +0000479PJ_DECL(pj_status_t) pjmedia_aud_dev_get_info(pjmedia_aud_dev_index id,
Benny Prijono2cd64f82009-02-17 19:57:48 +0000480 pjmedia_aud_dev_info *info);
481
482
483/**
Benny Prijono10454dc2009-02-21 14:21:59 +0000484 * Lookup device index based on the driver and device name.
485 *
486 * @param drv_name The driver name.
487 * @param dev_name The device name.
Benny Prijono2058f472009-02-22 17:15:34 +0000488 * @param id Pointer to store the returned device ID.
Benny Prijono10454dc2009-02-21 14:21:59 +0000489 *
490 * @return PJ_SUCCESS if the device can be found.
491 */
492PJ_DECL(pj_status_t) pjmedia_aud_dev_lookup(const char *drv_name,
493 const char *dev_name,
494 pjmedia_aud_dev_index *id);
495
496
497/**
Benny Prijono2cd64f82009-02-17 19:57:48 +0000498 * Initialize the audio device parameters with default values for the
499 * specified device.
500 *
501 * @param id The audio device ID.
502 * @param param The audio device parameters which will be initialized
503 * by this function once it returns successfully.
504 *
505 * @return PJ_SUCCESS on successful operation or the appropriate
506 * error code.
507 */
Benny Prijono10454dc2009-02-21 14:21:59 +0000508PJ_DECL(pj_status_t) pjmedia_aud_dev_default_param(pjmedia_aud_dev_index id,
509 pjmedia_aud_param *param);
Benny Prijono2cd64f82009-02-17 19:57:48 +0000510
511
512/**
513 * Open audio stream object using the specified parameters.
514 *
515 * @param param Sound device parameters to be used for the stream.
516 * @param rec_cb Callback to be called on every input frame captured.
517 * @param play_cb Callback to be called everytime the sound device needs
518 * audio frames to be played back.
519 * @param user_data Arbitrary user data, which will be given back in the
520 * callbacks.
Benny Prijono2058f472009-02-22 17:15:34 +0000521 * @param p_strm Pointer to receive the audio stream.
Benny Prijono2cd64f82009-02-17 19:57:48 +0000522 *
523 * @return PJ_SUCCESS on successful operation or the appropriate
524 * error code.
525 */
Benny Prijono10454dc2009-02-21 14:21:59 +0000526PJ_DECL(pj_status_t) pjmedia_aud_stream_create(const pjmedia_aud_param *param,
Benny Prijono2cd64f82009-02-17 19:57:48 +0000527 pjmedia_aud_rec_cb rec_cb,
528 pjmedia_aud_play_cb play_cb,
529 void *user_data,
Benny Prijono10454dc2009-02-21 14:21:59 +0000530 pjmedia_aud_stream **p_strm);
Benny Prijono2cd64f82009-02-17 19:57:48 +0000531
532/**
533 * Get the running parameters for the specified audio stream.
534 *
535 * @param strm The audio stream.
536 * @param param Audio stream parameters to be filled in by this
537 * function once it returns successfully.
538 *
539 * @return PJ_SUCCESS on successful operation or the appropriate
540 * error code.
541 */
542PJ_DECL(pj_status_t) pjmedia_aud_stream_get_param(pjmedia_aud_stream *strm,
Benny Prijono10454dc2009-02-21 14:21:59 +0000543 pjmedia_aud_param *param);
Benny Prijono2cd64f82009-02-17 19:57:48 +0000544
545/**
546 * Get the value of a specific capability of the audio stream.
547 *
548 * @param strm The audio stream.
549 * @param cap The audio capability which value is to be retrieved.
550 * @param value Pointer to value to be filled in by this function
551 * once it returns successfully.
552 *
553 * @return PJ_SUCCESS on successful operation or the appropriate
554 * error code.
555 */
556PJ_DECL(pj_status_t) pjmedia_aud_stream_get_cap(pjmedia_aud_stream *strm,
557 pjmedia_aud_dev_cap cap,
558 void *value);
559
560/**
561 * Set the value of a specific capability of the audio stream.
562 *
563 * @param strm The audio stream.
564 * @param cap The audio capability which value is to be set.
565 * @param value Pointer to value.
566 *
567 * @return PJ_SUCCESS on successful operation or the appropriate
568 * error code.
569 */
570PJ_DECL(pj_status_t) pjmedia_aud_stream_set_cap(pjmedia_aud_stream *strm,
571 pjmedia_aud_dev_cap cap,
572 const void *value);
573
574/**
575 * Start the stream.
576 *
577 * @param strm The audio stream.
578 *
579 * @return PJ_SUCCESS on successful operation or the appropriate
580 * error code.
581 */
582PJ_DECL(pj_status_t) pjmedia_aud_stream_start(pjmedia_aud_stream *strm);
583
584/**
585 * Stop the stream.
586 *
587 * @param strm The audio stream.
588 *
589 * @return PJ_SUCCESS on successful operation or the appropriate
590 * error code.
591 */
592PJ_DECL(pj_status_t) pjmedia_aud_stream_stop(pjmedia_aud_stream *strm);
593
594/**
595 * Destroy the stream.
596 *
597 * @param strm The audio stream.
598 *
599 * @return PJ_SUCCESS on successful operation or the appropriate
600 * error code.
601 */
602PJ_DECL(pj_status_t) pjmedia_aud_stream_destroy(pjmedia_aud_stream *strm);
603
604
Benny Prijono2cd64f82009-02-17 19:57:48 +0000605/**
Benny Prijono2058f472009-02-22 17:15:34 +0000606 * @}
Benny Prijono2cd64f82009-02-17 19:57:48 +0000607 */
608
609PJ_END_DECL
610
611
Benny Prijono10454dc2009-02-21 14:21:59 +0000612#endif /* __PJMEDIA_AUDIODEV_AUDIODEV_H__ */
Benny Prijono2cd64f82009-02-17 19:57:48 +0000613