diff options
author | Liong Sauw Ming <ming@teluu.com> | 2011-03-11 06:57:24 +0000 |
---|---|---|
committer | Liong Sauw Ming <ming@teluu.com> | 2011-03-11 06:57:24 +0000 |
commit | c44da2d6d7f8a991cd8143f97acda117a4e0a422 (patch) | |
tree | e57adad451551e486fdbb8f4de0b2240978d091d /pjmedia/include | |
parent | a71c9ccfea1d7d9e7999037a8ee13820eb0e16e2 (diff) |
Fixed #1204: Support for refreshing audio device list.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3438 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia/include')
-rw-r--r-- | pjmedia/include/pjmedia-audiodev/audiodev.h | 14 | ||||
-rw-r--r-- | pjmedia/include/pjmedia-audiodev/audiodev_imp.h | 7 | ||||
-rw-r--r-- | pjmedia/include/pjmedia/sound_port.h | 37 |
3 files changed, 53 insertions, 5 deletions
diff --git a/pjmedia/include/pjmedia-audiodev/audiodev.h b/pjmedia/include/pjmedia-audiodev/audiodev.h index ba28bc0f..1d1c39c0 100644 --- a/pjmedia/include/pjmedia-audiodev/audiodev.h +++ b/pjmedia/include/pjmedia-audiodev/audiodev.h @@ -546,6 +546,20 @@ pjmedia_aud_unregister_factory(pjmedia_aud_dev_factory_create_func_ptr adf); /** + * Refresh the list of sound devices installed in the system. This function + * will only refresh the list of audio device so all active audio streams will + * be unaffected. After refreshing the device list, application MUST make sure + * to update all index references to audio devices (i.e. all variables of type + * pjmedia_aud_dev_index) before calling any function that accepts audio device + * index as its parameter. + * + * @return PJ_SUCCESS on successful operation or the appropriate + * error code. + */ +PJ_DECL(pj_status_t) pjmedia_aud_dev_refresh(void); + + +/** * Get the number of sound devices installed in the system. * * @return The number of sound devices installed in the system. diff --git a/pjmedia/include/pjmedia-audiodev/audiodev_imp.h b/pjmedia/include/pjmedia-audiodev/audiodev_imp.h index e12c0f21..172c1279 100644 --- a/pjmedia/include/pjmedia-audiodev/audiodev_imp.h +++ b/pjmedia/include/pjmedia-audiodev/audiodev_imp.h @@ -92,6 +92,13 @@ typedef struct pjmedia_aud_dev_factory_op void *user_data, pjmedia_aud_stream **p_aud_strm); + /** + * Refresh the list of audio devices installed in the system. + * + * @param f The audio device factory. + */ + pj_status_t (*refresh)(pjmedia_aud_dev_factory *f); + } pjmedia_aud_dev_factory_op; diff --git a/pjmedia/include/pjmedia/sound_port.h b/pjmedia/include/pjmedia/sound_port.h index 7293a4d7..4d2d4aff 100644 --- a/pjmedia/include/pjmedia/sound_port.h +++ b/pjmedia/include/pjmedia/sound_port.h @@ -63,6 +63,33 @@ PJ_BEGIN_DECL */ /** + * Sound port options. + */ +enum pjmedia_snd_port_option +{ + /** + * Don't start the audio device when creating a sound port. + */ + PJMEDIA_SND_PORT_NO_AUTO_START = 1 +}; + +/** + * This structure specifies the parameters to create the sound port. + */ +typedef struct pjmedia_snd_port_param +{ + /** + * Base structure. + */ + pjmedia_aud_param base; + + /** + * Sound port creation options. + */ + unsigned options; +} pjmedia_snd_port_param; + +/** * This opaque type describes sound device port connection. * Sound device port is not a media port, but it is used to connect media * port to the sound device. @@ -86,7 +113,7 @@ typedef struct pjmedia_snd_port pjmedia_snd_port; * @param samples_per_frame Number of samples per frame. * @param bits_per_sample Set the number of bits per sample. The normal * value for this parameter is 16 bits per sample. - * @param options Options flag, currently must be zero. + * @param options Options flag. * @param p_port Pointer to receive the sound device port instance. * * @return PJ_SUCCESS on success, or the appropriate error @@ -116,7 +143,7 @@ PJ_DECL(pj_status_t) pjmedia_snd_port_create( pj_pool_t *pool, * @param samples_per_frame Number of samples per frame. * @param bits_per_sample Set the number of bits per sample. The normal * value for this parameter is 16 bits per sample. - * @param options Options flag, currently must be zero. + * @param options Options flag. * @param p_port Pointer to receive the sound device port instance. * * @return PJ_SUCCESS on success, or the appropriate error @@ -145,7 +172,7 @@ PJ_DECL(pj_status_t) pjmedia_snd_port_create_rec(pj_pool_t *pool, * @param samples_per_frame Number of samples per frame. * @param bits_per_sample Set the number of bits per sample. The normal * value for this parameter is 16 bits per sample. - * @param options Options flag, currently must be zero. + * @param options Options flag. * @param p_port Pointer to receive the sound device port instance. * * @return PJ_SUCCESS on success, or the appropriate error @@ -165,14 +192,14 @@ PJ_DECL(pj_status_t) pjmedia_snd_port_create_player(pj_pool_t *pool, * Create sound device port according to the specified parameters. * * @param pool Pool to allocate sound port structure. - * @param prm Sound device settings. + * @param prm Sound port parameter. * @param p_port Pointer to receive the sound device port instance. * * @return PJ_SUCCESS on success, or the appropriate error * code. */ PJ_DECL(pj_status_t) pjmedia_snd_port_create2(pj_pool_t *pool, - const pjmedia_aud_param *prm, + const pjmedia_snd_port_param *prm, pjmedia_snd_port **p_port); |