summaryrefslogtreecommitdiff
path: root/pjsip/include
diff options
context:
space:
mode:
authorRiza Sulistyo <riza@teluu.com>2016-04-04 01:44:10 +0000
committerRiza Sulistyo <riza@teluu.com>2016-04-04 01:44:10 +0000
commitfbbfd915b0225c657920a6696f460a687f28cc6b (patch)
tree3e8a5bce9748861c1d81f045aae0bb5a2154f44b /pjsip/include
parent98de8381dbe5c50477e03d7571d53a836b4500fa (diff)
Re #1908: Implement new API to open speaker only in pjsua/pjsua2.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5273 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/include')
-rw-r--r--pjsip/include/pjsua-lib/pjsua.h65
-rw-r--r--pjsip/include/pjsua-lib/pjsua_internal.h1
-rw-r--r--pjsip/include/pjsua2/media.hpp17
3 files changed, 81 insertions, 2 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h
index 6b6b5569..4887a97e 100644
--- a/pjsip/include/pjsua-lib/pjsua.h
+++ b/pjsip/include/pjsua-lib/pjsua.h
@@ -5997,6 +5997,62 @@ typedef struct pjsua_media_transport
} pjsua_media_transport;
+/**
+ * This enumeration specifies the sound device mode.
+ */
+typedef enum pjsua_snd_dev_mode
+{
+ /**
+ * Open sound device without mic (speaker only).
+ */
+ PJSUA_SND_DEV_SPEAKER_ONLY = 1,
+
+ /**
+ * Do not open sound device, after setting the sound device.
+ */
+ PJSUA_SND_DEV_NO_IMMEDIATE_OPEN = 2
+
+} pjsua_snd_dev_mode;
+
+
+/**
+ * This structure specifies the parameters to set the sound device.
+ * Use pjsua_snd_dev_param_default() to initialize this structure with
+ * default values.
+ */
+typedef struct pjsua_snd_dev_param
+{
+ /*
+ * Capture dev id.
+ *
+ * Default: PJMEDIA_AUD_DEFAULT_CAPTURE_DEV
+ */
+ int capture_dev;
+
+ /*
+ * Playback dev id.
+ *
+ * Default: PJMEDIA_AUD_DEFAULT_PLAYBACK_DEV
+ */
+ int playback_dev;
+
+ /*
+ * Sound device mode, refer to #pjsua_snd_dev_mode.
+ *
+ * Default: 0
+ */
+ unsigned mode;
+
+} pjsua_snd_dev_param;
+
+
+/**
+ * Initialize pjsua_snd_dev_param with default values.
+ *
+ * @param prm The parameter.
+ */
+PJ_DECL(void) pjsua_snd_dev_param_default(pjsua_snd_dev_param *prm);
+
/**
* Get maxinum number of conference ports.
@@ -6384,6 +6440,15 @@ PJ_DECL(pj_status_t) pjsua_get_snd_dev(int *capture_dev,
PJ_DECL(pj_status_t) pjsua_set_snd_dev(int capture_dev,
int playback_dev);
+/**
+ * Select or change sound device according to the specified param.
+ *
+ * @param snd_param Sound device param.
+ *
+ * @return PJ_SUCCESS on success, or the appropriate error code.
+ */
+PJ_DECL(pj_status_t) pjsua_set_snd_dev2(pjsua_snd_dev_param *snd_param);
+
/**
* Set pjsua to use null sound device. The null sound device only provides
diff --git a/pjsip/include/pjsua-lib/pjsua_internal.h b/pjsip/include/pjsua-lib/pjsua_internal.h
index dc98cc6f..e1fad139 100644
--- a/pjsip/include/pjsua-lib/pjsua_internal.h
+++ b/pjsip/include/pjsua-lib/pjsua_internal.h
@@ -478,6 +478,7 @@ struct pjsua_data
pjmedia_master_port *null_snd; /**< Master port for null sound. */
pjmedia_port *null_port; /**< Null port. */
pj_bool_t snd_is_on; /**< Media flow is currently active */
+ unsigned snd_mode; /**< Sound device mode. */
/* Video device */
pjmedia_vid_dev_index vcap_dev; /**< Capture device ID. */
diff --git a/pjsip/include/pjsua2/media.hpp b/pjsip/include/pjsua2/media.hpp
index e642d171..4e42c574 100644
--- a/pjsip/include/pjsua2/media.hpp
+++ b/pjsip/include/pjsua2/media.hpp
@@ -767,7 +767,9 @@ public:
/**
* Select or change capture sound device. Application may call this
- * function at any time to replace current sound device.
+ * function at any time to replace current sound device. Calling this
+ * method will not change the state of the sound device (opened/closed).
+ * Note that this method will override the mode set by setSndDevMode().
*
* @param capture_dev Device ID of the capture device.
*/
@@ -775,7 +777,9 @@ public:
/**
* Select or change playback sound device. Application may call this
- * function at any time to replace current sound device.
+ * function at any time to replace current sound device. Calling this
+ * method will not change the state of the sound device (opened/closed).
+ * Note that this method will override the mode set by setSndDevMode().
*
* @param playback_dev Device ID of the playback device.
*/
@@ -807,6 +811,15 @@ public:
MediaPort *setNoDev();
/**
+ * Set sound device mode.
+ *
+ * @param mode The sound device mode, as bitmask combination
+ * of #pjsua_snd_dev_mode
+ *
+ */
+ void setSndDevMode(unsigned mode) const throw(Error);
+
+ /**
* Change the echo cancellation settings.
*
* The behavior of this function depends on whether the sound device is