1 /* $Id$ */
2 /*
3  * Copyright (C) 2008-2011 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  */
20 #ifndef __PJMEDIA_AUDIO_DEV_H__
21 #define __PJMEDIA_AUDIO_DEV_H__
22 
23 /**
24  * @file audiodev.h
25  * @brief Audio device API.
26  */
27 #include <pjmedia-audiodev/config.h>
28 #include <pjmedia-audiodev/errno.h>
29 #include <pjmedia/format.h>
30 #include <pjmedia/frame.h>
31 #include <pjmedia/types.h>
32 #include <pj/pool.h>
33 
34 
35 PJ_BEGIN_DECL
36 
37 /**
38  * @defgroup s2_audio_device_reference Audio Device API Reference
39  * @ingroup audio_device_api
40  * @brief Documentation and API Reference
41  * @{
42  *
43  * @section ec_sec Hardware/Built-in Echo Cancellation
44  *
45  * On some platforms, audio device comes with built-in echo cancellation
46  * feature. This is usually done based on specific hardware configuration,
47  * such as the use of multiple microphones and/or a known fixed distance
48  * between the capture and playback device, in order to precalculate the
49  * echo time distance. Because of this, when using the hardware EC,
50  * users may not get the freedom to select their own audio devices.
51  * This is applicable for Mac (users must use default audio devices) and
52  * iOS (users must use the same built-in audio device).
53  *
54  * In PJMEDIA, applications wishing to use sofware echo instead can pass
55  * PJMEDIA_ECHO_USE_SW_ECHO when calling pjmedia_snd_port_create2().
56  */
57 
58 /**
59  * Type for device index.
60  */
61 typedef pj_int32_t pjmedia_aud_dev_index;
62 
63 /**
64  * Device index constants.
65  */
66 
67 /**
68  * Constant to denote default capture device
69  */
70 #define PJMEDIA_AUD_DEFAULT_CAPTURE_DEV  -1
71 
72 /**
73  * Constant to denote default playback device
74  */
75 #define PJMEDIA_AUD_DEFAULT_PLAYBACK_DEV -2
76 
77 /**
78  * Constant to denote invalid device index.
79  */
80 #define PJMEDIA_AUD_INVALID_DEV	    -3
81 
82 #define PJMEDIA_AUD_MAX_DRIVERS	16
83 #define PJMEDIA_AUD_MAX_DEVS	64
84 
85 
86 /** Forward declaration for pjmedia_aud_stream */
87 typedef struct pjmedia_aud_stream pjmedia_aud_stream;
88 
89 /** Forward declaration for audio device factory */
90 typedef struct pjmedia_aud_dev_factory pjmedia_aud_dev_factory;
91 
92 /* typedef for factory creation function */
93 typedef pjmedia_aud_dev_factory*
94 (*pjmedia_aud_dev_factory_create_func_ptr)(pj_pool_factory*);
95 
96 
97 /* Audio driver structure */
98 typedef struct pjmedia_aud_driver
99 {
100     pjmedia_aud_dev_factory_create_func_ptr create; /* Creation function    */
101     pjmedia_aud_dev_factory *f;		  /* Factory instance		    */
102     char		     name[32];	  /* Driver name		    */
103     unsigned		     dev_cnt;	  /* Number of devices		    */
104     unsigned		     start_idx;	  /* Start index in global list	    */
105     int			     rec_dev_idx; /* Default capture device.	    */
106     int			     play_dev_idx;/* Default playback device	    */
107     int			     dev_idx;	  /* Default device.		    */
108 } pjmedia_aud_driver;
109 
110 
111 /* Audio subsystem structure */
112 typedef struct pjmedia_aud_subsys
113 {
114     unsigned	     	init_count;	/* How many times init() is called  */
115     pj_pool_factory    *pf;		/* The pool factory.		    */
116 
117     unsigned	     	drv_cnt;	/* Number of drivers.		    */
118     pjmedia_aud_driver  drv[PJMEDIA_AUD_MAX_DRIVERS];/* Array of drivers.   */
119 
120     unsigned	     	dev_cnt;	/* Total number of devices.	    */
121     pj_uint32_t	     	dev_list[PJMEDIA_AUD_MAX_DEVS];/* Array of dev IDs. */
122 
123 } pjmedia_aud_subsys;
124 
125 
126 /**
127  * This enumeration identifies various audio device capabilities. These audio
128  * capabilities indicates what features are supported by the underlying
129  * audio device implementation.
130  *
131  * Applications get these capabilities in the #pjmedia_aud_dev_info structure.
132  *
133  * Application can also set the specific features/capabilities when opening
134  * the audio stream by setting the \a flags member of #pjmedia_aud_param
135  * structure.
136  *
137  * Once audio stream is running, application can also retrieve or set some
138  * specific audio capability, by using #pjmedia_aud_stream_get_cap() and
139  * #pjmedia_aud_stream_set_cap() and specifying the desired capability. The
140  * value of the capability is specified as pointer, and application needs to
141  * supply the pointer with the correct value, according to the documentation
142  * of each of the capability.
143  */
144 typedef enum pjmedia_aud_dev_cap
145 {
146     /**
147      * Support for audio formats other than PCM. The value of this capability
148      * is represented by #pjmedia_format structure.
149      */
150     PJMEDIA_AUD_DEV_CAP_EXT_FORMAT = 1,
151 
152     /**
153      * Support for audio input latency control or query. The value of this
154      * capability is an unsigned integer containing milliseconds value of
155      * the latency.
156      */
157     PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY = 2,
158 
159     /**
160      * Support for audio output latency control or query. The value of this
161      * capability is an unsigned integer containing milliseconds value of
162      * the latency.
163      */
164     PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY = 4,
165 
166     /**
167      * Support for setting/retrieving the audio input device volume level.
168      * The value of this capability is an unsigned integer representing
169      * the input audio volume setting in percent.
170      */
171     PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING = 8,
172 
173     /**
174      * Support for setting/retrieving the audio output device volume level.
175      * The value of this capability is an unsigned integer representing
176      * the output audio volume setting in percent.
177      */
178     PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING = 16,
179 
180     /**
181      * Support for monitoring the current audio input signal volume.
182      * The value of this capability is an unsigned integer representing
183      * the audio volume in percent.
184      */
185     PJMEDIA_AUD_DEV_CAP_INPUT_SIGNAL_METER = 32,
186 
187     /**
188      * Support for monitoring the current audio output signal volume.
189      * The value of this capability is an unsigned integer representing
190      * the audio volume in percent.
191      */
192     PJMEDIA_AUD_DEV_CAP_OUTPUT_SIGNAL_METER = 64,
193 
194     /**
195      * Support for audio input routing/source. The value of this capability
196      * is an integer containing #pjmedia_aud_dev_route enumeration.
197      */
198     PJMEDIA_AUD_DEV_CAP_INPUT_ROUTE = 128,
199     PJMEDIA_AUD_DEV_CAP_INPUT_SOURCE = 128,
200 
201     /**
202      * Support for audio output routing (e.g. loudspeaker vs earpiece). The
203      * value of this capability is an integer containing #pjmedia_aud_dev_route
204      * enumeration.
205      */
206     PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE = 256,
207 
208     /**
209      * The audio device has echo cancellation feature. The value of this
210      * capability is a pj_bool_t containing boolean PJ_TRUE or PJ_FALSE.
211      */
212     PJMEDIA_AUD_DEV_CAP_EC = 512,
213 
214     /**
215      * The audio device supports setting echo cancellation fail length. The
216      * value of this capability is an unsigned integer representing the
217      * echo tail in milliseconds.
218      */
219     PJMEDIA_AUD_DEV_CAP_EC_TAIL = 1024,
220 
221     /**
222      * The audio device has voice activity detection feature. The value
223      * of this capability is a pj_bool_t containing boolean PJ_TRUE or
224      * PJ_FALSE.
225      */
226     PJMEDIA_AUD_DEV_CAP_VAD = 2048,
227 
228     /**
229      * The audio device has comfort noise generation feature. The value
230      * of this capability is a pj_bool_t containing boolean PJ_TRUE or
231      * PJ_FALSE.
232      */
233     PJMEDIA_AUD_DEV_CAP_CNG = 4096,
234 
235     /**
236      * The audio device has packet loss concealment feature. The value
237      * of this capability is a pj_bool_t containing boolean PJ_TRUE or
238      * PJ_FALSE.
239      */
240     PJMEDIA_AUD_DEV_CAP_PLC = 8192,
241 
242     /**
243      * End of capability
244      */
245     PJMEDIA_AUD_DEV_CAP_MAX = 16384
246 
247 } pjmedia_aud_dev_cap;
248 
249 
250 /**
251  * This enumeration describes audio routing/source setting.
252  */
253 typedef enum pjmedia_aud_dev_route
254 {
255     /**
256      * Default route/source, it is the default audio route/source of
257      * the audio framework backend, as in opening audio device without
258      * specifying any route/source setting or with specifying neutral
259      * route/source setting.
260      */
261     PJMEDIA_AUD_DEV_ROUTE_DEFAULT = 0,
262 
263     /** Route to loudspeaker */
264     PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER = 1,
265 
266     /** Route to earpiece */
267     PJMEDIA_AUD_DEV_ROUTE_EARPIECE = 2,
268 
269     /** Route to paired Bluetooth device */
270     PJMEDIA_AUD_DEV_ROUTE_BLUETOOTH = 4,
271 
272     /**
273      * Custom audio route/source, specific to each audio device
274      * backend.
275      *
276      * For Android JNI audio device, the default is
277      * VOICE_COMMUNICATION (7). To change it to another value, set
278      * the input source capability of pjmedia_aud_param accordingly.
279      * For example:
280      *   // 6 is VOICE_RECOGNITION
281      *   unsigned aud_source = PJMEDIA_AUD_DEV_ROUTE_CUSTOM | 6;
282      *   pjmedia_aud_param_set_cap(&param, PJMEDIA_AUD_DEV_CAP_INPUT_SOURCE,
283      *				   &aud_source);
284      */
285     PJMEDIA_AUD_DEV_ROUTE_CUSTOM = 128
286 
287 } pjmedia_aud_dev_route;
288 
289 
290 /**
291  * Device information structure returned by #pjmedia_aud_dev_get_info().
292  */
293 typedef struct pjmedia_aud_dev_info
294 {
295     /**
296      * The device name
297      */
298     char name[PJMEDIA_AUD_DEV_INFO_NAME_LEN];
299 
300     /**
301      * Maximum number of input channels supported by this device. If the
302      * value is zero, the device does not support input operation (i.e.
303      * it is a playback only device).
304      */
305     unsigned input_count;
306 
307     /**
308      * Maximum number of output channels supported by this device. If the
309      * value is zero, the device does not support output operation (i.e.
310      * it is an input only device).
311      */
312     unsigned output_count;
313 
314     /**
315      * Default sampling rate.
316      */
317     unsigned default_samples_per_sec;
318 
319     /**
320      * The underlying driver name
321      */
322     char driver[32];
323 
324     /**
325      * Device capabilities, as bitmask combination of #pjmedia_aud_dev_cap.
326      */
327     unsigned caps;
328 
329     /**
330      * Supported audio device routes/sources, as bitmask combination of
331      * #pjmedia_aud_dev_route. The value may be zero if the device
332      * does not support changing audio routes/sources.
333      */
334     unsigned routes;
335 
336     /**
337      * Number of audio formats supported by this device. The value may be
338      * zero if the device does not support non-PCM format.
339      */
340     unsigned ext_fmt_cnt;
341 
342     /**
343      * Array of supported extended audio formats
344      */
345     pjmedia_format ext_fmt[8];
346 
347 
348 } pjmedia_aud_dev_info;
349 
350 
351 /**
352  * This callback is called by player stream when it needs additional data
353  * to be played by the device. Application must fill in the whole of output
354  * buffer with audio samples.
355  *
356  * The frame argument contains the following values:
357  *  - timestamp	    Playback timestamp, in samples.
358  *  - buf	    Buffer to be filled out by application.
359  *  - size	    The size requested in bytes, which will be equal to
360  *		    the size of one whole packet.
361  *
362  * @param user_data User data associated with the stream.
363  * @param frame	    Audio frame, which buffer is to be filled in by
364  *		    the application.
365  *
366  * @return	    Returning non-PJ_SUCCESS will cause the audio stream
367  *		    to stop
368  */
369 typedef pj_status_t (*pjmedia_aud_play_cb)(void *user_data,
370 					   pjmedia_frame *frame);
371 
372 /**
373  * This callback is called by recorder stream when it has captured the whole
374  * packet worth of audio samples.
375  *
376  * @param user_data User data associated with the stream.
377  * @param frame	    Captured frame.
378  *
379  * @return	    Returning non-PJ_SUCCESS will cause the audio stream
380  *		    to stop
381  */
382 typedef pj_status_t (*pjmedia_aud_rec_cb)(void *user_data,
383 					  pjmedia_frame *frame);
384 
385 /**
386  * This structure specifies the parameters to open the audio stream.
387  */
388 typedef struct pjmedia_aud_param
389 {
390     /**
391      * The audio direction. This setting is mandatory.
392      */
393     pjmedia_dir dir;
394 
395     /**
396      * The audio recorder device ID. This setting is mandatory if the audio
397      * direction includes input/capture direction.
398      */
399     pjmedia_aud_dev_index rec_id;
400 
401     /**
402      * The audio playback device ID. This setting is mandatory if the audio
403      * direction includes output/playback direction.
404      */
405     pjmedia_aud_dev_index play_id;
406 
407     /**
408      * Clock rate/sampling rate. This setting is mandatory.
409      */
410     unsigned clock_rate;
411 
412     /**
413      * Number of channels. This setting is mandatory.
414      */
415     unsigned channel_count;
416 
417     /**
418      * Number of samples per frame. This setting is mandatory.
419      */
420     unsigned samples_per_frame;
421 
422     /**
423      * Number of bits per sample. This setting is mandatory.
424      */
425     unsigned bits_per_sample;
426 
427     /**
428      * This flags specifies which of the optional settings are valid in this
429      * structure. The flags is bitmask combination of pjmedia_aud_dev_cap.
430      */
431     unsigned flags;
432 
433     /**
434      * Set the audio format. This setting is optional, and will only be used
435      * if PJMEDIA_AUD_DEV_CAP_EXT_FORMAT is set in the flags.
436      */
437     pjmedia_format ext_fmt;
438 
439     /**
440      * Input latency, in milliseconds. This setting is optional, and will
441      * only be used if PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY is set in the flags.
442      */
443     unsigned input_latency_ms;
444 
445     /**
446      * Input latency, in milliseconds. This setting is optional, and will
447      * only be used if PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY is set in the flags.
448      */
449     unsigned output_latency_ms;
450 
451     /**
452      * Input volume setting, in percent. This setting is optional, and will
453      * only be used if PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING is set in
454      * the flags.
455      */
456     unsigned input_vol;
457 
458     /**
459      * Output volume setting, in percent. This setting is optional, and will
460      * only be used if PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING is set in
461      * the flags.
462      */
463     unsigned output_vol;
464 
465     /**
466      * Set the audio input route/source. This setting is optional, and
467      * will only be used if PJMEDIA_AUD_DEV_CAP_INPUT_ROUTE/
468      * PJMEDIA_AUD_DEV_CAP_INPUT_SOURCE is set in the flags.
469      */
470     pjmedia_aud_dev_route input_route;
471 
472     /**
473      * Set the audio output route. This setting is optional, and will only be
474      * used if PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE is set in the flags.
475      */
476     pjmedia_aud_dev_route output_route;
477 
478     /**
479      * Enable/disable echo canceller, if the device supports it. This setting
480      * is optional, and will only be used if PJMEDIA_AUD_DEV_CAP_EC is set in
481      * the flags.
482      */
483     pj_bool_t ec_enabled;
484 
485     /**
486      * Set echo canceller tail length in milliseconds, if the device supports
487      * it. This setting is optional, and will only be used if
488      * PJMEDIA_AUD_DEV_CAP_EC_TAIL is set in the flags.
489      */
490     unsigned ec_tail_ms;
491 
492     /**
493      * Enable/disable PLC. This setting is optional, and will only be used
494      * if PJMEDIA_AUD_DEV_CAP_PLC is set in the flags.
495      */
496     pj_bool_t plc_enabled;
497 
498     /**
499      * Enable/disable CNG. This setting is optional, and will only be used
500      * if PJMEDIA_AUD_DEV_CAP_CNG is set in the flags.
501      */
502     pj_bool_t cng_enabled;
503 
504     /**
505      * Enable/disable VAD. This setting is optional, and will only be used
506      * if PJMEDIA_AUD_DEV_CAP_VAD is set in the flags.
507      */
508     pj_bool_t vad_enabled;
509 
510 } pjmedia_aud_param;
511 
512 
513 /**
514  * Get the audio subsystem.
515  *
516  * @return		The audio subsystem.
517  */
518 PJ_DECL(pjmedia_aud_subsys*) pjmedia_get_aud_subsys(void);
519 
520 /**
521  * Initialize the audio driver.
522  *
523  * @param drv_idx	The index of the audio driver.
524  * @param refresh	Specify non-zero to refresh the audio driver.
525  *
526  * @return		PJ_SUCCESS on successful operation or the appropriate
527  *			error code.
528  */
529 PJ_DECL(pj_status_t) pjmedia_aud_driver_init(unsigned drv_idx,
530 					     pj_bool_t refresh);
531 
532 /**
533  * Deinitialize the audio driver.
534  *
535  * @param drv_idx	The index of the audio driver.
536  */
537 PJ_DECL(void) pjmedia_aud_driver_deinit(unsigned drv_idx);
538 
539 
540 /**
541  * Get string info for the specified capability.
542  *
543  * @param cap		The capability ID.
544  * @param p_desc	Optional pointer which will be filled with longer
545  *			description about the capability.
546  *
547  * @return		Capability name.
548  */
549 PJ_DECL(const char*) pjmedia_aud_dev_cap_name(pjmedia_aud_dev_cap cap,
550 					      const char **p_desc);
551 
552 
553 /**
554  * Set a capability field value in #pjmedia_aud_param structure. This will
555  * also set the flags field for the specified capability in the structure.
556  *
557  * @param param		The structure.
558  * @param cap		The audio capability which value is to be set.
559  * @param pval		Pointer to value. Please see the type of value to
560  *			be supplied in the pjmedia_aud_dev_cap documentation.
561  *
562  * @return		PJ_SUCCESS on successful operation or the appropriate
563  *			error code.
564  */
565 PJ_DECL(pj_status_t) pjmedia_aud_param_set_cap(pjmedia_aud_param *param,
566 					       pjmedia_aud_dev_cap cap,
567 					       const void *pval);
568 
569 
570 /**
571  * Get a capability field value from #pjmedia_aud_param structure. This
572  * function will return PJMEDIA_EAUD_INVCAP error if the flag for that
573  * capability is not set in the flags field in the structure.
574  *
575  * @param param		The structure.
576  * @param cap		The audio capability which value is to be retrieved.
577  * @param pval		Pointer to value. Please see the type of value to
578  *			be supplied in the pjmedia_aud_dev_cap documentation.
579  *
580  * @return		PJ_SUCCESS on successful operation or the appropriate
581  *			error code.
582  */
583 PJ_DECL(pj_status_t) pjmedia_aud_param_get_cap(const pjmedia_aud_param *param,
584 					       pjmedia_aud_dev_cap cap,
585 					       void *pval);
586 
587 
588 /**
589  * Refresh the list of sound devices installed in the system. This function
590  * will only refresh the list of audio device so all active audio streams will
591  * be unaffected. After refreshing the device list, application MUST make sure
592  * to update all index references to audio devices (i.e. all variables of type
593  * pjmedia_aud_dev_index) before calling any function that accepts audio device
594  * index as its parameter.
595  *
596  * @return		PJ_SUCCESS on successful operation or the appropriate
597  *			error code.
598  */
599 PJ_DECL(pj_status_t) pjmedia_aud_dev_refresh(void);
600 
601 
602 /**
603  * Get the number of sound devices installed in the system.
604  *
605  * @return		The number of sound devices installed in the system.
606  */
607 PJ_DECL(unsigned) pjmedia_aud_dev_count(void);
608 
609 
610 /**
611  * Get device information.
612  *
613  * @param id		The audio device ID.
614  * @param info		The device information which will be filled in by this
615  *			function once it returns successfully.
616  *
617  * @return		PJ_SUCCESS on successful operation or the appropriate
618  *			error code.
619  */
620 PJ_DECL(pj_status_t) pjmedia_aud_dev_get_info(pjmedia_aud_dev_index id,
621 					      pjmedia_aud_dev_info *info);
622 
623 
624 /**
625  * Lookup device index based on the driver and device name.
626  *
627  * @param drv_name	The driver name.
628  * @param dev_name	The device name.
629  * @param id		Pointer to store the returned device ID.
630  *
631  * @return		PJ_SUCCESS if the device can be found.
632  */
633 PJ_DECL(pj_status_t) pjmedia_aud_dev_lookup(const char *drv_name,
634 					    const char *dev_name,
635 					    pjmedia_aud_dev_index *id);
636 
637 
638 /**
639  * Initialize the audio device parameters with default values for the
640  * specified device.
641  *
642  * @param id		The audio device ID.
643  * @param param		The audio device parameters which will be initialized
644  *			by this function once it returns successfully.
645  *
646  * @return		PJ_SUCCESS on successful operation or the appropriate
647  *			error code.
648  */
649 PJ_DECL(pj_status_t) pjmedia_aud_dev_default_param(pjmedia_aud_dev_index id,
650 						   pjmedia_aud_param *param);
651 
652 
653 /**
654  * Open audio stream object using the specified parameters.
655  *
656  * @param param		Sound device parameters to be used for the stream.
657  * @param rec_cb	Callback to be called on every input frame captured.
658  * @param play_cb	Callback to be called everytime the sound device needs
659  *			audio frames to be played back.
660  * @param user_data	Arbitrary user data, which will be given back in the
661  *			callbacks.
662  * @param p_strm	Pointer to receive the audio stream.
663  *
664  * @return		PJ_SUCCESS on successful operation or the appropriate
665  *			error code.
666  */
667 PJ_DECL(pj_status_t) pjmedia_aud_stream_create(const pjmedia_aud_param *param,
668 					       pjmedia_aud_rec_cb rec_cb,
669 					       pjmedia_aud_play_cb play_cb,
670 					       void *user_data,
671 					       pjmedia_aud_stream **p_strm);
672 
673 /**
674  * Get the running parameters for the specified audio stream.
675  *
676  * @param strm		The audio stream.
677  * @param param		Audio stream parameters to be filled in by this
678  *			function once it returns successfully.
679  *
680  * @return		PJ_SUCCESS on successful operation or the appropriate
681  *			error code.
682  */
683 PJ_DECL(pj_status_t) pjmedia_aud_stream_get_param(pjmedia_aud_stream *strm,
684 						  pjmedia_aud_param *param);
685 
686 /**
687  * Get the value of a specific capability of the audio stream.
688  *
689  * @param strm		The audio stream.
690  * @param cap		The audio capability which value is to be retrieved.
691  * @param value		Pointer to value to be filled in by this function
692  *			once it returns successfully.  Please see the type
693  *			of value to be supplied in the pjmedia_aud_dev_cap
694  *			documentation.
695  *
696  * @return		PJ_SUCCESS on successful operation or the appropriate
697  *			error code.
698  */
699 PJ_DECL(pj_status_t) pjmedia_aud_stream_get_cap(pjmedia_aud_stream *strm,
700 						pjmedia_aud_dev_cap cap,
701 						void *value);
702 
703 /**
704  * Set the value of a specific capability of the audio stream.
705  *
706  * @param strm		The audio stream.
707  * @param cap		The audio capability which value is to be set.
708  * @param value		Pointer to value. Please see the type of value to
709  *			be supplied in the pjmedia_aud_dev_cap documentation.
710  *
711  * @return		PJ_SUCCESS on successful operation or the appropriate
712  *			error code.
713  */
714 PJ_DECL(pj_status_t) pjmedia_aud_stream_set_cap(pjmedia_aud_stream *strm,
715 						pjmedia_aud_dev_cap cap,
716 						const void *value);
717 
718 /**
719  * Start the stream.
720  *
721  * @param strm		The audio stream.
722  *
723  * @return		PJ_SUCCESS on successful operation or the appropriate
724  *			error code.
725  */
726 PJ_DECL(pj_status_t) pjmedia_aud_stream_start(pjmedia_aud_stream *strm);
727 
728 /**
729  * Stop the stream.
730  *
731  * @param strm		The audio stream.
732  *
733  * @return		PJ_SUCCESS on successful operation or the appropriate
734  *			error code.
735  */
736 PJ_DECL(pj_status_t) pjmedia_aud_stream_stop(pjmedia_aud_stream *strm);
737 
738 /**
739  * Destroy the stream.
740  *
741  * @param strm		The audio stream.
742  *
743  * @return		PJ_SUCCESS on successful operation or the appropriate
744  *			error code.
745  */
746 PJ_DECL(pj_status_t) pjmedia_aud_stream_destroy(pjmedia_aud_stream *strm);
747 
748 
749 /**
750  * @}
751  */
752 
753 PJ_END_DECL
754 
755 
756 #endif	/* __PJMEDIA_AUDIO_DEV_H__ */
757 
758