~ubuntu-branches/ubuntu/raring/sflphone/raring

« back to all changes in this revision

Viewing changes to sflphone-common/libs/pjproject/pjmedia/include/pjmedia-audiodev/audiodev.h

  • Committer: Package Import Robot
  • Author(s): Francois Marier
  • Date: 2011-11-25 13:24:12 UTC
  • mfrom: (4.1.10 sid)
  • Revision ID: package-import@ubuntu.com-20111125132412-dc4qvhyosk74cd42
Tags: 1.0.1-4
Don't assume that arch:all packages will get built (closes: #649726)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: audiodev.h 2506 2009-03-12 18:11:37Z bennylp $ */
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
 
 *
20
 
 *  Additional permission under GNU GPL version 3 section 7:
21
 
 *
22
 
 *  If you modify this program, or any covered work, by linking or
23
 
 *  combining it with the OpenSSL project's OpenSSL library (or a
24
 
 *  modified version of that library), containing parts covered by the
25
 
 *  terms of the OpenSSL or SSLeay licenses, Teluu Inc. (http://www.teluu.com)
26
 
 *  grants you additional permission to convey the resulting work.
27
 
 *  Corresponding Source for a non-source form of such a combination
28
 
 *  shall include the source code for the parts of OpenSSL used as well
29
 
 *  as that of the covered work.
30
 
 */
31
 
#ifndef __PJMEDIA_AUDIODEV_AUDIODEV_H__
32
 
#define __PJMEDIA_AUDIODEV_AUDIODEV_H__
33
 
 
34
 
/**
35
 
 * @file audiodev.h
36
 
 * @brief Audio device API.
37
 
 */
38
 
#include <pjmedia-audiodev/config.h>
39
 
#include <pjmedia-audiodev/errno.h>
40
 
#include <pjmedia/types.h>
41
 
#include <pj/pool.h>
42
 
 
43
 
 
44
 
PJ_BEGIN_DECL
45
 
 
46
 
/**
47
 
 * @defgroup s2_audio_device_reference Audio Device API Reference
48
 
 * @ingroup audio_device_api
49
 
 * @brief API Reference
50
 
 * @{
51
 
 */
52
 
 
53
 
/** 
54
 
 * Type for device index.
55
 
 */
56
 
typedef pj_int32_t pjmedia_aud_dev_index;
57
 
 
58
 
/**
59
 
 * Device index constants.
60
 
 */
61
 
enum
62
 
{
63
 
    /** 
64
 
     * Constant to denote default capture device 
65
 
     */
66
 
    PJMEDIA_AUD_DEFAULT_CAPTURE_DEV = -1,
67
 
 
68
 
    /** 
69
 
     * Constant to denote default playback device 
70
 
     */
71
 
    PJMEDIA_AUD_DEFAULT_PLAYBACK_DEV = -2,
72
 
 
73
 
    /**
74
 
     * Constant to denote invalid device index.
75
 
     */
76
 
    PJMEDIA_AUD_INVALID_DEV = -3
77
 
};
78
 
 
79
 
 
80
 
/**
81
 
 * This enumeration identifies various audio device capabilities. These audio
82
 
 * capabilities indicates what features are supported by the underlying
83
 
 * audio device implementation.
84
 
 *
85
 
 * Applications get these capabilities in the #pjmedia_aud_dev_info structure.
86
 
 *
87
 
 * Application can also set the specific features/capabilities when opening
88
 
 * the audio stream by setting the \a flags member of #pjmedia_aud_param
89
 
 * structure.
90
 
 *
91
 
 * Once audio stream is running, application can also retrieve or set some
92
 
 * specific audio capability, by using #pjmedia_aud_stream_get_cap() and
93
 
 * #pjmedia_aud_stream_set_cap() and specifying the desired capability. The
94
 
 * value of the capability is specified as pointer, and application needs to
95
 
 * supply the pointer with the correct value, according to the documentation
96
 
 * of each of the capability.
97
 
 */
98
 
typedef enum pjmedia_aud_dev_cap
99
 
{
100
 
    /** 
101
 
     * Support for audio formats other than PCM. The value of this capability
102
 
     * is represented by #pjmedia_format structure.
103
 
     */
104
 
    PJMEDIA_AUD_DEV_CAP_EXT_FORMAT = 1,
105
 
 
106
 
    /** 
107
 
     * Support for audio input latency control or query. The value of this 
108
 
     * capability is an unsigned integer containing milliseconds value of
109
 
     * the latency.
110
 
     */
111
 
    PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY = 2,
112
 
 
113
 
    /** 
114
 
     * Support for audio output latency control or query. The value of this 
115
 
     * capability is an unsigned integer containing milliseconds value of
116
 
     * the latency.
117
 
     */
118
 
    PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY = 4,
119
 
 
120
 
    /** 
121
 
     * Support for setting/retrieving the audio input device volume level.
122
 
     * The value of this capability is an unsigned integer representing 
123
 
     * the input audio volume setting in percent.
124
 
     */
125
 
    PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING = 8,
126
 
 
127
 
    /** 
128
 
     * Support for setting/retrieving the audio output device volume level.
129
 
     * The value of this capability is an unsigned integer representing 
130
 
     * the output audio volume setting in percent.
131
 
     */
132
 
    PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING = 16,
133
 
 
134
 
    /** 
135
 
     * Support for monitoring the current audio input signal volume. 
136
 
     * The value of this capability is an unsigned integer representing 
137
 
     * the audio volume in percent.
138
 
     */
139
 
    PJMEDIA_AUD_DEV_CAP_INPUT_SIGNAL_METER = 32,
140
 
 
141
 
    /** 
142
 
     * Support for monitoring the current audio output signal volume. 
143
 
     * The value of this capability is an unsigned integer representing 
144
 
     * the audio volume in percent.
145
 
     */
146
 
    PJMEDIA_AUD_DEV_CAP_OUTPUT_SIGNAL_METER = 64,
147
 
 
148
 
    /** 
149
 
     * Support for audio input routing. The value of this capability is an 
150
 
     * integer containing #pjmedia_aud_dev_route enumeration.
151
 
     */
152
 
    PJMEDIA_AUD_DEV_CAP_INPUT_ROUTE = 128,
153
 
 
154
 
    /** 
155
 
     * Support for audio output routing (e.g. loudspeaker vs earpiece). The
156
 
     * value of this capability is an integer containing #pjmedia_aud_dev_route
157
 
     * enumeration.
158
 
     */
159
 
    PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE = 256,
160
 
 
161
 
    /** 
162
 
     * The audio device has echo cancellation feature. The value of this
163
 
     * capability is a pj_bool_t containing boolean PJ_TRUE or PJ_FALSE.
164
 
     */
165
 
    PJMEDIA_AUD_DEV_CAP_EC = 512,
166
 
 
167
 
    /** 
168
 
     * The audio device supports setting echo cancellation fail length. The
169
 
     * value of this capability is an unsigned integer representing the
170
 
     * echo tail in milliseconds.
171
 
     */
172
 
    PJMEDIA_AUD_DEV_CAP_EC_TAIL = 1024,
173
 
 
174
 
    /** 
175
 
     * The audio device has voice activity detection feature. The value
176
 
     * of this capability is a pj_bool_t containing boolean PJ_TRUE or 
177
 
     * PJ_FALSE.
178
 
     */
179
 
    PJMEDIA_AUD_DEV_CAP_VAD = 2048,
180
 
 
181
 
    /** 
182
 
     * The audio device has comfort noise generation feature. The value
183
 
     * of this capability is a pj_bool_t containing boolean PJ_TRUE or 
184
 
     * PJ_FALSE.
185
 
     */
186
 
    PJMEDIA_AUD_DEV_CAP_CNG = 4096,
187
 
 
188
 
    /** 
189
 
     * The audio device has packet loss concealment feature. The value
190
 
     * of this capability is a pj_bool_t containing boolean PJ_TRUE or 
191
 
     * PJ_FALSE.
192
 
     */
193
 
    PJMEDIA_AUD_DEV_CAP_PLC = 8192,
194
 
    
195
 
    /**
196
 
     * End of capability
197
 
     */
198
 
    PJMEDIA_AUD_DEV_CAP_MAX = 16384
199
 
 
200
 
} pjmedia_aud_dev_cap;
201
 
 
202
 
 
203
 
/**
204
 
 * This enumeration describes audio routing setting.
205
 
 */
206
 
typedef enum pjmedia_aud_dev_route
207
 
{
208
 
    /** Default route. */
209
 
    PJMEDIA_AUD_DEV_ROUTE_DEFAULT = 0,
210
 
 
211
 
    /** Route to loudspeaker */
212
 
    PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER = 1,
213
 
 
214
 
    /** Route to earpiece */
215
 
    PJMEDIA_AUD_DEV_ROUTE_EARPIECE = 2
216
 
 
217
 
} pjmedia_aud_dev_route;
218
 
 
219
 
 
220
 
/**
221
 
 * Device information structure returned by #pjmedia_aud_dev_get_info().
222
 
 */
223
 
typedef struct pjmedia_aud_dev_info
224
 
{
225
 
    /** 
226
 
     * The device name 
227
 
     */
228
 
    char name[64];
229
 
 
230
 
    /** 
231
 
     * Maximum number of input channels supported by this device. If the
232
 
     * value is zero, the device does not support input operation (i.e.
233
 
     * it is a playback only device). 
234
 
     */
235
 
    unsigned input_count;
236
 
 
237
 
    /** 
238
 
     * Maximum number of output channels supported by this device. If the
239
 
     * value is zero, the device does not support output operation (i.e. 
240
 
     * it is an input only device).
241
 
     */
242
 
    unsigned output_count;
243
 
 
244
 
    /** 
245
 
     * Default sampling rate.
246
 
     */
247
 
    unsigned default_samples_per_sec;
248
 
 
249
 
    /** 
250
 
     * The underlying driver name 
251
 
     */
252
 
    char driver[32];
253
 
 
254
 
    /** 
255
 
     * Device capabilities, as bitmask combination of #pjmedia_aud_dev_cap.
256
 
     */
257
 
    unsigned caps;
258
 
 
259
 
    /** 
260
 
     * Supported audio device routes, as bitmask combination of 
261
 
     * #pjmedia_aud_dev_route. The value may be zero if the device
262
 
     * does not support audio routing.
263
 
     */
264
 
    unsigned routes;
265
 
 
266
 
    /** 
267
 
     * Number of audio formats supported by this device. The value may be
268
 
     * zero if the device does not support non-PCM format.
269
 
     */
270
 
    unsigned ext_fmt_cnt;
271
 
 
272
 
    /** 
273
 
     * Array of supported extended audio formats 
274
 
     */
275
 
    pjmedia_format ext_fmt[8];
276
 
 
277
 
 
278
 
} pjmedia_aud_dev_info;
279
 
 
280
 
 
281
 
/** 
282
 
 * This callback is called by player stream when it needs additional data
283
 
 * to be played by the device. Application must fill in the whole of output 
284
 
 * buffer with audio samples.
285
 
 *
286
 
 * The frame argument contains the following values:
287
 
 *  - timestamp     Playback timestamp, in samples.
288
 
 *  - buf           Buffer to be filled out by application.
289
 
 *  - size          The size requested in bytes, which will be equal to
290
 
 *                  the size of one whole packet.
291
 
 *
292
 
 * @param user_data User data associated with the stream.
293
 
 * @param frame     Audio frame, which buffer is to be filled in by
294
 
 *                  the application.
295
 
 *
296
 
 * @return          Returning non-PJ_SUCCESS will cause the audio stream
297
 
 *                  to stop
298
 
 */
299
 
typedef pj_status_t (*pjmedia_aud_play_cb)(void *user_data,
300
 
                                           pjmedia_frame *frame);
301
 
 
302
 
/**
303
 
 * This callback is called by recorder stream when it has captured the whole
304
 
 * packet worth of audio samples.
305
 
 *
306
 
 * @param user_data User data associated with the stream.
307
 
 * @param frame     Captured frame.
308
 
 *
309
 
 * @return          Returning non-PJ_SUCCESS will cause the audio stream
310
 
 *                  to stop
311
 
 */
312
 
typedef pj_status_t (*pjmedia_aud_rec_cb)(void *user_data,
313
 
                                          pjmedia_frame *frame);
314
 
 
315
 
/**
316
 
 * This structure specifies the parameters to open the audio stream.
317
 
 */
318
 
typedef struct pjmedia_aud_param
319
 
{
320
 
    /**
321
 
     * The audio direction. This setting is mandatory.
322
 
     */
323
 
    pjmedia_dir dir;
324
 
 
325
 
    /**
326
 
     * The audio recorder device ID. This setting is mandatory if the audio
327
 
     * direction includes input/capture direction.
328
 
     */
329
 
    pjmedia_aud_dev_index rec_id;
330
 
 
331
 
    /**
332
 
     * The audio playback device ID. This setting is mandatory if the audio
333
 
     * direction includes output/playback direction.
334
 
     */
335
 
    pjmedia_aud_dev_index play_id;
336
 
 
337
 
    /** 
338
 
     * Clock rate/sampling rate. This setting is mandatory. 
339
 
     */
340
 
    unsigned clock_rate;
341
 
 
342
 
    /** 
343
 
     * Number of channels. This setting is mandatory. 
344
 
     */
345
 
    unsigned channel_count;
346
 
 
347
 
    /** 
348
 
     * Number of samples per frame. This setting is mandatory. 
349
 
     */
350
 
    unsigned samples_per_frame;
351
 
 
352
 
    /** 
353
 
     * Number of bits per sample. This setting is mandatory. 
354
 
     */
355
 
    unsigned bits_per_sample;
356
 
 
357
 
    /** 
358
 
     * This flags specifies which of the optional settings are valid in this
359
 
     * structure. The flags is bitmask combination of pjmedia_aud_dev_cap.
360
 
     */
361
 
    unsigned flags;
362
 
 
363
 
    /** 
364
 
     * Set the audio format. This setting is optional, and will only be used
365
 
     * if PJMEDIA_AUD_DEV_CAP_EXT_FORMAT is set in the flags.
366
 
     */
367
 
    pjmedia_format ext_fmt;
368
 
 
369
 
    /**
370
 
     * Input latency, in milliseconds. This setting is optional, and will 
371
 
     * only be used if PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY is set in the flags.
372
 
     */
373
 
    unsigned input_latency_ms;
374
 
 
375
 
    /**
376
 
     * Input latency, in milliseconds. This setting is optional, and will 
377
 
     * only be used if PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY is set in the flags.
378
 
     */
379
 
    unsigned output_latency_ms;
380
 
 
381
 
    /**
382
 
     * Input volume setting, in percent. This setting is optional, and will 
383
 
     * only be used if PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING is set in 
384
 
     * the flags.
385
 
     */
386
 
    unsigned input_vol;
387
 
 
388
 
    /**
389
 
     * Output volume setting, in percent. This setting is optional, and will 
390
 
     * only be used if PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING is set in 
391
 
     * the flags.
392
 
     */
393
 
    unsigned output_vol;
394
 
 
395
 
    /** 
396
 
     * Set the audio input route. This setting is optional, and will only be
397
 
     * used if PJMEDIA_AUD_DEV_CAP_INPUT_ROUTE is set in the flags.
398
 
     */
399
 
    pjmedia_aud_dev_route input_route;
400
 
 
401
 
    /** 
402
 
     * Set the audio output route. This setting is optional, and will only be
403
 
     * used if PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE is set in the flags.
404
 
     */
405
 
    pjmedia_aud_dev_route output_route;
406
 
 
407
 
    /**
408
 
     * Enable/disable echo canceller, if the device supports it. This setting
409
 
     * is optional, and will only be used if PJMEDIA_AUD_DEV_CAP_EC is set in
410
 
     * the flags.
411
 
     */
412
 
    pj_bool_t ec_enabled;
413
 
 
414
 
    /**
415
 
     * Set echo canceller tail length in milliseconds, if the device supports
416
 
     * it. This setting is optional, and will only be used if
417
 
     * PJMEDIA_AUD_DEV_CAP_EC_TAIL is set in the flags.
418
 
     */
419
 
    unsigned ec_tail_ms;
420
 
 
421
 
    /** 
422
 
     * Enable/disable PLC. This setting is optional, and will only be used
423
 
     * if PJMEDIA_AUD_DEV_CAP_PLC is set in the flags.
424
 
     */
425
 
    pj_bool_t plc_enabled;
426
 
 
427
 
    /** 
428
 
     * Enable/disable CNG. This setting is optional, and will only be used
429
 
     * if PJMEDIA_AUD_DEV_CAP_CNG is set in the flags.
430
 
     */
431
 
    pj_bool_t cng_enabled;
432
 
 
433
 
} pjmedia_aud_param;
434
 
 
435
 
 
436
 
/** Forward declaration for pjmedia_aud_stream */
437
 
typedef struct pjmedia_aud_stream pjmedia_aud_stream;
438
 
 
439
 
/** Forward declaration for audio device factory */
440
 
typedef struct pjmedia_aud_dev_factory pjmedia_aud_dev_factory;
441
 
 
442
 
/**
443
 
 * Get string info for the specified capability.
444
 
 *
445
 
 * @param cap           The capability ID.
446
 
 * @param p_desc        Optional pointer which will be filled with longer 
447
 
 *                      description about the capability.
448
 
 *
449
 
 * @return              Capability name.
450
 
 */
451
 
PJ_DECL(const char*) pjmedia_aud_dev_cap_name(pjmedia_aud_dev_cap cap,
452
 
                                              const char **p_desc);
453
 
 
454
 
 
455
 
/**
456
 
 * Set a capability field value in #pjmedia_aud_param structure. This will
457
 
 * also set the flags field for the specified capability in the structure.
458
 
 *
459
 
 * @param param         The structure.
460
 
 * @param cap           The audio capability which value is to be set.
461
 
 * @param value         Pointer to value. Please see the type of value to
462
 
 *                      be supplied in the pjmedia_aud_dev_cap documentation.
463
 
 *
464
 
 * @return              PJ_SUCCESS on successful operation or the appropriate
465
 
 *                      error code.
466
 
 */
467
 
PJ_DECL(pj_status_t) pjmedia_aud_param_set_cap(pjmedia_aud_param *param,
468
 
                                               pjmedia_aud_dev_cap cap,
469
 
                                               const void *pval);
470
 
 
471
 
 
472
 
/**
473
 
 * Get a capability field value from #pjmedia_aud_param structure. This
474
 
 * function will return PJMEDIA_EAUD_INVCAP error if the flag for that
475
 
 * capability is not set in the flags field in the structure.
476
 
 *
477
 
 * @param param         The structure.
478
 
 * @param cap           The audio capability which value is to be retrieved.
479
 
 * @param value         Pointer to value. Please see the type of value to
480
 
 *                      be supplied in the pjmedia_aud_dev_cap documentation.
481
 
 *
482
 
 * @return              PJ_SUCCESS on successful operation or the appropriate
483
 
 *                      error code.
484
 
 */
485
 
PJ_DECL(pj_status_t) pjmedia_aud_param_get_cap(const pjmedia_aud_param *param,
486
 
                                               pjmedia_aud_dev_cap cap,
487
 
                                               void *pval);
488
 
 
489
 
/**
490
 
 * Initialize the audio subsystem. This will register all supported audio 
491
 
 * device factories to the audio subsystem. This function may be called
492
 
 * more than once, but each call to this function must have the
493
 
 * corresponding #pjmedia_aud_subsys_shutdown() call.
494
 
 *
495
 
 * @param pf            The pool factory.
496
 
 *
497
 
 * @return              PJ_SUCCESS on successful operation or the appropriate
498
 
 *                      error code.
499
 
 */
500
 
PJ_DECL(pj_status_t) pjmedia_aud_subsys_init(pj_pool_factory *pf);
501
 
 
502
 
 
503
 
/**
504
 
 * Get the pool factory registered to the audio subsystem.
505
 
 *
506
 
 * @return              The pool factory.
507
 
 */
508
 
PJ_DECL(pj_pool_factory*) pjmedia_aud_subsys_get_pool_factory(void);
509
 
 
510
 
 
511
 
/**
512
 
 * Shutdown the audio subsystem. This will destroy all audio device factories
513
 
 * registered in the audio subsystem. Note that currently opened audio streams
514
 
 * may or may not be closed, depending on the implementation of the audio
515
 
 * device factories.
516
 
 *
517
 
 * @return              PJ_SUCCESS on successful operation or the appropriate
518
 
 *                      error code.
519
 
 */
520
 
PJ_DECL(pj_status_t) pjmedia_aud_subsys_shutdown(void);
521
 
 
522
 
 
523
 
/**
524
 
 * Get the number of sound devices installed in the system.
525
 
 *
526
 
 * @return              The number of sound devices installed in the system.
527
 
 */
528
 
PJ_DECL(unsigned) pjmedia_aud_dev_count(void);
529
 
 
530
 
 
531
 
/**
532
 
 * Get device information.
533
 
 *
534
 
 * @param id            The audio device ID.
535
 
 * @param info          The device information which will be filled in by this
536
 
 *                      function once it returns successfully.
537
 
 *
538
 
 * @return              PJ_SUCCESS on successful operation or the appropriate
539
 
 *                      error code.
540
 
 */
541
 
PJ_DECL(pj_status_t) pjmedia_aud_dev_get_info(pjmedia_aud_dev_index id,
542
 
                                              pjmedia_aud_dev_info *info);
543
 
 
544
 
 
545
 
/**
546
 
 * Lookup device index based on the driver and device name.
547
 
 *
548
 
 * @param drv_name      The driver name.
549
 
 * @param dev_name      The device name.
550
 
 * @param id            Pointer to store the returned device ID.
551
 
 *
552
 
 * @return              PJ_SUCCESS if the device can be found.
553
 
 */
554
 
PJ_DECL(pj_status_t) pjmedia_aud_dev_lookup(const char *drv_name,
555
 
                                            const char *dev_name,
556
 
                                            pjmedia_aud_dev_index *id);
557
 
 
558
 
 
559
 
/**
560
 
 * Initialize the audio device parameters with default values for the
561
 
 * specified device.
562
 
 *
563
 
 * @param id            The audio device ID.
564
 
 * @param param         The audio device parameters which will be initialized
565
 
 *                      by this function once it returns successfully.
566
 
 *
567
 
 * @return              PJ_SUCCESS on successful operation or the appropriate
568
 
 *                      error code.
569
 
 */
570
 
PJ_DECL(pj_status_t) pjmedia_aud_dev_default_param(pjmedia_aud_dev_index id,
571
 
                                                   pjmedia_aud_param *param);
572
 
 
573
 
 
574
 
/**
575
 
 * Open audio stream object using the specified parameters.
576
 
 *
577
 
 * @param param         Sound device parameters to be used for the stream.
578
 
 * @param rec_cb        Callback to be called on every input frame captured.
579
 
 * @param play_cb       Callback to be called everytime the sound device needs
580
 
 *                      audio frames to be played back.
581
 
 * @param user_data     Arbitrary user data, which will be given back in the
582
 
 *                      callbacks.
583
 
 * @param p_strm        Pointer to receive the audio stream.
584
 
 *
585
 
 * @return              PJ_SUCCESS on successful operation or the appropriate
586
 
 *                      error code.
587
 
 */
588
 
PJ_DECL(pj_status_t) pjmedia_aud_stream_create(const pjmedia_aud_param *param,
589
 
                                               pjmedia_aud_rec_cb rec_cb,
590
 
                                               pjmedia_aud_play_cb play_cb,
591
 
                                               void *user_data,
592
 
                                               pjmedia_aud_stream **p_strm);
593
 
 
594
 
/**
595
 
 * Get the running parameters for the specified audio stream.
596
 
 *
597
 
 * @param strm          The audio stream.
598
 
 * @param param         Audio stream parameters to be filled in by this 
599
 
 *                      function once it returns successfully.
600
 
 *
601
 
 * @return              PJ_SUCCESS on successful operation or the appropriate
602
 
 *                      error code.
603
 
 */
604
 
PJ_DECL(pj_status_t) pjmedia_aud_stream_get_param(pjmedia_aud_stream *strm,
605
 
                                                  pjmedia_aud_param *param);
606
 
 
607
 
/**
608
 
 * Get the value of a specific capability of the audio stream.
609
 
 *
610
 
 * @param strm          The audio stream.
611
 
 * @param cap           The audio capability which value is to be retrieved.
612
 
 * @param value         Pointer to value to be filled in by this function 
613
 
 *                      once it returns successfully.  Please see the type 
614
 
 *                      of value to be supplied in the pjmedia_aud_dev_cap
615
 
 *                      documentation.
616
 
 *
617
 
 * @return              PJ_SUCCESS on successful operation or the appropriate
618
 
 *                      error code.
619
 
 */
620
 
PJ_DECL(pj_status_t) pjmedia_aud_stream_get_cap(pjmedia_aud_stream *strm,
621
 
                                                pjmedia_aud_dev_cap cap,
622
 
                                                void *value);
623
 
 
624
 
/**
625
 
 * Set the value of a specific capability of the audio stream.
626
 
 *
627
 
 * @param strm          The audio stream.
628
 
 * @param cap           The audio capability which value is to be set.
629
 
 * @param value         Pointer to value. Please see the type of value to
630
 
 *                      be supplied in the pjmedia_aud_dev_cap documentation.
631
 
 *
632
 
 * @return              PJ_SUCCESS on successful operation or the appropriate
633
 
 *                      error code.
634
 
 */
635
 
PJ_DECL(pj_status_t) pjmedia_aud_stream_set_cap(pjmedia_aud_stream *strm,
636
 
                                                pjmedia_aud_dev_cap cap,
637
 
                                                const void *value);
638
 
 
639
 
/**
640
 
 * Start the stream.
641
 
 *
642
 
 * @param strm          The audio stream.
643
 
 *
644
 
 * @return              PJ_SUCCESS on successful operation or the appropriate
645
 
 *                      error code.
646
 
 */
647
 
PJ_DECL(pj_status_t) pjmedia_aud_stream_start(pjmedia_aud_stream *strm);
648
 
 
649
 
/**
650
 
 * Stop the stream.
651
 
 *
652
 
 * @param strm          The audio stream.
653
 
 *
654
 
 * @return              PJ_SUCCESS on successful operation or the appropriate
655
 
 *                      error code.
656
 
 */
657
 
PJ_DECL(pj_status_t) pjmedia_aud_stream_stop(pjmedia_aud_stream *strm);
658
 
 
659
 
/**
660
 
 * Destroy the stream.
661
 
 *
662
 
 * @param strm          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_destroy(pjmedia_aud_stream *strm);
668
 
 
669
 
 
670
 
/**
671
 
 * @}
672
 
 */
673
 
 
674
 
PJ_END_DECL
675
 
 
676
 
 
677
 
#endif  /* __PJMEDIA_AUDIODEV_AUDIODEV_H__ */
678