Ignore:
Timestamp:
Mar 9, 2009 1:08:16 PM (15 years ago)
Author:
bennylp
Message:

BIG refactoring in pjsua_media.c:

  • switchboard/conf detection is done at run-time, removing #ifdefs
    • use one function, open_snd_dev() to open device
    • use one function, create_aud_param() to initialize audio parameters:
      • get the default from device
      • override with user settings previously done with pjsua_snd_set_setting() (new API)
  • added new API to set/get sound device settings. The settings are

semi permanent, it will be used for future opening of sound dev:

  • pjsua_snd_set_setting()
  • pjsua_snd_get_setting()
  • snd_auto_close_time default value changed to 1 (from -1)
  • both pjsua_enum_snd_devs() and pjsua_enum_aud_devs() API are now

supported (previously it was done with #ifdef).

  • make_call() will not open the sound device is switchboard is

used

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/aps-direct/pjsip/include/pjsua-lib/pjsua.h

    r2480 r2493  
    42874287    /** 
    42884288     * Specify idle time of sound device before it is automatically closed, 
    4289      * in seconds. 
    4290      * 
    4291      * Default : -1 (Disable the auto-close feature of sound device) 
     4289     * in seconds. Use value -1 to disable the auto-close feature of sound 
     4290     * device 
     4291     * 
     4292     * Default : 1 
    42924293     */ 
    42934294    int                 snd_auto_close_time; 
     
    48024803 
    48034804/** 
    4804  * Enum all sound devices installed in the system. 
     4805 * Enum all audio devices installed in the system. 
    48054806 * 
    48064807 * @param info          Array of info to be initialized. 
     
    48104811 * 
    48114812 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     4813 */ 
     4814PJ_DECL(pj_status_t) pjsua_enum_aud_devs(pjmedia_aud_dev_info info[], 
     4815                                         unsigned *count); 
     4816 
     4817/** 
     4818 * Enum all sound devices installed in the system (old API). 
     4819 * 
     4820 * @param info          Array of info to be initialized. 
     4821 * @param count         On input, specifies max elements in the array. 
     4822 *                      On return, it contains actual number of elements 
     4823 *                      that have been initialized. 
     4824 * 
     4825 * @return              PJ_SUCCESS on success, or the appropriate error code. 
    48124826 * 
    48134827 * 
     
    48194833 * 
    48204834 */ 
    4821 #if PJMEDIA_AUDIO_API==PJMEDIA_AUDIO_API_NEW_ONLY 
    4822 PJ_DECL(pj_status_t) pjsua_enum_snd_devs(pjmedia_aud_dev_info info[], 
    4823                                          unsigned *count); 
    4824 #else 
    48254835PJ_DECL(pj_status_t) pjsua_enum_snd_devs(pjmedia_snd_dev_info info[], 
    48264836                                         unsigned *count); 
    4827 #endif 
    4828  
    48294837 
    48304838/** 
     
    48984906 
    48994907/** 
    4900  * Change the echo cancellation settings. The behavior of this function  
    4901  * depends on whether the sound device is currently active, and if it is, 
    4902  * whether device or software AEC is being used.  
     4908 * Change the echo cancellation settings. Application may also use the 
     4909 * #pjsua_snd_set_setting() to retrieve the echo cancellation setting. 
     4910 * 
     4911 * The behavior of this function depends on whether the sound device is 
     4912 * currently active, and if it is, whether device or software AEC is  
     4913 * being used.  
    49034914 * 
    49044915 * If the sound device is currently active, and if the device supports AEC, 
     
    49294940 
    49304941/** 
    4931  * Get current echo canceller tail length. 
     4942 * Get current echo canceller tail length. Application may also use the 
     4943 * #pjsua_snd_set_setting() to retrieve the echo cancellation setting. 
    49324944 * 
    49334945 * @param p_tail_ms     Pointer to receive the tail length, in miliseconds.  
     
    49454957 
    49464958/** 
    4947  * Get active audio device stream instance. 
    4948  * 
    4949  * @return              Audio device stream instance if any, otherwise  
    4950  *                      NULL will be returned. 
    4951  */ 
    4952 PJ_DECL(pjmedia_aud_stream*) pjsua_get_aud_stream(); 
     4959 * Check whether the sound device is currently active. The sound device 
     4960 * may be inactive if the application has set the auto close feature to 
     4961 * non-zero (the snd_auto_close_time setting in #pjsua_media_config), or 
     4962 * if null sound device or no sound device has been configured via the 
     4963 * #pjsua_set_no_snd_dev() function. 
     4964 */ 
     4965PJ_DECL(pj_bool_t) pjsua_snd_is_active(void); 
     4966 
     4967     
     4968/** 
     4969 * Configure sound device setting to the sound device being used. If sound  
     4970 * device is currently active, the function will forward the setting to the 
     4971 * sound device instance to be applied immediately, if it supports it.  
     4972 * 
     4973 * The setting will be saved for future opening of the sound device, if the  
     4974 * "keep" argument is set to non-zero. If the sound device is currently 
     4975 * inactive, and the "keep" argument is false, this function will return 
     4976 * error. 
     4977 *  
     4978 * Note that in case the setting is kept for future use, it will be applied 
     4979 * to any devices, even when application has changed the sound device to be 
     4980 * used. 
     4981 * 
     4982 * See also #pjmedia_aud_stream_set_cap() for more information about setting 
     4983 * an audio device capability. 
     4984 * 
     4985 * @param cap           The sound device setting to change. 
     4986 * @param pval          Pointer to value. Please see #pjmedia_aud_dev_cap 
     4987 *                      documentation about the type of value to be  
     4988 *                      supplied for each setting. 
     4989 * @param keep          Specify whether the setting is to be kept for future 
     4990 *                      use. 
     4991 * 
     4992 * @return              PJ_SUCCESS on success or the appropriate error code. 
     4993 */ 
     4994PJ_DECL(pj_status_t) pjsua_snd_set_setting(pjmedia_aud_dev_cap cap, 
     4995                                           const void *pval, 
     4996                                           pj_bool_t keep); 
     4997 
     4998/** 
     4999 * Retrieve a sound device setting. If sound device is currently active, 
     5000 * the function will forward the request to the sound device. If sound device 
     5001 * is currently inactive, and if application had previously set the setting 
     5002 * and mark the setting as kept, then that setting will be returned. 
     5003 * Otherwise, this function will return error. 
     5004 * 
     5005 * @param cap           The sound device setting to retrieve. 
     5006 * @param pval          Pointer to receive the value.  
     5007 *                      Please see #pjmedia_aud_dev_cap documentation about 
     5008 *                      the type of value to be supplied for each setting. 
     5009 * 
     5010 * @return              PJ_SUCCESS on success or the appropriate error code. 
     5011 */ 
     5012PJ_DECL(pj_status_t) pjsua_snd_get_setting(pjmedia_aud_dev_cap cap, 
     5013                                           void *pval); 
    49535014 
    49545015 
Note: See TracChangeset for help on using the changeset viewer.