Ignore:
Timestamp:
Feb 21, 2009 2:21:59 PM (15 years ago)
Author:
bennylp
Message:

Updated libraries and applications to use the new Audio Device API

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/aps-direct/pjmedia/include/pjmedia-audiodev/audiodev.h

    r2466 r2468  
    1818 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
    1919 */ 
    20 #ifndef __AUDIODEV_H__ 
    21 #define __AUDIODEV_H__ 
     20#ifndef __PJMEDIA_AUDIODEV_AUDIODEV_H__ 
     21#define __PJMEDIA_AUDIODEV_AUDIODEV_H__ 
    2222 
    2323/** 
     
    5252 */ 
    5353 
    54 /** Device identifier */ 
    55 typedef pj_int32_t pjmedia_aud_dev_id; 
    56  
    57 /** Constant to denote default ID */ 
    58 #define PJMEDIA_AUD_DEV_DEFAULT_ID  (-1) 
     54/**  
     55 * Type for device index. 
     56 */ 
     57typedef pj_int32_t pjmedia_aud_dev_index; 
     58 
     59/**  
     60 * Constant to denote default device  
     61 */ 
     62#define PJMEDIA_AUD_DEV_DEFAULT  (-1) 
     63 
     64/**  
     65 * Type for device unique identifier. The unique device ID can be used to save 
     66 * a reference to a particular device across software reboots. 
     67 */ 
     68typedef pj_uint32_t pjmedia_aud_dev_uid; 
    5969 
    6070 
     
    6777 * 
    6878 * Application can also set the specific features/capabilities when opening 
    69  * the audio stream by setting the \a flags member of #pjmedia_aud_dev_param 
     79 * the audio stream by setting the \a flags member of #pjmedia_aud_param 
    7080 * structure. 
    7181 * 
     
    118128     * the audio volume in percent. 
    119129     */ 
    120     PJMEDIA_AUD_DEV_CAP_INPUT_SIGNAL_VOLUME = 32, 
     130    PJMEDIA_AUD_DEV_CAP_INPUT_SIGNAL_METER = 32, 
    121131 
    122132    /**  
     
    125135     * the audio volume in percent. 
    126136     */ 
    127     PJMEDIA_AUD_DEV_CAP_OUTPUT_SIGNAL_VOLUME = 64, 
     137    PJMEDIA_AUD_DEV_CAP_OUTPUT_SIGNAL_METER = 64, 
    128138 
    129139    /**  
     
    142152    /**  
    143153     * The audio device has echo cancellation feature. The value of this 
    144      * capability is an integer containing boolean PJ_TRUE or PJ_FALSE. 
     154     * capability is a pj_bool_t containing boolean PJ_TRUE or PJ_FALSE. 
    145155     */ 
    146156    PJMEDIA_AUD_DEV_CAP_EC = 512, 
     
    155165    /**  
    156166     * The audio device has voice activity detection feature. The value 
    157      * of this capability is an integer containing boolean PJ_TRUE or  
     167     * of this capability is a pj_bool_t containing boolean PJ_TRUE or  
    158168     * PJ_FALSE. 
    159169     */ 
     
    162172    /**  
    163173     * The audio device has comfort noise generation feature. The value 
    164      * of this capability is an integer containing boolean PJ_TRUE or  
     174     * of this capability is a pj_bool_t containing boolean PJ_TRUE or  
    165175     * PJ_FALSE. 
    166176     */ 
     
    169179    /**  
    170180     * The audio device has packet loss concealment feature. The value 
    171      * of this capability is an integer containing boolean PJ_TRUE or  
     181     * of this capability is a pj_bool_t containing boolean PJ_TRUE or  
    172182     * PJ_FALSE. 
    173183     */ 
     
    226236     * The underlying driver name  
    227237     */ 
    228     char driver[128]; 
     238    char driver[32]; 
    229239 
    230240    /**  
     
    290300 
    291301/** 
    292  * This structure specifies the parameters to open the audio device stream. 
    293  */ 
    294 typedef struct pjmedia_aud_dev_param 
     302 * This structure specifies the parameters to open the audio stream. 
     303 */ 
     304typedef struct pjmedia_aud_param 
    295305{ 
    296306    /** 
     
    303313     * direction includes input/capture direction. 
    304314     */ 
    305     pjmedia_aud_dev_id rec_id; 
     315    pjmedia_aud_dev_index rec_id; 
    306316 
    307317    /** 
     
    309319     * direction includes output/playback direction. 
    310320     */ 
    311     pjmedia_aud_dev_id play_id; 
     321    pjmedia_aud_dev_index play_id; 
    312322 
    313323    /**  
     
    387397    pj_bool_t cng_enabled; 
    388398 
    389 } pjmedia_aud_dev_param; 
     399} pjmedia_aud_param; 
    390400 
    391401 
     
    432442 
    433443/** 
     444 * Get string info for the specified capability. 
     445 * 
     446 * @param cap           The capability ID. 
     447 * @param p_desc        Optional pointer which will be filled with longer  
     448 *                      description about the capability. 
     449 * 
     450 * @return              Capability name. 
     451 */ 
     452PJ_DECL(const char*) pjmedia_aud_dev_cap_name(pjmedia_aud_dev_cap cap, 
     453                                              const char **p_desc); 
     454 
     455 
     456/** 
    434457 * Get the number of sound devices installed in the system. 
    435458 * 
     
    438461PJ_DECL(unsigned) pjmedia_aud_dev_count(void); 
    439462 
    440  
    441 /** 
    442  * Enumerate device ID's. 
    443  * 
    444  * @param max_count     Maximum number of device id's to retrieve. 
    445  * @param ids           Array to receive the device id's. 
    446  * 
    447  * @return              The actual number of device id's filled in. 
    448  */ 
    449 PJ_DECL(unsigned) pjmedia_aud_dev_enum(unsigned max_count, 
    450                                        pjmedia_aud_dev_id ids[]); 
    451463 
    452464/** 
     
    460472 *                      error code. 
    461473 */ 
    462 PJ_DECL(pj_status_t) pjmedia_aud_dev_get_info(pjmedia_aud_dev_id id, 
     474PJ_DECL(pj_status_t) pjmedia_aud_dev_get_info(pjmedia_aud_dev_index id, 
    463475                                              pjmedia_aud_dev_info *info); 
     476 
     477 
     478/** 
     479 * Lookup device index based on the driver and device name. 
     480 * 
     481 * @param drv_name      The driver name. 
     482 * @param dev_name      The device name. 
     483 * 
     484 * @return              PJ_SUCCESS if the device can be found. 
     485 */ 
     486PJ_DECL(pj_status_t) pjmedia_aud_dev_lookup(const char *drv_name, 
     487                                            const char *dev_name, 
     488                                            pjmedia_aud_dev_index *id); 
    464489 
    465490 
     
    475500 *                      error code. 
    476501 */ 
    477 PJ_DECL(pj_status_t) pjmedia_aud_dev_default_param(pjmedia_aud_dev_id id, 
    478                                                    pjmedia_aud_dev_param *param); 
     502PJ_DECL(pj_status_t) pjmedia_aud_dev_default_param(pjmedia_aud_dev_index id, 
     503                                                   pjmedia_aud_param *param); 
    479504 
    480505 
     
    493518 *                      error code. 
    494519 */ 
    495 PJ_DECL(pj_status_t) pjmedia_aud_stream_create(const pjmedia_aud_dev_param *param, 
     520PJ_DECL(pj_status_t) pjmedia_aud_stream_create(const pjmedia_aud_param *param, 
    496521                                               pjmedia_aud_rec_cb rec_cb, 
    497522                                               pjmedia_aud_play_cb play_cb, 
    498523                                               void *user_data, 
    499                                                pjmedia_aud_stream **p_aud_strm); 
     524                                               pjmedia_aud_stream **p_strm); 
    500525 
    501526/** 
     
    510535 */ 
    511536PJ_DECL(pj_status_t) pjmedia_aud_stream_get_param(pjmedia_aud_stream *strm, 
    512                                                   pjmedia_aud_dev_param *param); 
     537                                                  pjmedia_aud_param *param); 
    513538 
    514539/** 
     
    581606#define PJMEDIA_EAUD_NOTREADY   -1 
    582607 
     608/* Invalid audio capability or audio capability not supported */ 
     609#define PJMEDIA_EAUD_INVCAP     -1 
     610 
    583611/* Unknown system error */ 
    584612#define PJMEDIA_EAUD_SYSERR     -1 
     
    592620 
    593621 
    594 #endif  /* __AUDIODEV_H__ */ 
    595  
     622#endif  /* __PJMEDIA_AUDIODEV_AUDIODEV_H__ */ 
     623 
Note: See TracChangeset for help on using the changeset viewer.